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 "contact-type" => array("type" => "tinyint(1)", "not null" => "1", "default" => "-1"),
690 "hide" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
691 "nsfw" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
692 "network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
693 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
694 "notify" => array("type" => "text"),
695 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
696 "generation" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
697 "server_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
700 "PRIMARY" => array("id"),
701 "nurl" => array("nurl"),
702 "name" => array("name"),
703 "nick" => array("nick"),
704 "addr" => array("addr"),
705 "updated" => array("updated"),
708 $database["glink"] = array(
710 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
711 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
712 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
713 "gcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
714 "zcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
715 "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
718 "PRIMARY" => array("id"),
719 "cid_uid_gcid_zcid" => array("cid","uid","gcid","zcid"),
720 "gcid" => array("gcid"),
721 "zcid" => array("zcid"),
724 $database["group"] = array(
726 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
727 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
728 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
729 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
730 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
733 "PRIMARY" => array("id"),
734 "uid" => array("uid"),
737 $database["group_member"] = array(
739 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
740 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
741 "gid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
742 "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
745 "PRIMARY" => array("id"),
746 "uid_gid_contactid" => array("uid","gid","contact-id"),
749 $database["gserver"] = array(
751 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
752 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
753 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
754 "version" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
755 "site_name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
756 "info" => array("type" => "text"),
757 "register_policy" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
758 "poco" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
759 "noscrape" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
760 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
761 "platform" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
762 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
763 "last_poco_query" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
764 "last_contact" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
765 "last_failure" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
768 "PRIMARY" => array("id"),
769 "nurl" => array("nurl"),
772 $database["hook"] = array(
774 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
775 "hook" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
776 "file" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
777 "function" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
778 "priority" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
781 "PRIMARY" => array("id"),
782 "hook_file_function" => array("hook(30)","file(60)","function(30)"),
785 $database["intro"] = array(
787 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
788 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
789 "fid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
790 "contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
791 "knowyou" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
792 "duplex" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
793 "note" => array("type" => "text"),
794 "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
795 "datetime" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
796 "blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
797 "ignore" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
800 "PRIMARY" => array("id"),
803 $database["item"] = array(
805 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
806 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
807 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
808 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
809 "contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
810 "gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
811 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
812 "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
813 "gravity" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
814 "parent" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
815 "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
816 "extid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
817 "thr-parent" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
818 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
819 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
820 "commented" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
821 "received" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
822 "changed" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
823 "owner-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
824 "owner-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
825 "owner-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
826 "owner-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
827 "author-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
828 "author-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
829 "author-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
830 "author-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
831 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
832 "body" => array("type" => "mediumtext"),
833 "app" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
834 "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
835 "object-type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
836 "object" => array("type" => "text"),
837 "target-type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
838 "target" => array("type" => "text"),
839 "postopts" => array("type" => "text"),
840 "plink" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
841 "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
842 "event-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
843 "tag" => array("type" => "mediumtext"),
844 "attach" => array("type" => "mediumtext"),
845 "inform" => array("type" => "mediumtext"),
846 "file" => array("type" => "mediumtext"),
847 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
848 "coord" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
849 "allow_cid" => array("type" => "mediumtext"),
850 "allow_gid" => array("type" => "mediumtext"),
851 "deny_cid" => array("type" => "mediumtext"),
852 "deny_gid" => array("type" => "mediumtext"),
853 "private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
854 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
855 "moderated" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
856 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
857 "spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
858 "starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
859 "bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
860 "unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
861 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
862 "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
863 "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
864 "last-child" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "1"),
865 "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
866 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
867 "rendered-hash" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
868 "rendered-html" => array("type" => "mediumtext"),
869 "global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
872 "PRIMARY" => array("id"),
873 "guid" => array("guid"),
874 "uri" => array("uri"),
875 "parent" => array("parent"),
876 "parent-uri" => array("parent-uri"),
877 "extid" => array("extid"),
878 "uid_id" => array("uid","id"),
879 "uid_created" => array("uid","created"),
880 "uid_unseen_contactid" => array("uid","unseen","contact-id"),
881 "uid_network_received" => array("uid","network","received"),
882 "uid_received" => array("uid","received"),
883 "uid_network_commented" => array("uid","network","commented"),
884 "uid_commented" => array("uid","commented"),
885 "uid_title" => array("uid","title"),
886 "uid_thrparent" => array("uid","thr-parent"),
887 "uid_parenturi" => array("uid","parent-uri"),
888 "uid_contactid_id" => array("uid","contact-id","id"),
889 "uid_contactid_created" => array("uid","contact-id","created"),
890 "gcontactid_uid_created" => array("gcontact-id","uid","created"),
891 "authorid_created" => array("author-id","created"),
892 "ownerid_created" => array("owner-id","created"),
893 "wall_body" => array("wall","body(6)"),
894 "uid_visible_moderated_created" => array("uid","visible","moderated","created"),
895 "uid_uri" => array("uid","uri"),
896 "uid_wall_created" => array("uid","wall","created"),
897 "resource-id" => array("resource-id"),
898 "uid_type" => array("uid","type"),
899 "uid_starred_id" => array("uid","starred", "id"),
900 "contactid_allowcid_allowpid_denycid_denygid" => array("contact-id","allow_cid(10)","allow_gid(10)","deny_cid(10)","deny_gid(10)"),
901 "uid_wall_parent_created" => array("uid","wall","parent","created"),
902 "uid_type_changed" => array("uid","type","changed"),
903 "contactid_verb" => array("contact-id","verb"),
904 "deleted_changed" => array("deleted","changed"),
905 "uid_wall_changed" => array("uid","wall","changed"),
906 "uid_eventid" => array("uid","event-id"),
907 "uid_authorlink" => array("uid","author-link"),
908 "uid_ownerlink" => array("uid","owner-link"),
911 $database["item_id"] = array(
913 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
914 "iid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
915 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
916 "sid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
917 "service" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
920 "PRIMARY" => array("id"),
921 "uid" => array("uid"),
922 "sid" => array("sid"),
923 "service" => array("service"),
924 "iid" => array("iid"),
927 $database["locks"] = array(
929 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
930 "name" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
931 "locked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
932 "created" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
935 "PRIMARY" => array("id"),
938 $database["mail"] = array(
940 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
941 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
942 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
943 "from-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
944 "from-photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
945 "from-url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
946 "contact-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
947 "convid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
948 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
949 "body" => array("type" => "mediumtext"),
950 "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
951 "reply" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
952 "replied" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
953 "unknown" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
954 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
955 "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
956 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
959 "PRIMARY" => array("id"),
960 "uid" => array("uid"),
961 "guid" => array("guid"),
962 "convid" => array("convid"),
963 "reply" => array("reply"),
964 "uri" => array("uri"),
965 "parent-uri" => array("parent-uri"),
968 $database["mailacct"] = array(
970 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
971 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
972 "server" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
973 "port" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
974 "ssltype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
975 "mailbox" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
976 "user" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
977 "pass" => array("type" => "text"),
978 "reply_to" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
979 "action" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
980 "movetofolder" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
981 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
982 "last_check" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
985 "PRIMARY" => array("id"),
988 $database["manage"] = array(
990 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
991 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
992 "mid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
995 "PRIMARY" => array("id"),
996 "uid_mid" => array("uid","mid"),
999 $database["notify"] = array(
1001 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1002 "hash" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1003 "type" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1004 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1005 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1006 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1007 "date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1008 "msg" => array("type" => "mediumtext"),
1009 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1010 "link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1011 "iid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1012 "parent" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1013 "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1014 "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1015 "otype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1018 "PRIMARY" => array("id"),
1019 "uid" => array("uid"),
1022 $database["notify-threads"] = array(
1024 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1025 "notify-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1026 "master-parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1027 "parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1028 "receiver-uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1031 "PRIMARY" => array("id"),
1032 "master-parent-item" => array("master-parent-item"),
1033 "receiver-uid" => array("receiver-uid"),
1036 $database["oembed"] = array(
1038 "url" => array("type" => "varchar(255)", "not null" => "1", "primary" => "1"),
1039 "content" => array("type" => "text"),
1040 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1043 "PRIMARY" => array("url".db_index_suffix($charset)),
1044 "created" => array("created"),
1047 $database["parsed_url"] = array(
1049 "url" => array("type" => "varchar(255)", "not null" => "1", "primary" => "1"),
1050 "guessing" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
1051 "oembed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
1052 "content" => array("type" => "text"),
1053 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1056 "PRIMARY" => array("url".db_index_suffix($charset), "guessing", "oembed"),
1057 "created" => array("created"),
1060 $database["pconfig"] = array(
1062 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1063 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1064 "cat" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1065 "k" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1066 "v" => array("type" => "mediumtext"),
1069 "PRIMARY" => array("id"),
1070 "uid_cat_k" => array("uid","cat(30)","k(30)"),
1073 $database["photo"] = array(
1075 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1076 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1077 "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1078 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1079 "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1080 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1081 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1082 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1083 "desc" => array("type" => "text"),
1084 "album" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1085 "filename" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1086 "type" => array("type" => "varchar(128)", "not null" => "1", "default" => "image/jpeg"),
1087 "height" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
1088 "width" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
1089 "datasize" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1090 "data" => array("type" => "mediumblob", "not null" => "1"),
1091 "scale" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
1092 "profile" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1093 "allow_cid" => array("type" => "mediumtext"),
1094 "allow_gid" => array("type" => "mediumtext"),
1095 "deny_cid" => array("type" => "mediumtext"),
1096 "deny_gid" => array("type" => "mediumtext"),
1099 "PRIMARY" => array("id"),
1100 "uid" => array("uid"),
1101 "resource-id" => array("resource-id"),
1102 "guid" => array("guid"),
1105 $database["poll"] = array(
1107 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1108 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1109 "q0" => array("type" => "mediumtext"),
1110 "q1" => array("type" => "mediumtext"),
1111 "q2" => array("type" => "mediumtext"),
1112 "q3" => array("type" => "mediumtext"),
1113 "q4" => array("type" => "mediumtext"),
1114 "q5" => array("type" => "mediumtext"),
1115 "q6" => array("type" => "mediumtext"),
1116 "q7" => array("type" => "mediumtext"),
1117 "q8" => array("type" => "mediumtext"),
1118 "q9" => array("type" => "mediumtext"),
1121 "PRIMARY" => array("id"),
1122 "uid" => array("uid"),
1125 $database["poll_result"] = array(
1127 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1128 "poll_id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1129 "choice" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1132 "PRIMARY" => array("id"),
1133 "poll_id" => array("poll_id"),
1134 "choice" => array("choice"),
1137 $database["process"] = array(
1139 "pid" => array("type" => "int(10) unsigned", "not null" => "1", "primary" => "1"),
1140 "command" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1141 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1144 "PRIMARY" => array("pid"),
1145 "command" => array("command"),
1148 $database["profile"] = array(
1150 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1151 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1152 "profile-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1153 "is-default" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1154 "hide-friends" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1155 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1156 "pdesc" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1157 "dob" => array("type" => "varchar(32)", "not null" => "1", "default" => "0000-00-00"),
1158 "address" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1159 "locality" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1160 "region" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1161 "postal-code" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1162 "country-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1163 "hometown" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1164 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1165 "marital" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1166 "with" => array("type" => "text"),
1167 "howlong" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1168 "sexual" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1169 "politic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1170 "religion" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1171 "pub_keywords" => array("type" => "text"),
1172 "prv_keywords" => array("type" => "text"),
1173 "likes" => array("type" => "text"),
1174 "dislikes" => array("type" => "text"),
1175 "about" => array("type" => "text"),
1176 "summary" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1177 "music" => array("type" => "text"),
1178 "book" => array("type" => "text"),
1179 "tv" => array("type" => "text"),
1180 "film" => array("type" => "text"),
1181 "interest" => array("type" => "text"),
1182 "romance" => array("type" => "text"),
1183 "work" => array("type" => "text"),
1184 "education" => array("type" => "text"),
1185 "contact" => array("type" => "text"),
1186 "homepage" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1187 "xmpp" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1188 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1189 "thumb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1190 "publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1191 "net-publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1194 "PRIMARY" => array("id"),
1195 "hometown" => array("hometown"),
1198 $database["profile_check"] = array(
1200 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1201 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1202 "cid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1203 "dfrn_id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1204 "sec" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1205 "expire" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1208 "PRIMARY" => array("id"),
1211 $database["push_subscriber"] = array(
1213 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1214 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1215 "callback_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1216 "topic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1217 "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1218 "push" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1219 "last_update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1220 "secret" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1223 "PRIMARY" => array("id"),
1226 $database["queue"] = array(
1228 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1229 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1230 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1231 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1232 "last" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1233 "content" => array("type" => "mediumtext"),
1234 "batch" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1237 "PRIMARY" => array("id"),
1238 "cid" => array("cid"),
1239 "created" => array("created"),
1240 "last" => array("last"),
1241 "network" => array("network"),
1242 "batch" => array("batch"),
1245 $database["register"] = array(
1247 "id" => array("type" => "int(11) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1248 "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1249 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1250 "uid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1251 "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1252 "language" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1255 "PRIMARY" => array("id"),
1258 $database["search"] = array(
1260 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1261 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1262 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1265 "PRIMARY" => array("id"),
1266 "uid" => array("uid"),
1267 "term" => array("term"),
1270 $database["session"] = array(
1272 "id" => array("type" => "bigint(20) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1273 "sid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1274 "data" => array("type" => "text"),
1275 "expire" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1278 "PRIMARY" => array("id"),
1279 "sid" => array("sid"),
1280 "expire" => array("expire"),
1283 $database["sign"] = array(
1285 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1286 "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1287 "signed_text" => array("type" => "mediumtext"),
1288 "signature" => array("type" => "text"),
1289 "signer" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1292 "PRIMARY" => array("id"),
1293 "iid" => array("iid"),
1296 $database["spam"] = array(
1298 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1299 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1300 "spam" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1301 "ham" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1302 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1303 "date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1306 "PRIMARY" => array("id"),
1307 "uid" => array("uid"),
1308 "spam" => array("spam"),
1309 "ham" => array("ham"),
1310 "term" => array("term"),
1313 $database["term"] = array(
1315 "tid" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1316 "oid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1317 "otype" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1318 "type" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1319 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1320 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1321 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1322 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1323 "received" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1324 "global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1325 "aid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1326 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1329 "PRIMARY" => array("tid"),
1330 "oid_otype_type_term" => array("oid","otype","type","term"),
1331 "uid_term_tid" => array("uid","term","tid"),
1332 "type_term" => array("type","term"),
1333 "uid_otype_type_term_global_created" => array("uid","otype","type","term","global","created"),
1334 "otype_type_term_tid" => array("otype","type","term","tid"),
1335 "guid" => array("guid"),
1338 $database["thread"] = array(
1340 "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "primary" => "1"),
1341 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1342 "contact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1343 "gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1344 "owner-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1345 "author-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1346 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1347 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1348 "commented" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1349 "received" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1350 "changed" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1351 "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1352 "private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1353 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1354 "moderated" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1355 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1356 "spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1357 "starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1358 "ignored" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1359 "bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1360 "unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
1361 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1362 "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1363 "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1364 "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1365 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1368 "PRIMARY" => array("iid"),
1369 "created" => array("created"),
1370 "commented" => array("commented"),
1371 "uid_network_commented" => array("uid","network","commented"),
1372 "uid_network_created" => array("uid","network","created"),
1373 "uid_contactid_commented" => array("uid","contact-id","commented"),
1374 "uid_contactid_created" => array("uid","contact-id","created"),
1375 "uid_gcontactid_commented" => array("uid","gcontact-id","commented"),
1376 "uid_gcontactid_created" => array("uid","gcontact-id","created"),
1377 "wall_private_received" => array("wall","private","received"),
1378 "uid_created" => array("uid","created"),
1379 "uid_commented" => array("uid","commented"),
1382 $database["tokens"] = array(
1384 "id" => array("type" => "varchar(40)", "not null" => "1", "primary" => "1"),
1385 "secret" => array("type" => "text"),
1386 "client_id" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
1387 "expires" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1388 "scope" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
1389 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1392 "PRIMARY" => array("id"),
1395 $database["user"] = array(
1397 "uid" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1398 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1399 "username" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1400 "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1401 "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1402 "email" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1403 "openid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1404 "timezone" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
1405 "language" => array("type" => "varchar(32)", "not null" => "1", "default" => "en"),
1406 "register_date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1407 "login_date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1408 "default-location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1409 "allow_location" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1410 "theme" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1411 "pubkey" => array("type" => "text"),
1412 "prvkey" => array("type" => "text"),
1413 "spubkey" => array("type" => "text"),
1414 "sprvkey" => array("type" => "text"),
1415 "verified" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1416 "blocked" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1417 "blockwall" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1418 "hidewall" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1419 "blocktags" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1420 "unkmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1421 "cntunkmail" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
1422 "notify-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "65535"),
1423 "page-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1424 "account-type" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1425 "prvnets" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1426 "pwdreset" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1427 "maxreq" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
1428 "expire" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1429 "account_removed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1430 "account_expired" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1431 "account_expires_on" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1432 "expire_notification_sent" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1433 "service_class" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1434 "def_gid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1435 "allow_cid" => array("type" => "mediumtext"),
1436 "allow_gid" => array("type" => "mediumtext"),
1437 "deny_cid" => array("type" => "mediumtext"),
1438 "deny_gid" => array("type" => "mediumtext"),
1439 "openidserver" => array("type" => "text"),
1442 "PRIMARY" => array("uid"),
1443 "nickname" => array("nickname"),
1446 $database["userd"] = array(
1448 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1449 "username" => array("type" => "varchar(255)", "not null" => "1"),
1452 "PRIMARY" => array("id"),
1453 "username" => array("username"),
1456 $database["workerqueue"] = array(
1458 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1459 "parameter" => array("type" => "text"),
1460 "priority" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1461 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1462 "pid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1463 "executed" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1466 "PRIMARY" => array("id"),
1467 "created" => array("created"),
1476 * run from command line
1478 function dbstructure_run(&$argv, &$argc) {
1486 @include(".htconfig.php");
1487 require_once("include/dba.php");
1488 $db = new dba($db_host, $db_user, $db_pass, $db_data);
1489 unset($db_host, $db_user, $db_pass, $db_data);
1495 update_structure(true, true);
1497 $build = get_config('system','build');
1499 set_config('system','build',DB_UPDATE_VERSION);
1500 $build = DB_UPDATE_VERSION;
1503 $stored = intval($build);
1504 $current = intval(DB_UPDATE_VERSION);
1506 // run any left update_nnnn functions in update.php
1507 for($x = $stored; $x < $current; $x ++) {
1508 $r = run_update_function($x);
1512 set_config('system','build',DB_UPDATE_VERSION);
1515 // For the dump that is used to create the database.sql we always assume utfmb4
1516 $charset = "utf8mb4";
1517 print_structure(db_definition($charset), $charset);
1524 echo $argv[0]." <command>\n";
1527 echo "update update database schema\n";
1528 echo "dumpsql dump database schema\n";
1536 if (array_search(__file__,get_included_files())===0){
1537 dbstructure_run($_SERVER["argv"],$_SERVER["argc"]);