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) {
129 if (isset($a->config["system"]["db_charset"]))
130 $charset = $a->config["system"]["db_charset"];
136 logger('updating structure', LOGGER_DEBUG);
138 // Get the current structure
141 if (is_null($tables))
142 $tables = q("show tables");
144 foreach ($tables AS $table) {
145 $table = current($table);
147 $database[$table] = table_structure($table);
150 // Get the definition
151 if (is_null($definition))
152 $definition = db_definition($charset);
156 foreach ($definition AS $name => $structure) {
157 $is_new_table = False;
159 if (!isset($database[$name])) {
160 $r = db_create_table($name, $structure["fields"], $charset, $verbose, $action, $structure['indexes']);
162 $errors .= t('Errors encountered creating database tables.').$name.EOL;
164 $is_new_table = True;
166 // Drop the index if it isn't present in the definition
167 // or the definition differ from current status
168 // and index name doesn't start with "local_"
169 foreach ($database[$name]["indexes"] AS $indexname => $fieldnames) {
170 $current_index_definition = implode(",",$fieldnames);
171 if (isset($structure["indexes"][$indexname])) {
172 $new_index_definition = implode(",",$structure["indexes"][$indexname]);
174 $new_index_definition = "__NOT_SET__";
176 if ($current_index_definition != $new_index_definition && substr($indexname, 0, 6) != 'local_') {
177 $sql2=db_drop_index($indexname);
179 $sql3 = "ALTER TABLE `".$name."` ".$sql2;
184 // Compare the field structure field by field
185 foreach ($structure["fields"] AS $fieldname => $parameters) {
186 if (!isset($database[$name]["fields"][$fieldname])) {
187 $sql2=db_add_table_field($fieldname, $parameters);
189 $sql3 = "ALTER TABLE `".$name."` ".$sql2;
193 // Compare the field definition
194 $current_field_definition = implode(",",$database[$name]["fields"][$fieldname]);
195 $new_field_definition = implode(",",$parameters);
196 if ($current_field_definition != $new_field_definition) {
197 $sql2=db_modify_table_field($fieldname, $parameters);
199 $sql3 = "ALTER TABLE `".$name."` ".$sql2;
208 // Create the index if the index don't exists in database
209 // or the definition differ from the current status.
210 // Don't create keys if table is new
211 if (!$is_new_table) {
212 foreach ($structure["indexes"] AS $indexname => $fieldnames) {
213 if (isset($database[$name]["indexes"][$indexname])) {
214 $current_index_definition = implode(",",$database[$name]["indexes"][$indexname]);
216 $current_index_definition = "__NOT_SET__";
218 $new_index_definition = implode(",",$fieldnames);
219 if ($current_index_definition != $new_index_definition) {
220 $sql2=db_create_index($indexname, $fieldnames);
223 $sql3 = "ALTER TABLE `".$name."` ".$sql2;
239 $errors .= t('Errors encountered performing database changes.').$sql3.EOL;
247 function db_field_command($parameters, $create = true) {
248 $fieldstruct = $parameters["type"];
250 if ($parameters["not null"])
251 $fieldstruct .= " NOT NULL";
253 if (isset($parameters["default"])){
254 if (strpos(strtolower($parameters["type"]),"int")!==false) {
255 $fieldstruct .= " DEFAULT ".$parameters["default"];
257 $fieldstruct .= " DEFAULT '".$parameters["default"]."'";
260 if ($parameters["extra"] != "")
261 $fieldstruct .= " ".$parameters["extra"];
263 /*if (($parameters["primary"] != "") AND $create)
264 $fieldstruct .= " PRIMARY KEY";*/
266 return($fieldstruct);
269 function db_create_table($name, $fields, $charset, $verbose, $action, $indexes=null) {
277 $primary_keys = array();
278 foreach($fields AS $fieldname => $field) {
279 $sql_rows[] = "`".dbesc($fieldname)."` ".db_field_command($field);
280 if (x($field,'primary') and $field['primary']!=''){
281 $primary_keys[] = $fieldname;
285 if (!is_null($indexes)) {
286 foreach ($indexes AS $indexname => $fieldnames) {
287 $sql_index = db_create_index($indexname, $fieldnames, "");
288 if (!is_null($sql_index)) $sql_rows[] = $sql_index;
292 $sql = implode(",\n\t", $sql_rows);
294 $sql = sprintf("CREATE TABLE IF NOT EXISTS `%s` (\n\t", dbesc($name)).$sql."\n) DEFAULT CHARSET=".$charset;
304 function db_add_table_field($fieldname, $parameters) {
305 $sql = sprintf("ADD `%s` %s", dbesc($fieldname), db_field_command($parameters));
309 function db_modify_table_field($fieldname, $parameters) {
310 $sql = sprintf("MODIFY `%s` %s", dbesc($fieldname), db_field_command($parameters, false));
314 function db_drop_index($indexname) {
315 $sql = sprintf("DROP INDEX `%s`", dbesc($indexname));
319 function db_create_index($indexname, $fieldnames, $method="ADD") {
321 $method = strtoupper(trim($method));
322 if ($method!="" && $method!="ADD") {
323 throw new Exception("Invalid parameter 'method' in db_create_index(): '$method'");
328 foreach ($fieldnames AS $fieldname) {
332 if (preg_match('|(.+)\((\d+)\)|', $fieldname, $matches))
333 $names .= "`".dbesc($matches[1])."`(".intval($matches[2]).")";
335 $names .= "`".dbesc($fieldname)."`";
338 if ($indexname == "PRIMARY") {
339 //return sprintf("%s PRIMARY KEY(`%s`)", $method, implode("`,`", $fieldnames));
340 return sprintf("%s PRIMARY KEY(%s)", $method, $names);
344 $sql = sprintf("%s INDEX `%s` (%s)", $method, dbesc($indexname), $names);
348 function db_index_suffix($charset, $reduce = 0) {
349 if ($charset != "utf8mb4")
352 // On utf8mb4 indexes can only have a length of 191
353 $indexlength = 191 - $reduce;
355 return "(".$indexlength.")";
358 function db_definition($charset) {
362 $database["addon"] = array(
364 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
365 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
366 "version" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
367 "installed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
368 "hidden" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
369 "timestamp" => array("type" => "bigint(20)", "not null" => "1", "default" => "0"),
370 "plugin_admin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
373 "PRIMARY" => array("id"),
376 $database["attach"] = array(
378 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
379 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
380 "hash" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
381 "filename" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
382 "filetype" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
383 "filesize" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
384 "data" => array("type" => "longblob", "not null" => "1"),
385 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
386 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
387 "allow_cid" => array("type" => "mediumtext"),
388 "allow_gid" => array("type" => "mediumtext"),
389 "deny_cid" => array("type" => "mediumtext"),
390 "deny_gid" => array("type" => "mediumtext"),
393 "PRIMARY" => array("id"),
396 $database["auth_codes"] = array(
398 "id" => array("type" => "varchar(40)", "not null" => "1", "primary" => "1"),
399 "client_id" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
400 "redirect_uri" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
401 "expires" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
402 "scope" => array("type" => "varchar(250)", "not null" => "1", "default" => ""),
405 "PRIMARY" => array("id"),
408 $database["cache"] = array(
410 "k" => array("type" => "varchar(255)", "not null" => "1", "primary" => "1"),
411 "v" => array("type" => "text"),
412 "expire_mode" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
413 "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
416 "PRIMARY" => array("k".db_index_suffix($charset)),
417 "updated" => array("updated"),
420 $database["challenge"] = array(
422 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
423 "challenge" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
424 "dfrn-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
425 "expire" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
426 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
427 "last_update" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
430 "PRIMARY" => array("id"),
433 $database["clients"] = array(
435 "client_id" => array("type" => "varchar(20)", "not null" => "1", "primary" => "1"),
436 "pw" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
437 "redirect_uri" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
438 "name" => array("type" => "text"),
439 "icon" => array("type" => "text"),
440 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
443 "PRIMARY" => array("client_id"),
446 $database["config"] = array(
448 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
449 "cat" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
450 "k" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
451 "v" => array("type" => "text"),
454 "PRIMARY" => array("id"),
455 "cat_k" => array("cat(30)","k(30)"),
458 $database["contact"] = array(
460 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
461 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
462 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
463 "self" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
464 "remote_self" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
465 "rel" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
466 "duplex" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
467 "network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
468 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
469 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
470 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
471 "about" => array("type" => "text"),
472 "keywords" => array("type" => "text"),
473 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
474 "xmpp" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
475 "attag" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
476 "avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
477 "photo" => array("type" => "text"),
478 "thumb" => array("type" => "text"),
479 "micro" => array("type" => "text"),
480 "site-pubkey" => array("type" => "text"),
481 "issued-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
482 "dfrn-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
483 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
484 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
485 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
486 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
487 "pubkey" => array("type" => "text"),
488 "prvkey" => array("type" => "text"),
489 "batch" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
490 "request" => array("type" => "text"),
491 "notify" => array("type" => "text"),
492 "poll" => array("type" => "text"),
493 "confirm" => array("type" => "text"),
494 "poco" => array("type" => "text"),
495 "aes_allow" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
496 "ret-aes" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
497 "usehub" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
498 "subhub" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
499 "hub-verify" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
500 "last-update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
501 "success_update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
502 "failure_update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
503 "name-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
504 "uri-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
505 "avatar-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
506 "term-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
507 "last-item" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
508 "priority" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
509 "blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
510 "readonly" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
511 "writable" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
512 "forum" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
513 "prv" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
514 "contact-type" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
515 "hidden" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
516 "archive" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
517 "pending" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
518 "rating" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
519 "reason" => array("type" => "text"),
520 "closeness" => array("type" => "tinyint(2)", "not null" => "1", "default" => "99"),
521 "info" => array("type" => "mediumtext"),
522 "profile-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
523 "bdyear" => array("type" => "varchar(4)", "not null" => "1", "default" => ""),
524 "bd" => array("type" => "date", "not null" => "1", "default" => "0000-00-00"),
525 "notify_new_posts" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
526 "fetch_further_information" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
527 "ffi_keyword_blacklist" => array("type" => "mediumtext"),
530 "PRIMARY" => array("id"),
531 "uid" => array("uid"),
532 "nurl" => array("nurl"),
535 $database["conv"] = array(
537 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
538 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
539 "recips" => array("type" => "mediumtext"),
540 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
541 "creator" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
542 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
543 "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
544 "subject" => array("type" => "mediumtext"),
547 "PRIMARY" => array("id"),
548 "uid" => array("uid"),
551 $database["deliverq"] = array(
553 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
554 "cmd" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
555 "item" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
556 "contact" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
559 "PRIMARY" => array("id"),
562 $database["event"] = array(
564 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
565 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
566 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
567 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
568 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
569 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
570 "start" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
571 "finish" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
572 "summary" => array("type" => "text"),
573 "desc" => array("type" => "text"),
574 "location" => array("type" => "text"),
575 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
576 "nofinish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
577 "adjust" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
578 "ignore" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
579 "allow_cid" => array("type" => "mediumtext"),
580 "allow_gid" => array("type" => "mediumtext"),
581 "deny_cid" => array("type" => "mediumtext"),
582 "deny_gid" => array("type" => "mediumtext"),
585 "PRIMARY" => array("id"),
586 "uid" => array("uid"),
589 $database["fcontact"] = array(
591 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
592 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
593 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
594 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
595 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
596 "request" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
597 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
598 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
599 "batch" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
600 "notify" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
601 "poll" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
602 "confirm" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
603 "priority" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
604 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
605 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
606 "pubkey" => array("type" => "text"),
607 "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
610 "PRIMARY" => array("id"),
611 "addr" => array("addr"),
614 $database["ffinder"] = array(
616 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
617 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
618 "cid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
619 "fid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
622 "PRIMARY" => array("id"),
625 $database["fserver"] = array(
627 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
628 "server" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
629 "posturl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
630 "key" => array("type" => "text"),
633 "PRIMARY" => array("id"),
634 "server" => array("server"),
637 $database["fsuggest"] = array(
639 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
640 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
641 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
642 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
643 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
644 "request" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
645 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
646 "note" => array("type" => "text"),
647 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
650 "PRIMARY" => array("id"),
653 $database["gcign"] = array(
655 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
656 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
657 "gcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
660 "PRIMARY" => array("id"),
661 "uid" => array("uid"),
662 "gcid" => array("gcid"),
665 $database["gcontact"] = array(
667 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
668 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
669 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
670 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
671 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
672 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
673 "connect" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
674 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
675 "updated" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
676 "last_contact" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
677 "last_failure" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
678 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
679 "about" => array("type" => "text"),
680 "keywords" => array("type" => "text"),
681 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
682 "birthday" => array("type" => "varchar(32)", "not null" => "1", "default" => "0000-00-00"),
683 "community" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
684 "hide" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
685 "nsfw" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
686 "network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
687 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
688 "notify" => array("type" => "text"),
689 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
690 "generation" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
691 "server_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
694 "PRIMARY" => array("id"),
695 "nurl" => array("nurl"),
696 "name" => array("name"),
697 "nick" => array("nick"),
698 "addr" => array("addr"),
699 "updated" => array("updated"),
702 $database["glink"] = array(
704 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
705 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
706 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
707 "gcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
708 "zcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
709 "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
712 "PRIMARY" => array("id"),
713 "cid_uid_gcid_zcid" => array("cid","uid","gcid","zcid"),
714 "gcid" => array("gcid"),
715 "zcid" => array("zcid"),
718 $database["group"] = array(
720 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
721 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
722 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
723 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
724 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
727 "PRIMARY" => array("id"),
728 "uid" => array("uid"),
731 $database["group_member"] = array(
733 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
734 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
735 "gid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
736 "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
739 "PRIMARY" => array("id"),
740 "uid_gid_contactid" => array("uid","gid","contact-id"),
743 $database["gserver"] = array(
745 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
746 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
747 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
748 "version" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
749 "site_name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
750 "info" => array("type" => "text"),
751 "register_policy" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
752 "poco" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
753 "noscrape" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
754 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
755 "platform" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
756 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
757 "last_poco_query" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
758 "last_contact" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
759 "last_failure" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
762 "PRIMARY" => array("id"),
763 "nurl" => array("nurl"),
766 $database["hook"] = array(
768 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
769 "hook" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
770 "file" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
771 "function" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
772 "priority" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
775 "PRIMARY" => array("id"),
776 "hook_file_function" => array("hook(30)","file(60)","function(30)"),
779 $database["intro"] = array(
781 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
782 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
783 "fid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
784 "contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
785 "knowyou" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
786 "duplex" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
787 "note" => array("type" => "text"),
788 "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
789 "datetime" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
790 "blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
791 "ignore" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
794 "PRIMARY" => array("id"),
797 $database["item"] = array(
799 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
800 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
801 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
802 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
803 "contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
804 "gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
805 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
806 "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
807 "gravity" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
808 "parent" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
809 "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
810 "extid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
811 "thr-parent" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
812 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
813 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
814 "commented" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
815 "received" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
816 "changed" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
817 "owner-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
818 "owner-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
819 "owner-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
820 "owner-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
821 "author-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
822 "author-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
823 "author-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
824 "author-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
825 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
826 "body" => array("type" => "mediumtext"),
827 "app" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
828 "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
829 "object-type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
830 "object" => array("type" => "text"),
831 "target-type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
832 "target" => array("type" => "text"),
833 "postopts" => array("type" => "text"),
834 "plink" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
835 "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
836 "event-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
837 "tag" => array("type" => "mediumtext"),
838 "attach" => array("type" => "mediumtext"),
839 "inform" => array("type" => "mediumtext"),
840 "file" => array("type" => "mediumtext"),
841 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
842 "coord" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
843 "allow_cid" => array("type" => "mediumtext"),
844 "allow_gid" => array("type" => "mediumtext"),
845 "deny_cid" => array("type" => "mediumtext"),
846 "deny_gid" => array("type" => "mediumtext"),
847 "private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
848 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
849 "moderated" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
850 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
851 "spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
852 "starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
853 "bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
854 "unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
855 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
856 "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
857 "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
858 "last-child" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "1"),
859 "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
860 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
861 "rendered-hash" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
862 "rendered-html" => array("type" => "mediumtext"),
863 "global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
866 "PRIMARY" => array("id"),
867 "guid" => array("guid"),
868 "uri" => array("uri"),
869 "parent" => array("parent"),
870 "parent-uri" => array("parent-uri"),
871 "extid" => array("extid"),
872 "uid_id" => array("uid","id"),
873 "uid_created" => array("uid","created"),
874 "uid_unseen_contactid" => array("uid","unseen","contact-id"),
875 "uid_network_received" => array("uid","network","received"),
876 "uid_received" => array("uid","received"),
877 "uid_network_commented" => array("uid","network","commented"),
878 "uid_commented" => array("uid","commented"),
879 "uid_title" => array("uid","title"),
880 "uid_thrparent" => array("uid","thr-parent"),
881 "uid_parenturi" => array("uid","parent-uri"),
882 "uid_contactid_id" => array("uid","contact-id","id"),
883 "uid_contactid_created" => array("uid","contact-id","created"),
884 "gcontactid_uid_created" => array("gcontact-id","uid","created"),
885 "authorid_created" => array("author-id","created"),
886 "ownerid_created" => array("owner-id","created"),
887 "wall_body" => array("wall","body(6)"),
888 "uid_visible_moderated_created" => array("uid","visible","moderated","created"),
889 "uid_uri" => array("uid","uri"),
890 "uid_wall_created" => array("uid","wall","created"),
891 "resource-id" => array("resource-id"),
892 "uid_type" => array("uid","type"),
893 "uid_starred_id" => array("uid","starred", "id"),
894 "contactid_allowcid_allowpid_denycid_denygid" => array("contact-id","allow_cid(10)","allow_gid(10)","deny_cid(10)","deny_gid(10)"),
895 "uid_wall_parent_created" => array("uid","wall","parent","created"),
896 "uid_type_changed" => array("uid","type","changed"),
897 "contactid_verb" => array("contact-id","verb"),
898 "deleted_changed" => array("deleted","changed"),
899 "uid_wall_changed" => array("uid","wall","changed"),
900 "uid_eventid" => array("uid","event-id"),
901 "uid_authorlink" => array("uid","author-link"),
902 "uid_ownerlink" => array("uid","owner-link"),
905 $database["item_id"] = array(
907 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
908 "iid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
909 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
910 "sid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
911 "service" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
914 "PRIMARY" => array("id"),
915 "uid" => array("uid"),
916 "sid" => array("sid"),
917 "service" => array("service"),
918 "iid" => array("iid"),
921 $database["locks"] = array(
923 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
924 "name" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
925 "locked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
926 "created" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
929 "PRIMARY" => array("id"),
932 $database["mail"] = array(
934 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
935 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
936 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
937 "from-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
938 "from-photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
939 "from-url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
940 "contact-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
941 "convid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
942 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
943 "body" => array("type" => "mediumtext"),
944 "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
945 "reply" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
946 "replied" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
947 "unknown" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
948 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
949 "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
950 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
953 "PRIMARY" => array("id"),
954 "uid" => array("uid"),
955 "guid" => array("guid"),
956 "convid" => array("convid"),
957 "reply" => array("reply"),
958 "uri" => array("uri"),
959 "parent-uri" => array("parent-uri"),
962 $database["mailacct"] = array(
964 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
965 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
966 "server" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
967 "port" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
968 "ssltype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
969 "mailbox" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
970 "user" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
971 "pass" => array("type" => "text"),
972 "reply_to" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
973 "action" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
974 "movetofolder" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
975 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
976 "last_check" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
979 "PRIMARY" => array("id"),
982 $database["manage"] = array(
984 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
985 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
986 "mid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
989 "PRIMARY" => array("id"),
990 "uid_mid" => array("uid","mid"),
993 $database["notify"] = array(
995 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
996 "hash" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
997 "type" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
998 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
999 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1000 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1001 "date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1002 "msg" => array("type" => "mediumtext"),
1003 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1004 "link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1005 "iid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1006 "parent" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1007 "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1008 "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1009 "otype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1012 "PRIMARY" => array("id"),
1013 "uid" => array("uid"),
1016 $database["notify-threads"] = array(
1018 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1019 "notify-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1020 "master-parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1021 "parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1022 "receiver-uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1025 "PRIMARY" => array("id"),
1026 "master-parent-item" => array("master-parent-item"),
1027 "receiver-uid" => array("receiver-uid"),
1030 $database["oembed"] = array(
1032 "url" => array("type" => "varchar(255)", "not null" => "1", "primary" => "1"),
1033 "content" => array("type" => "text"),
1034 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1037 "PRIMARY" => array("url".db_index_suffix($charset)),
1038 "created" => array("created"),
1041 $database["parsed_url"] = array(
1043 "url" => array("type" => "varchar(255)", "not null" => "1", "primary" => "1"),
1044 "guessing" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
1045 "oembed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
1046 "content" => array("type" => "text"),
1047 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1050 "PRIMARY" => array("url".db_index_suffix($charset), "guessing", "oembed"),
1051 "created" => array("created"),
1054 $database["pconfig"] = array(
1056 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1057 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1058 "cat" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1059 "k" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1060 "v" => array("type" => "mediumtext"),
1063 "PRIMARY" => array("id"),
1064 "uid_cat_k" => array("uid","cat(30)","k(30)"),
1067 $database["photo"] = array(
1069 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1070 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1071 "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1072 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1073 "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1074 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1075 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1076 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1077 "desc" => array("type" => "text"),
1078 "album" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1079 "filename" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1080 "type" => array("type" => "varchar(128)", "not null" => "1", "default" => "image/jpeg"),
1081 "height" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
1082 "width" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
1083 "datasize" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1084 "data" => array("type" => "mediumblob", "not null" => "1"),
1085 "scale" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
1086 "profile" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1087 "allow_cid" => array("type" => "mediumtext"),
1088 "allow_gid" => array("type" => "mediumtext"),
1089 "deny_cid" => array("type" => "mediumtext"),
1090 "deny_gid" => array("type" => "mediumtext"),
1093 "PRIMARY" => array("id"),
1094 "uid" => array("uid"),
1095 "resource-id" => array("resource-id"),
1096 "guid" => array("guid"),
1099 $database["poll"] = array(
1101 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1102 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1103 "q0" => array("type" => "mediumtext"),
1104 "q1" => array("type" => "mediumtext"),
1105 "q2" => array("type" => "mediumtext"),
1106 "q3" => array("type" => "mediumtext"),
1107 "q4" => array("type" => "mediumtext"),
1108 "q5" => array("type" => "mediumtext"),
1109 "q6" => array("type" => "mediumtext"),
1110 "q7" => array("type" => "mediumtext"),
1111 "q8" => array("type" => "mediumtext"),
1112 "q9" => array("type" => "mediumtext"),
1115 "PRIMARY" => array("id"),
1116 "uid" => array("uid"),
1119 $database["poll_result"] = array(
1121 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1122 "poll_id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1123 "choice" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1126 "PRIMARY" => array("id"),
1127 "poll_id" => array("poll_id"),
1128 "choice" => array("choice"),
1131 $database["process"] = array(
1133 "pid" => array("type" => "int(10) unsigned", "not null" => "1", "primary" => "1"),
1134 "command" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1135 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1138 "PRIMARY" => array("pid"),
1139 "command" => array("command"),
1142 $database["profile"] = array(
1144 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1145 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1146 "profile-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1147 "is-default" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1148 "hide-friends" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1149 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1150 "pdesc" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1151 "dob" => array("type" => "varchar(32)", "not null" => "1", "default" => "0000-00-00"),
1152 "address" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1153 "locality" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1154 "region" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1155 "postal-code" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1156 "country-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1157 "hometown" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1158 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1159 "marital" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1160 "with" => array("type" => "text"),
1161 "howlong" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1162 "sexual" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1163 "politic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1164 "religion" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1165 "pub_keywords" => array("type" => "text"),
1166 "prv_keywords" => array("type" => "text"),
1167 "likes" => array("type" => "text"),
1168 "dislikes" => array("type" => "text"),
1169 "about" => array("type" => "text"),
1170 "summary" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1171 "music" => array("type" => "text"),
1172 "book" => array("type" => "text"),
1173 "tv" => array("type" => "text"),
1174 "film" => array("type" => "text"),
1175 "interest" => array("type" => "text"),
1176 "romance" => array("type" => "text"),
1177 "work" => array("type" => "text"),
1178 "education" => array("type" => "text"),
1179 "contact" => array("type" => "text"),
1180 "homepage" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1181 "xmpp" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1182 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1183 "thumb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1184 "publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1185 "net-publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1188 "PRIMARY" => array("id"),
1189 "hometown" => array("hometown"),
1192 $database["profile_check"] = array(
1194 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1195 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1196 "cid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1197 "dfrn_id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1198 "sec" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1199 "expire" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1202 "PRIMARY" => array("id"),
1205 $database["push_subscriber"] = array(
1207 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1208 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1209 "callback_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1210 "topic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1211 "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1212 "push" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1213 "last_update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1214 "secret" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1217 "PRIMARY" => array("id"),
1220 $database["queue"] = array(
1222 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1223 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1224 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1225 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1226 "last" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1227 "content" => array("type" => "mediumtext"),
1228 "batch" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1231 "PRIMARY" => array("id"),
1232 "cid" => array("cid"),
1233 "created" => array("created"),
1234 "last" => array("last"),
1235 "network" => array("network"),
1236 "batch" => array("batch"),
1239 $database["register"] = array(
1241 "id" => array("type" => "int(11) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1242 "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1243 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1244 "uid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1245 "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1246 "language" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1249 "PRIMARY" => array("id"),
1252 $database["search"] = array(
1254 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1255 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1256 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1259 "PRIMARY" => array("id"),
1260 "uid" => array("uid"),
1261 "term" => array("term"),
1264 $database["session"] = array(
1266 "id" => array("type" => "bigint(20) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1267 "sid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1268 "data" => array("type" => "text"),
1269 "expire" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1272 "PRIMARY" => array("id"),
1273 "sid" => array("sid"),
1274 "expire" => array("expire"),
1277 $database["sign"] = array(
1279 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1280 "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1281 "signed_text" => array("type" => "mediumtext"),
1282 "signature" => array("type" => "text"),
1283 "signer" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1286 "PRIMARY" => array("id"),
1287 "iid" => array("iid"),
1290 $database["spam"] = array(
1292 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1293 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1294 "spam" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1295 "ham" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1296 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1297 "date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1300 "PRIMARY" => array("id"),
1301 "uid" => array("uid"),
1302 "spam" => array("spam"),
1303 "ham" => array("ham"),
1304 "term" => array("term"),
1307 $database["term"] = array(
1309 "tid" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1310 "oid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1311 "otype" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1312 "type" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1313 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1314 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1315 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1316 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1317 "received" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1318 "global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1319 "aid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1320 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1323 "PRIMARY" => array("tid"),
1324 "oid_otype_type_term" => array("oid","otype","type","term"),
1325 "uid_term_tid" => array("uid","term","tid"),
1326 "type_term" => array("type","term"),
1327 "uid_otype_type_term_global_created" => array("uid","otype","type","term","global","created"),
1328 "otype_type_term_tid" => array("otype","type","term","tid"),
1329 "guid" => array("guid"),
1332 $database["thread"] = array(
1334 "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "primary" => "1"),
1335 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1336 "contact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1337 "gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1338 "owner-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1339 "author-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1340 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1341 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1342 "commented" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1343 "received" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1344 "changed" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1345 "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1346 "private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1347 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1348 "moderated" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1349 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1350 "spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1351 "starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1352 "ignored" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1353 "bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1354 "unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
1355 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1356 "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1357 "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1358 "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1359 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1362 "PRIMARY" => array("iid"),
1363 "created" => array("created"),
1364 "commented" => array("commented"),
1365 "uid_network_commented" => array("uid","network","commented"),
1366 "uid_network_created" => array("uid","network","created"),
1367 "uid_contactid_commented" => array("uid","contact-id","commented"),
1368 "uid_contactid_created" => array("uid","contact-id","created"),
1369 "uid_gcontactid_commented" => array("uid","gcontact-id","commented"),
1370 "uid_gcontactid_created" => array("uid","gcontact-id","created"),
1371 "wall_private_received" => array("wall","private","received"),
1372 "uid_created" => array("uid","created"),
1373 "uid_commented" => array("uid","commented"),
1376 $database["tokens"] = array(
1378 "id" => array("type" => "varchar(40)", "not null" => "1", "primary" => "1"),
1379 "secret" => array("type" => "text"),
1380 "client_id" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
1381 "expires" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1382 "scope" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
1383 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1386 "PRIMARY" => array("id"),
1389 $database["user"] = array(
1391 "uid" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1392 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1393 "username" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1394 "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1395 "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1396 "email" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1397 "openid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1398 "timezone" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
1399 "language" => array("type" => "varchar(32)", "not null" => "1", "default" => "en"),
1400 "register_date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1401 "login_date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1402 "default-location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1403 "allow_location" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1404 "theme" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1405 "pubkey" => array("type" => "text"),
1406 "prvkey" => array("type" => "text"),
1407 "spubkey" => array("type" => "text"),
1408 "sprvkey" => array("type" => "text"),
1409 "verified" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1410 "blocked" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1411 "blockwall" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1412 "hidewall" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1413 "blocktags" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1414 "unkmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1415 "cntunkmail" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
1416 "notify-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "65535"),
1417 "page-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1418 "account-type" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1419 "prvnets" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1420 "pwdreset" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1421 "maxreq" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
1422 "expire" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1423 "account_removed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1424 "account_expired" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1425 "account_expires_on" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1426 "expire_notification_sent" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1427 "service_class" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1428 "def_gid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1429 "allow_cid" => array("type" => "mediumtext"),
1430 "allow_gid" => array("type" => "mediumtext"),
1431 "deny_cid" => array("type" => "mediumtext"),
1432 "deny_gid" => array("type" => "mediumtext"),
1433 "openidserver" => array("type" => "text"),
1436 "PRIMARY" => array("uid"),
1437 "nickname" => array("nickname"),
1440 $database["userd"] = array(
1442 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1443 "username" => array("type" => "varchar(255)", "not null" => "1"),
1446 "PRIMARY" => array("id"),
1447 "username" => array("username"),
1450 $database["workerqueue"] = array(
1452 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1453 "parameter" => array("type" => "text"),
1454 "priority" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1455 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1456 "pid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1457 "executed" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1460 "PRIMARY" => array("id"),
1461 "created" => array("created"),
1470 * run from command line
1472 function dbstructure_run(&$argv, &$argc) {
1480 @include(".htconfig.php");
1481 require_once("include/dba.php");
1482 $db = new dba($db_host, $db_user, $db_pass, $db_data);
1483 unset($db_host, $db_user, $db_pass, $db_data);
1489 update_structure(true, true);
1490 set_config('system','build',DB_UPDATE_VERSION);
1493 // For the dump that is used to create the database.sql we always assume utfmb4
1494 $charset = "utf8mb4";
1495 print_structure(db_definition($charset), $charset);
1502 echo $argv[0]." <command>\n";
1505 echo "update update database schema\n";
1506 echo "dumpsql dump database schema\n";
1514 if (array_search(__file__,get_included_files())===0){
1515 dbstructure_run($_SERVER["argv"],$_SERVER["argc"]);