2 require_once("boot.php");
3 require_once("include/text.php");
5 define('NEW_UPDATE_ROUTINE_VERSION', 1170);
8 * send the email and do what is needed to do on update fails
10 * @param update_id (int) number of failed update
11 * @param error_message (str) error message
13 function update_fail($update_id, $error_message){
14 //send the administrators an e-mail
15 $admin_mail_list = "'".implode("','", array_map(dbesc, explode(",", str_replace(" ", "", $a->config['admin_email']))))."'";
16 $adminlist = q("SELECT uid, language, email FROM user WHERE email IN (%s)",
20 // every admin could had different language
22 foreach ($adminlist as $admin) {
23 $lang = (($admin['language'])?$admin['language']:'en');
26 $preamble = deindent(t("
27 The friendica developers released update %s recently,
28 but when I tried to install it, something went terribly wrong.
29 This needs to be fixed soon and I can't do it alone. Please contact a
30 friendica developer if you can not help me on your own. My database might be invalid."));
31 $body = t("The error message is\n[pre]%s[/pre]");
32 $preamble = sprintf($preamble, $update_id);
33 $body = sprintf($body, $error_message);
36 'type' => "SYSTEM_EMAIL",
37 'to_email' => $admin['email'],
38 'preamble' => $preamble,
48 $email_tpl = get_intltext_template("update_fail_eml.tpl");
49 $email_msg = replace_macros($email_tpl, array(
50 '$sitename' => $a->config['sitename'],
51 '$siteurl' => $a->get_baseurl(),
52 '$update' => DB_UPDATE_VERSION,
53 '$error' => sprintf(t('Update %s failed. See error logs.'), DB_UPDATE_VERSION)
55 $subject=sprintf(t('Update Error at %s'), $a->get_baseurl());
56 require_once('include/email.php');
57 $subject = email_header_encode($subject,'UTF-8');
58 mail($a->config['admin_email'], $subject, $email_msg,
59 'From: ' . 'Administrator' . '@' . $_SERVER['SERVER_NAME']."\n"
60 .'Content-type: text/plain; charset=UTF-8'."\n"
61 .'Content-transfer-encoding: 8bit');
64 logger("CRITICAL: Database structure update failed: ".$retval);
68 function table_structure($table) {
69 $structures = q("DESCRIBE `%s`", $table);
71 $indexes = q("SHOW INDEX FROM `%s`", $table);
76 if (is_array($indexes))
77 foreach ($indexes AS $index) {
78 if ($index["Index_type"] == "FULLTEXT")
81 $column = $index["Column_name"];
82 // On utf8mb4 a varchar index can only have a length of 191
83 // To avoid the need to add this to every index definition we just ignore it here.
84 // Exception are primary indexes
85 // Since there are some combindex primary indexes we use the limit of 180 here.
86 if (($index["Sub_part"] != "") AND (($index["Sub_part"] < 180) OR ($index["Key_name"] == "PRIMARY")))
87 $column .= "(".$index["Sub_part"].")";
89 $indexdata[$index["Key_name"]][] = $column;
92 if (is_array($structures)) {
93 foreach($structures AS $field) {
94 $fielddata[$field["Field"]]["type"] = $field["Type"];
95 if ($field["Null"] == "NO")
96 $fielddata[$field["Field"]]["not null"] = true;
98 if (isset($field["Default"]))
99 $fielddata[$field["Field"]]["default"] = $field["Default"];
101 if ($field["Extra"] != "")
102 $fielddata[$field["Field"]]["extra"] = $field["Extra"];
104 if ($field["Key"] == "PRI")
105 $fielddata[$field["Field"]]["primary"] = true;
108 return(array("fields"=>$fielddata, "indexes"=>$indexdata));
111 function print_structure($database, $charset) {
112 echo "-- ------------------------------------------\n";
113 echo "-- ".FRIENDICA_PLATFORM." ".FRIENDICA_VERSION." (".FRIENDICA_CODENAME,")\n";
114 echo "-- DB_UPDATE_VERSION ".DB_UPDATE_VERSION."\n";
115 echo "-- ------------------------------------------\n\n\n";
116 foreach ($database AS $name => $structure) {
118 echo "-- TABLE $name\n";
120 db_create_table($name, $structure['fields'], $charset, true, false, $structure["indexes"]);
126 function update_structure($verbose, $action, $tables=null, $definition=null) {
130 set_config('system', 'maintenance', 1);
132 if (isset($a->config["system"]["db_charset"]))
133 $charset = $a->config["system"]["db_charset"];
139 logger('updating structure', LOGGER_DEBUG);
141 // Get the current structure
144 if (is_null($tables))
145 $tables = q("show tables");
147 foreach ($tables AS $table) {
148 $table = current($table);
150 $database[$table] = table_structure($table);
153 // Get the definition
154 if (is_null($definition))
155 $definition = db_definition($charset);
159 foreach ($definition AS $name => $structure) {
160 $is_new_table = False;
162 if (!isset($database[$name])) {
163 $r = db_create_table($name, $structure["fields"], $charset, $verbose, $action, $structure['indexes']);
165 $errors .= t('Errors encountered creating database tables.').$name.EOL;
167 $is_new_table = True;
169 // Drop the index if it isn't present in the definition
170 // or the definition differ from current status
171 // and index name doesn't start with "local_"
172 foreach ($database[$name]["indexes"] AS $indexname => $fieldnames) {
173 $current_index_definition = implode(",",$fieldnames);
174 if (isset($structure["indexes"][$indexname])) {
175 $new_index_definition = implode(",",$structure["indexes"][$indexname]);
177 $new_index_definition = "__NOT_SET__";
179 if ($current_index_definition != $new_index_definition && substr($indexname, 0, 6) != 'local_') {
180 $sql2=db_drop_index($indexname);
182 $sql3 = "ALTER TABLE `".$name."` ".$sql2;
187 // Compare the field structure field by field
188 foreach ($structure["fields"] AS $fieldname => $parameters) {
189 if (!isset($database[$name]["fields"][$fieldname])) {
190 $sql2=db_add_table_field($fieldname, $parameters);
192 $sql3 = "ALTER TABLE `".$name."` ".$sql2;
196 // Compare the field definition
197 $current_field_definition = implode(",",$database[$name]["fields"][$fieldname]);
198 $new_field_definition = implode(",",$parameters);
199 if ($current_field_definition != $new_field_definition) {
200 $sql2=db_modify_table_field($fieldname, $parameters);
202 $sql3 = "ALTER TABLE `".$name."` ".$sql2;
211 // Create the index if the index don't exists in database
212 // or the definition differ from the current status.
213 // Don't create keys if table is new
214 if (!$is_new_table) {
215 foreach ($structure["indexes"] AS $indexname => $fieldnames) {
216 if (isset($database[$name]["indexes"][$indexname])) {
217 $current_index_definition = implode(",",$database[$name]["indexes"][$indexname]);
219 $current_index_definition = "__NOT_SET__";
221 $new_index_definition = implode(",",$fieldnames);
222 if ($current_index_definition != $new_index_definition) {
223 $sql2=db_create_index($indexname, $fieldnames);
226 $sql3 = "ALTER TABLE `".$name."` ".$sql2;
242 $errors .= t('Errors encountered performing database changes.').$sql3.EOL;
248 set_config('system', 'maintenance', 0);
253 function db_field_command($parameters, $create = true) {
254 $fieldstruct = $parameters["type"];
256 if ($parameters["not null"])
257 $fieldstruct .= " NOT NULL";
259 if (isset($parameters["default"])){
260 if (strpos(strtolower($parameters["type"]),"int")!==false) {
261 $fieldstruct .= " DEFAULT ".$parameters["default"];
263 $fieldstruct .= " DEFAULT '".$parameters["default"]."'";
266 if ($parameters["extra"] != "")
267 $fieldstruct .= " ".$parameters["extra"];
269 /*if (($parameters["primary"] != "") AND $create)
270 $fieldstruct .= " PRIMARY KEY";*/
272 return($fieldstruct);
275 function db_create_table($name, $fields, $charset, $verbose, $action, $indexes=null) {
283 $primary_keys = array();
284 foreach($fields AS $fieldname => $field) {
285 $sql_rows[] = "`".dbesc($fieldname)."` ".db_field_command($field);
286 if (x($field,'primary') and $field['primary']!=''){
287 $primary_keys[] = $fieldname;
291 if (!is_null($indexes)) {
292 foreach ($indexes AS $indexname => $fieldnames) {
293 $sql_index = db_create_index($indexname, $fieldnames, "");
294 if (!is_null($sql_index)) $sql_rows[] = $sql_index;
298 $sql = implode(",\n\t", $sql_rows);
300 $sql = sprintf("CREATE TABLE IF NOT EXISTS `%s` (\n\t", dbesc($name)).$sql."\n) DEFAULT CHARSET=".$charset;
310 function db_add_table_field($fieldname, $parameters) {
311 $sql = sprintf("ADD `%s` %s", dbesc($fieldname), db_field_command($parameters));
315 function db_modify_table_field($fieldname, $parameters) {
316 $sql = sprintf("MODIFY `%s` %s", dbesc($fieldname), db_field_command($parameters, false));
320 function db_drop_index($indexname) {
321 $sql = sprintf("DROP INDEX `%s`", dbesc($indexname));
325 function db_create_index($indexname, $fieldnames, $method="ADD") {
327 $method = strtoupper(trim($method));
328 if ($method!="" && $method!="ADD") {
329 throw new Exception("Invalid parameter 'method' in db_create_index(): '$method'");
334 foreach ($fieldnames AS $fieldname) {
338 if (preg_match('|(.+)\((\d+)\)|', $fieldname, $matches))
339 $names .= "`".dbesc($matches[1])."`(".intval($matches[2]).")";
341 $names .= "`".dbesc($fieldname)."`";
344 if ($indexname == "PRIMARY") {
345 return sprintf("%s PRIMARY KEY(%s)", $method, $names);
349 $sql = sprintf("%s INDEX `%s` (%s)", $method, dbesc($indexname), $names);
353 function db_index_suffix($charset, $reduce = 0) {
354 if ($charset != "utf8mb4")
357 // On utf8mb4 indexes can only have a length of 191
358 $indexlength = 191 - $reduce;
360 return "(".$indexlength.")";
363 function db_definition($charset) {
367 $database["addon"] = array(
369 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
370 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
371 "version" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
372 "installed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
373 "hidden" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
374 "timestamp" => array("type" => "bigint(20)", "not null" => "1", "default" => "0"),
375 "plugin_admin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
378 "PRIMARY" => array("id"),
381 $database["attach"] = array(
383 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
384 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
385 "hash" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
386 "filename" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
387 "filetype" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
388 "filesize" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
389 "data" => array("type" => "longblob", "not null" => "1"),
390 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
391 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
392 "allow_cid" => array("type" => "mediumtext"),
393 "allow_gid" => array("type" => "mediumtext"),
394 "deny_cid" => array("type" => "mediumtext"),
395 "deny_gid" => array("type" => "mediumtext"),
398 "PRIMARY" => array("id"),
401 $database["auth_codes"] = array(
403 "id" => array("type" => "varchar(40)", "not null" => "1", "primary" => "1"),
404 "client_id" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
405 "redirect_uri" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
406 "expires" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
407 "scope" => array("type" => "varchar(250)", "not null" => "1", "default" => ""),
410 "PRIMARY" => array("id"),
413 $database["cache"] = array(
415 "k" => array("type" => "varchar(255)", "not null" => "1", "primary" => "1"),
416 "v" => array("type" => "text"),
417 "expire_mode" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
418 "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
421 "PRIMARY" => array("k".db_index_suffix($charset)),
422 "updated" => array("updated"),
425 $database["challenge"] = array(
427 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
428 "challenge" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
429 "dfrn-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
430 "expire" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
431 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
432 "last_update" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
435 "PRIMARY" => array("id"),
438 $database["clients"] = array(
440 "client_id" => array("type" => "varchar(20)", "not null" => "1", "primary" => "1"),
441 "pw" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
442 "redirect_uri" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
443 "name" => array("type" => "text"),
444 "icon" => array("type" => "text"),
445 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
448 "PRIMARY" => array("client_id"),
451 $database["config"] = array(
453 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
454 "cat" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
455 "k" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
456 "v" => array("type" => "text"),
459 "PRIMARY" => array("id"),
460 "cat_k" => array("cat(30)","k(30)"),
463 $database["contact"] = array(
465 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
466 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
467 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
468 "self" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
469 "remote_self" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
470 "rel" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
471 "duplex" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
472 "network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
473 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
474 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
475 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
476 "about" => array("type" => "text"),
477 "keywords" => array("type" => "text"),
478 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
479 "xmpp" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
480 "attag" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
481 "avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
482 "photo" => array("type" => "text"),
483 "thumb" => array("type" => "text"),
484 "micro" => array("type" => "text"),
485 "site-pubkey" => array("type" => "text"),
486 "issued-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
487 "dfrn-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
488 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
489 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
490 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
491 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
492 "pubkey" => array("type" => "text"),
493 "prvkey" => array("type" => "text"),
494 "batch" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
495 "request" => array("type" => "text"),
496 "notify" => array("type" => "text"),
497 "poll" => array("type" => "text"),
498 "confirm" => array("type" => "text"),
499 "poco" => array("type" => "text"),
500 "aes_allow" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
501 "ret-aes" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
502 "usehub" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
503 "subhub" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
504 "hub-verify" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
505 "last-update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
506 "success_update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
507 "failure_update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
508 "name-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
509 "uri-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
510 "avatar-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
511 "term-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
512 "last-item" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
513 "priority" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
514 "blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
515 "readonly" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
516 "writable" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
517 "forum" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
518 "prv" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
519 "contact-type" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
520 "hidden" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
521 "archive" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
522 "pending" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
523 "rating" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
524 "reason" => array("type" => "text"),
525 "closeness" => array("type" => "tinyint(2)", "not null" => "1", "default" => "99"),
526 "info" => array("type" => "mediumtext"),
527 "profile-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
528 "bdyear" => array("type" => "varchar(4)", "not null" => "1", "default" => ""),
529 "bd" => array("type" => "date", "not null" => "1", "default" => "0000-00-00"),
530 "notify_new_posts" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
531 "fetch_further_information" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
532 "ffi_keyword_blacklist" => array("type" => "mediumtext"),
535 "PRIMARY" => array("id"),
536 "uid" => array("uid"),
537 "nurl" => array("nurl"),
540 $database["conv"] = array(
542 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
543 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
544 "recips" => array("type" => "mediumtext"),
545 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
546 "creator" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
547 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
548 "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
549 "subject" => array("type" => "mediumtext"),
552 "PRIMARY" => array("id"),
553 "uid" => array("uid"),
556 $database["deliverq"] = array(
558 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
559 "cmd" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
560 "item" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
561 "contact" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
564 "PRIMARY" => array("id"),
567 $database["event"] = array(
569 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
570 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
571 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
572 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
573 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
574 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
575 "start" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
576 "finish" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
577 "summary" => array("type" => "text"),
578 "desc" => array("type" => "text"),
579 "location" => array("type" => "text"),
580 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
581 "nofinish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
582 "adjust" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
583 "ignore" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
584 "allow_cid" => array("type" => "mediumtext"),
585 "allow_gid" => array("type" => "mediumtext"),
586 "deny_cid" => array("type" => "mediumtext"),
587 "deny_gid" => array("type" => "mediumtext"),
590 "PRIMARY" => array("id"),
591 "uid" => array("uid"),
594 $database["fcontact"] = array(
596 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
597 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
598 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
599 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
600 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
601 "request" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
602 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
603 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
604 "batch" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
605 "notify" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
606 "poll" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
607 "confirm" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
608 "priority" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
609 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
610 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
611 "pubkey" => array("type" => "text"),
612 "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
615 "PRIMARY" => array("id"),
616 "addr" => array("addr"),
619 $database["ffinder"] = array(
621 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
622 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
623 "cid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
624 "fid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
627 "PRIMARY" => array("id"),
630 $database["fserver"] = array(
632 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
633 "server" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
634 "posturl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
635 "key" => array("type" => "text"),
638 "PRIMARY" => array("id"),
639 "server" => array("server"),
642 $database["fsuggest"] = array(
644 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
645 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
646 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
647 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
648 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
649 "request" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
650 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
651 "note" => array("type" => "text"),
652 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
655 "PRIMARY" => array("id"),
658 $database["gcign"] = array(
660 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
661 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
662 "gcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
665 "PRIMARY" => array("id"),
666 "uid" => array("uid"),
667 "gcid" => array("gcid"),
670 $database["gcontact"] = array(
672 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
673 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
674 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
675 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
676 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
677 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
678 "connect" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
679 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
680 "updated" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
681 "last_contact" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
682 "last_failure" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
683 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
684 "about" => array("type" => "text"),
685 "keywords" => array("type" => "text"),
686 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
687 "birthday" => array("type" => "varchar(32)", "not null" => "1", "default" => "0000-00-00"),
688 "community" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
689 "hide" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
690 "nsfw" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
691 "network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
692 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
693 "notify" => array("type" => "text"),
694 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
695 "generation" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
696 "server_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
699 "PRIMARY" => array("id"),
700 "nurl" => array("nurl"),
701 "name" => array("name"),
702 "nick" => array("nick"),
703 "addr" => array("addr"),
704 "updated" => array("updated"),
707 $database["glink"] = array(
709 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
710 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
711 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
712 "gcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
713 "zcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
714 "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
717 "PRIMARY" => array("id"),
718 "cid_uid_gcid_zcid" => array("cid","uid","gcid","zcid"),
719 "gcid" => array("gcid"),
720 "zcid" => array("zcid"),
723 $database["group"] = array(
725 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
726 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
727 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
728 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
729 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
732 "PRIMARY" => array("id"),
733 "uid" => array("uid"),
736 $database["group_member"] = array(
738 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
739 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
740 "gid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
741 "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
744 "PRIMARY" => array("id"),
745 "uid_gid_contactid" => array("uid","gid","contact-id"),
748 $database["gserver"] = array(
750 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
751 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
752 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
753 "version" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
754 "site_name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
755 "info" => array("type" => "text"),
756 "register_policy" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
757 "poco" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
758 "noscrape" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
759 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
760 "platform" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
761 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
762 "last_poco_query" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
763 "last_contact" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
764 "last_failure" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
767 "PRIMARY" => array("id"),
768 "nurl" => array("nurl"),
771 $database["hook"] = array(
773 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
774 "hook" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
775 "file" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
776 "function" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
777 "priority" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
780 "PRIMARY" => array("id"),
781 "hook_file_function" => array("hook(30)","file(60)","function(30)"),
784 $database["intro"] = array(
786 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
787 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
788 "fid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
789 "contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
790 "knowyou" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
791 "duplex" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
792 "note" => array("type" => "text"),
793 "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
794 "datetime" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
795 "blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
796 "ignore" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
799 "PRIMARY" => array("id"),
802 $database["item"] = array(
804 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
805 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
806 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
807 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
808 "contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
809 "gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
810 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
811 "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
812 "gravity" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
813 "parent" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
814 "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
815 "extid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
816 "thr-parent" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
817 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
818 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
819 "commented" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
820 "received" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
821 "changed" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
822 "owner-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
823 "owner-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
824 "owner-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
825 "owner-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
826 "author-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
827 "author-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
828 "author-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
829 "author-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
830 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
831 "body" => array("type" => "mediumtext"),
832 "app" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
833 "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
834 "object-type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
835 "object" => array("type" => "text"),
836 "target-type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
837 "target" => array("type" => "text"),
838 "postopts" => array("type" => "text"),
839 "plink" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
840 "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
841 "event-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
842 "tag" => array("type" => "mediumtext"),
843 "attach" => array("type" => "mediumtext"),
844 "inform" => array("type" => "mediumtext"),
845 "file" => array("type" => "mediumtext"),
846 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
847 "coord" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
848 "allow_cid" => array("type" => "mediumtext"),
849 "allow_gid" => array("type" => "mediumtext"),
850 "deny_cid" => array("type" => "mediumtext"),
851 "deny_gid" => array("type" => "mediumtext"),
852 "private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
853 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
854 "moderated" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
855 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
856 "spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
857 "starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
858 "bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
859 "unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
860 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
861 "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
862 "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
863 "last-child" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "1"),
864 "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
865 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
866 "rendered-hash" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
867 "rendered-html" => array("type" => "mediumtext"),
868 "global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
871 "PRIMARY" => array("id"),
872 "guid" => array("guid"),
873 "uri" => array("uri"),
874 "parent" => array("parent"),
875 "parent-uri" => array("parent-uri"),
876 "extid" => array("extid"),
877 "uid_id" => array("uid","id"),
878 "uid_created" => array("uid","created"),
879 "uid_unseen_contactid" => array("uid","unseen","contact-id"),
880 "uid_network_received" => array("uid","network","received"),
881 "uid_received" => array("uid","received"),
882 "uid_network_commented" => array("uid","network","commented"),
883 "uid_commented" => array("uid","commented"),
884 "uid_title" => array("uid","title"),
885 "uid_thrparent" => array("uid","thr-parent"),
886 "uid_parenturi" => array("uid","parent-uri"),
887 "uid_contactid_id" => array("uid","contact-id","id"),
888 "uid_contactid_created" => array("uid","contact-id","created"),
889 "gcontactid_uid_created" => array("gcontact-id","uid","created"),
890 "authorid_created" => array("author-id","created"),
891 "ownerid_created" => array("owner-id","created"),
892 "wall_body" => array("wall","body(6)"),
893 "uid_visible_moderated_created" => array("uid","visible","moderated","created"),
894 "uid_uri" => array("uid","uri"),
895 "uid_wall_created" => array("uid","wall","created"),
896 "resource-id" => array("resource-id"),
897 "uid_type" => array("uid","type"),
898 "uid_starred_id" => array("uid","starred", "id"),
899 "contactid_allowcid_allowpid_denycid_denygid" => array("contact-id","allow_cid(10)","allow_gid(10)","deny_cid(10)","deny_gid(10)"),
900 "uid_wall_parent_created" => array("uid","wall","parent","created"),
901 "uid_type_changed" => array("uid","type","changed"),
902 "contactid_verb" => array("contact-id","verb"),
903 "deleted_changed" => array("deleted","changed"),
904 "uid_wall_changed" => array("uid","wall","changed"),
905 "uid_eventid" => array("uid","event-id"),
906 "uid_authorlink" => array("uid","author-link"),
907 "uid_ownerlink" => array("uid","owner-link"),
910 $database["item_id"] = array(
912 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
913 "iid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
914 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
915 "sid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
916 "service" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
919 "PRIMARY" => array("id"),
920 "uid" => array("uid"),
921 "sid" => array("sid"),
922 "service" => array("service"),
923 "iid" => array("iid"),
926 $database["locks"] = array(
928 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
929 "name" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
930 "locked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
931 "created" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
934 "PRIMARY" => array("id"),
937 $database["mail"] = array(
939 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
940 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
941 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
942 "from-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
943 "from-photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
944 "from-url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
945 "contact-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
946 "convid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
947 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
948 "body" => array("type" => "mediumtext"),
949 "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
950 "reply" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
951 "replied" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
952 "unknown" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
953 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
954 "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
955 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
958 "PRIMARY" => array("id"),
959 "uid" => array("uid"),
960 "guid" => array("guid"),
961 "convid" => array("convid"),
962 "reply" => array("reply"),
963 "uri" => array("uri"),
964 "parent-uri" => array("parent-uri"),
967 $database["mailacct"] = array(
969 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
970 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
971 "server" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
972 "port" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
973 "ssltype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
974 "mailbox" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
975 "user" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
976 "pass" => array("type" => "text"),
977 "reply_to" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
978 "action" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
979 "movetofolder" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
980 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
981 "last_check" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
984 "PRIMARY" => array("id"),
987 $database["manage"] = array(
989 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
990 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
991 "mid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
994 "PRIMARY" => array("id"),
995 "uid_mid" => array("uid","mid"),
998 $database["notify"] = array(
1000 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1001 "hash" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1002 "type" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1003 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1004 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1005 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1006 "date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1007 "msg" => array("type" => "mediumtext"),
1008 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1009 "link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1010 "iid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1011 "parent" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1012 "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1013 "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1014 "otype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1017 "PRIMARY" => array("id"),
1018 "uid" => array("uid"),
1021 $database["notify-threads"] = array(
1023 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1024 "notify-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1025 "master-parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1026 "parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1027 "receiver-uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1030 "PRIMARY" => array("id"),
1031 "master-parent-item" => array("master-parent-item"),
1032 "receiver-uid" => array("receiver-uid"),
1035 $database["oembed"] = array(
1037 "url" => array("type" => "varchar(255)", "not null" => "1", "primary" => "1"),
1038 "content" => array("type" => "text"),
1039 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1042 "PRIMARY" => array("url".db_index_suffix($charset)),
1043 "created" => array("created"),
1046 $database["parsed_url"] = array(
1048 "url" => array("type" => "varchar(255)", "not null" => "1", "primary" => "1"),
1049 "guessing" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
1050 "oembed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
1051 "content" => array("type" => "text"),
1052 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1055 "PRIMARY" => array("url".db_index_suffix($charset), "guessing", "oembed"),
1056 "created" => array("created"),
1059 $database["pconfig"] = array(
1061 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1062 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1063 "cat" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1064 "k" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1065 "v" => array("type" => "mediumtext"),
1068 "PRIMARY" => array("id"),
1069 "uid_cat_k" => array("uid","cat(30)","k(30)"),
1072 $database["photo"] = array(
1074 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1075 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1076 "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1077 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1078 "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1079 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1080 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1081 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1082 "desc" => array("type" => "text"),
1083 "album" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1084 "filename" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1085 "type" => array("type" => "varchar(128)", "not null" => "1", "default" => "image/jpeg"),
1086 "height" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
1087 "width" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
1088 "datasize" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1089 "data" => array("type" => "mediumblob", "not null" => "1"),
1090 "scale" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
1091 "profile" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1092 "allow_cid" => array("type" => "mediumtext"),
1093 "allow_gid" => array("type" => "mediumtext"),
1094 "deny_cid" => array("type" => "mediumtext"),
1095 "deny_gid" => array("type" => "mediumtext"),
1098 "PRIMARY" => array("id"),
1099 "uid" => array("uid"),
1100 "resource-id" => array("resource-id"),
1101 "guid" => array("guid"),
1104 $database["poll"] = array(
1106 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1107 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1108 "q0" => array("type" => "mediumtext"),
1109 "q1" => array("type" => "mediumtext"),
1110 "q2" => array("type" => "mediumtext"),
1111 "q3" => array("type" => "mediumtext"),
1112 "q4" => array("type" => "mediumtext"),
1113 "q5" => array("type" => "mediumtext"),
1114 "q6" => array("type" => "mediumtext"),
1115 "q7" => array("type" => "mediumtext"),
1116 "q8" => array("type" => "mediumtext"),
1117 "q9" => array("type" => "mediumtext"),
1120 "PRIMARY" => array("id"),
1121 "uid" => array("uid"),
1124 $database["poll_result"] = array(
1126 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1127 "poll_id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1128 "choice" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1131 "PRIMARY" => array("id"),
1132 "poll_id" => array("poll_id"),
1133 "choice" => array("choice"),
1136 $database["process"] = array(
1138 "pid" => array("type" => "int(10) unsigned", "not null" => "1", "primary" => "1"),
1139 "command" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1140 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1143 "PRIMARY" => array("pid"),
1144 "command" => array("command"),
1147 $database["profile"] = array(
1149 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1150 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1151 "profile-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1152 "is-default" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1153 "hide-friends" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1154 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1155 "pdesc" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1156 "dob" => array("type" => "varchar(32)", "not null" => "1", "default" => "0000-00-00"),
1157 "address" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1158 "locality" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1159 "region" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1160 "postal-code" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1161 "country-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1162 "hometown" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1163 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1164 "marital" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1165 "with" => array("type" => "text"),
1166 "howlong" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1167 "sexual" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1168 "politic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1169 "religion" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1170 "pub_keywords" => array("type" => "text"),
1171 "prv_keywords" => array("type" => "text"),
1172 "likes" => array("type" => "text"),
1173 "dislikes" => array("type" => "text"),
1174 "about" => array("type" => "text"),
1175 "summary" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1176 "music" => array("type" => "text"),
1177 "book" => array("type" => "text"),
1178 "tv" => array("type" => "text"),
1179 "film" => array("type" => "text"),
1180 "interest" => array("type" => "text"),
1181 "romance" => array("type" => "text"),
1182 "work" => array("type" => "text"),
1183 "education" => array("type" => "text"),
1184 "contact" => array("type" => "text"),
1185 "homepage" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1186 "xmpp" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1187 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1188 "thumb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1189 "publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1190 "net-publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1193 "PRIMARY" => array("id"),
1194 "hometown" => array("hometown"),
1197 $database["profile_check"] = array(
1199 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1200 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1201 "cid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1202 "dfrn_id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1203 "sec" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1204 "expire" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1207 "PRIMARY" => array("id"),
1210 $database["push_subscriber"] = array(
1212 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1213 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1214 "callback_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1215 "topic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1216 "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1217 "push" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1218 "last_update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1219 "secret" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1222 "PRIMARY" => array("id"),
1225 $database["queue"] = array(
1227 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1228 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1229 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1230 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1231 "last" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1232 "content" => array("type" => "mediumtext"),
1233 "batch" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1236 "PRIMARY" => array("id"),
1237 "cid" => array("cid"),
1238 "created" => array("created"),
1239 "last" => array("last"),
1240 "network" => array("network"),
1241 "batch" => array("batch"),
1244 $database["register"] = array(
1246 "id" => array("type" => "int(11) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1247 "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1248 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1249 "uid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1250 "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1251 "language" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1254 "PRIMARY" => array("id"),
1257 $database["search"] = array(
1259 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1260 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1261 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1264 "PRIMARY" => array("id"),
1265 "uid" => array("uid"),
1266 "term" => array("term"),
1269 $database["session"] = array(
1271 "id" => array("type" => "bigint(20) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1272 "sid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1273 "data" => array("type" => "text"),
1274 "expire" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1277 "PRIMARY" => array("id"),
1278 "sid" => array("sid"),
1279 "expire" => array("expire"),
1282 $database["sign"] = array(
1284 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1285 "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1286 "signed_text" => array("type" => "mediumtext"),
1287 "signature" => array("type" => "text"),
1288 "signer" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1291 "PRIMARY" => array("id"),
1292 "iid" => array("iid"),
1295 $database["spam"] = array(
1297 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1298 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1299 "spam" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1300 "ham" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1301 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1302 "date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1305 "PRIMARY" => array("id"),
1306 "uid" => array("uid"),
1307 "spam" => array("spam"),
1308 "ham" => array("ham"),
1309 "term" => array("term"),
1312 $database["term"] = array(
1314 "tid" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1315 "oid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1316 "otype" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1317 "type" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1318 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1319 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1320 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1321 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1322 "received" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1323 "global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1324 "aid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1325 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1328 "PRIMARY" => array("tid"),
1329 "oid_otype_type_term" => array("oid","otype","type","term"),
1330 "uid_term_tid" => array("uid","term","tid"),
1331 "type_term" => array("type","term"),
1332 "uid_otype_type_term_global_created" => array("uid","otype","type","term","global","created"),
1333 "otype_type_term_tid" => array("otype","type","term","tid"),
1334 "guid" => array("guid"),
1337 $database["thread"] = array(
1339 "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "primary" => "1"),
1340 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1341 "contact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1342 "gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1343 "owner-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1344 "author-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1345 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1346 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1347 "commented" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1348 "received" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1349 "changed" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1350 "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1351 "private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1352 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1353 "moderated" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1354 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1355 "spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1356 "starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1357 "ignored" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1358 "bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1359 "unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
1360 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1361 "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1362 "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1363 "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1364 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1367 "PRIMARY" => array("iid"),
1368 "created" => array("created"),
1369 "commented" => array("commented"),
1370 "uid_network_commented" => array("uid","network","commented"),
1371 "uid_network_created" => array("uid","network","created"),
1372 "uid_contactid_commented" => array("uid","contact-id","commented"),
1373 "uid_contactid_created" => array("uid","contact-id","created"),
1374 "uid_gcontactid_commented" => array("uid","gcontact-id","commented"),
1375 "uid_gcontactid_created" => array("uid","gcontact-id","created"),
1376 "wall_private_received" => array("wall","private","received"),
1377 "uid_created" => array("uid","created"),
1378 "uid_commented" => array("uid","commented"),
1381 $database["tokens"] = array(
1383 "id" => array("type" => "varchar(40)", "not null" => "1", "primary" => "1"),
1384 "secret" => array("type" => "text"),
1385 "client_id" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
1386 "expires" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1387 "scope" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
1388 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1391 "PRIMARY" => array("id"),
1394 $database["user"] = array(
1396 "uid" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1397 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1398 "username" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1399 "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1400 "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1401 "email" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1402 "openid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1403 "timezone" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
1404 "language" => array("type" => "varchar(32)", "not null" => "1", "default" => "en"),
1405 "register_date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1406 "login_date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1407 "default-location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1408 "allow_location" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1409 "theme" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1410 "pubkey" => array("type" => "text"),
1411 "prvkey" => array("type" => "text"),
1412 "spubkey" => array("type" => "text"),
1413 "sprvkey" => array("type" => "text"),
1414 "verified" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1415 "blocked" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1416 "blockwall" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1417 "hidewall" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1418 "blocktags" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1419 "unkmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1420 "cntunkmail" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
1421 "notify-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "65535"),
1422 "page-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1423 "account-type" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1424 "prvnets" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1425 "pwdreset" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1426 "maxreq" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
1427 "expire" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1428 "account_removed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1429 "account_expired" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1430 "account_expires_on" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1431 "expire_notification_sent" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1432 "service_class" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1433 "def_gid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1434 "allow_cid" => array("type" => "mediumtext"),
1435 "allow_gid" => array("type" => "mediumtext"),
1436 "deny_cid" => array("type" => "mediumtext"),
1437 "deny_gid" => array("type" => "mediumtext"),
1438 "openidserver" => array("type" => "text"),
1441 "PRIMARY" => array("uid"),
1442 "nickname" => array("nickname"),
1445 $database["userd"] = array(
1447 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1448 "username" => array("type" => "varchar(255)", "not null" => "1"),
1451 "PRIMARY" => array("id"),
1452 "username" => array("username"),
1455 $database["workerqueue"] = array(
1457 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1458 "parameter" => array("type" => "text"),
1459 "priority" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1460 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1461 "pid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1462 "executed" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1465 "PRIMARY" => array("id"),
1466 "created" => array("created"),
1475 * run from command line
1477 function dbstructure_run(&$argv, &$argc) {
1485 @include(".htconfig.php");
1486 require_once("include/dba.php");
1487 $db = new dba($db_host, $db_user, $db_pass, $db_data);
1488 unset($db_host, $db_user, $db_pass, $db_data);
1494 update_structure(true, true);
1495 set_config('system','build',DB_UPDATE_VERSION);
1498 // For the dump that is used to create the database.sql we always assume utfmb4
1499 $charset = "utf8mb4";
1500 print_structure(db_definition($charset), $charset);
1507 echo $argv[0]." <command>\n";
1510 echo "update update database schema\n";
1511 echo "dumpsql dump database schema\n";
1519 if (array_search(__file__,get_included_files())===0){
1520 dbstructure_run($_SERVER["argv"],$_SERVER["argc"]);