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 if ($index["Sub_part"] != "")
83 $column .= "(".$index["Sub_part"].")";
85 $indexdata[$index["Key_name"]][] = $column;
88 if (is_array($structures)) {
89 foreach($structures AS $field) {
90 $fielddata[$field["Field"]]["type"] = $field["Type"];
91 if ($field["Null"] == "NO")
92 $fielddata[$field["Field"]]["not null"] = true;
94 if (isset($field["Default"]))
95 $fielddata[$field["Field"]]["default"] = $field["Default"];
97 if ($field["Extra"] != "")
98 $fielddata[$field["Field"]]["extra"] = $field["Extra"];
100 if ($field["Key"] == "PRI")
101 $fielddata[$field["Field"]]["primary"] = true;
104 return(array("fields"=>$fielddata, "indexes"=>$indexdata));
107 function print_structure($database) {
108 echo "-- ------------------------------------------\n";
109 echo "-- ".FRIENDICA_PLATFORM." ".FRIENDICA_VERSION." (".FRIENDICA_CODENAME,")\n";
110 echo "-- DB_UPDATE_VERSION ".DB_UPDATE_VERSION."\n";
111 echo "-- ------------------------------------------\n\n\n";
112 foreach ($database AS $name => $structure) {
114 echo "-- TABLE $name\n";
116 db_create_table($name, $structure['fields'], true, false, $structure["indexes"]);
122 function update_structure($verbose, $action, $tables=null, $definition=null) {
127 logger('updating structure', LOGGER_DEBUG);
129 // Get the current structure
132 if (is_null($tables))
133 $tables = q("show tables");
135 foreach ($tables AS $table) {
136 $table = current($table);
138 $database[$table] = table_structure($table);
141 // Get the definition
142 if (is_null($definition))
143 $definition = db_definition();
147 foreach ($definition AS $name => $structure) {
148 $is_new_table = False;
150 if (!isset($database[$name])) {
151 $r = db_create_table($name, $structure["fields"], $verbose, $action, $structure['indexes']);
153 $errors .= t('Errors encountered creating database tables.').$name.EOL;
155 $is_new_table = True;
157 // Drop the index if it isn't present in the definition
158 // or the definition differ from current status
159 // and index name doesn't start with "local_"
160 foreach ($database[$name]["indexes"] AS $indexname => $fieldnames) {
161 $current_index_definition = implode(",",$fieldnames);
162 if (isset($structure["indexes"][$indexname])) {
163 $new_index_definition = implode(",",$structure["indexes"][$indexname]);
165 $new_index_definition = "__NOT_SET__";
167 if ($current_index_definition != $new_index_definition && substr($indexname, 0, 6) != 'local_') {
168 $sql2=db_drop_index($indexname);
170 $sql3 = "ALTER TABLE `".$name."` ".$sql2;
175 // Compare the field structure field by field
176 foreach ($structure["fields"] AS $fieldname => $parameters) {
177 if (!isset($database[$name]["fields"][$fieldname])) {
178 $sql2=db_add_table_field($fieldname, $parameters);
180 $sql3 = "ALTER TABLE `".$name."` ".$sql2;
184 // Compare the field definition
185 $current_field_definition = implode(",",$database[$name]["fields"][$fieldname]);
186 $new_field_definition = implode(",",$parameters);
187 if ($current_field_definition != $new_field_definition) {
188 $sql2=db_modify_table_field($fieldname, $parameters);
190 $sql3 = "ALTER TABLE `".$name."` ".$sql2;
199 // Create the index if the index don't exists in database
200 // or the definition differ from the current status.
201 // Don't create keys if table is new
202 if (!$is_new_table) {
203 foreach ($structure["indexes"] AS $indexname => $fieldnames) {
204 if (isset($database[$name]["indexes"][$indexname])) {
205 $current_index_definition = implode(",",$database[$name]["indexes"][$indexname]);
207 $current_index_definition = "__NOT_SET__";
209 $new_index_definition = implode(",",$fieldnames);
210 if ($current_index_definition != $new_index_definition) {
211 $sql2=db_create_index($indexname, $fieldnames);
214 $sql3 = "ALTER TABLE `".$name."` ".$sql2;
230 $errors .= t('Errors encountered performing database changes.').$sql3.EOL;
238 function db_field_command($parameters, $create = true) {
239 $fieldstruct = $parameters["type"];
241 if ($parameters["not null"])
242 $fieldstruct .= " NOT NULL";
244 if (isset($parameters["default"])){
245 if (strpos(strtolower($parameters["type"]),"int")!==false) {
246 $fieldstruct .= " DEFAULT ".$parameters["default"];
248 $fieldstruct .= " DEFAULT '".$parameters["default"]."'";
251 if ($parameters["extra"] != "")
252 $fieldstruct .= " ".$parameters["extra"];
254 /*if (($parameters["primary"] != "") AND $create)
255 $fieldstruct .= " PRIMARY KEY";*/
257 return($fieldstruct);
260 function db_create_table($name, $fields, $verbose, $action, $indexes=null) {
268 $primary_keys = array();
269 foreach($fields AS $fieldname => $field) {
270 $sql_rows[] = "`".dbesc($fieldname)."` ".db_field_command($field);
271 if (x($field,'primary') and $field['primary']!=''){
272 $primary_keys[] = $fieldname;
276 if (!is_null($indexes)) {
277 foreach ($indexes AS $indexname => $fieldnames) {
278 $sql_index = db_create_index($indexname, $fieldnames, "");
279 if (!is_null($sql_index)) $sql_rows[] = $sql_index;
283 $sql = implode(",\n\t", $sql_rows);
285 $sql = sprintf("CREATE TABLE IF NOT EXISTS `%s` (\n\t", dbesc($name)).$sql."\n) DEFAULT CHARSET=utf8";
295 function db_add_table_field($fieldname, $parameters) {
296 $sql = sprintf("ADD `%s` %s", dbesc($fieldname), db_field_command($parameters));
300 function db_modify_table_field($fieldname, $parameters) {
301 $sql = sprintf("MODIFY `%s` %s", dbesc($fieldname), db_field_command($parameters, false));
305 function db_drop_index($indexname) {
306 $sql = sprintf("DROP INDEX `%s`", dbesc($indexname));
310 function db_create_index($indexname, $fieldnames, $method="ADD") {
312 $method = strtoupper(trim($method));
313 if ($method!="" && $method!="ADD") {
314 throw new Exception("Invalid parameter 'method' in db_create_index(): '$method'");
319 if ($indexname == "PRIMARY") {
320 return sprintf("%s PRIMARY KEY(`%s`)", $method, implode("`,`", $fieldnames));
324 foreach ($fieldnames AS $fieldname) {
328 if (preg_match('|(.+)\((\d+)\)|', $fieldname, $matches))
329 $names .= "`".dbesc($matches[1])."`(".intval($matches[2]).")";
331 $names .= "`".dbesc($fieldname)."`";
335 $sql = sprintf("%s INDEX `%s` (%s)", $method, dbesc($indexname), $names);
339 function db_definition() {
343 $database["addon"] = array(
345 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
346 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
347 "version" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
348 "installed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
349 "hidden" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
350 "timestamp" => array("type" => "bigint(20)", "not null" => "1", "default" => "0"),
351 "plugin_admin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
354 "PRIMARY" => array("id"),
357 $database["attach"] = array(
359 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
360 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
361 "hash" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
362 "filename" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
363 "filetype" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
364 "filesize" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
365 "data" => array("type" => "longblob", "not null" => "1"),
366 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
367 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
368 "allow_cid" => array("type" => "mediumtext", "not null" => "1"),
369 "allow_gid" => array("type" => "mediumtext", "not null" => "1"),
370 "deny_cid" => array("type" => "mediumtext", "not null" => "1"),
371 "deny_gid" => array("type" => "mediumtext", "not null" => "1"),
374 "PRIMARY" => array("id"),
377 $database["auth_codes"] = array(
379 "id" => array("type" => "varchar(40)", "not null" => "1", "primary" => "1"),
380 "client_id" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
381 "redirect_uri" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
382 "expires" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
383 "scope" => array("type" => "varchar(250)", "not null" => "1", "default" => ""),
386 "PRIMARY" => array("id"),
389 $database["cache"] = array(
391 "k" => array("type" => "varchar(255)", "not null" => "1", "primary" => "1"),
392 "v" => array("type" => "text", "not null" => "1"),
393 "expire_mode" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
394 "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
397 "PRIMARY" => array("k"),
398 "updated" => array("updated"),
401 $database["challenge"] = array(
403 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
404 "challenge" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
405 "dfrn-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
406 "expire" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
407 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
408 "last_update" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
411 "PRIMARY" => array("id"),
414 $database["clients"] = array(
416 "client_id" => array("type" => "varchar(20)", "not null" => "1", "primary" => "1"),
417 "pw" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
418 "redirect_uri" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
419 "name" => array("type" => "text"),
420 "icon" => array("type" => "text"),
421 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
424 "PRIMARY" => array("client_id"),
427 $database["config"] = array(
429 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
430 "cat" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
431 "k" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
432 "v" => array("type" => "text", "not null" => "1"),
435 "PRIMARY" => array("id"),
436 "cat_k" => array("cat(30)","k(30)"),
439 $database["contact"] = array(
441 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
442 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
443 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
444 "self" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
445 "remote_self" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
446 "rel" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
447 "duplex" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
448 "network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
449 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
450 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
451 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
452 "about" => array("type" => "text", "not null" => "1"),
453 "keywords" => array("type" => "text", "not null" => "1"),
454 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
455 "attag" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
456 "avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
457 "photo" => array("type" => "text", "not null" => "1"),
458 "thumb" => array("type" => "text", "not null" => "1"),
459 "micro" => array("type" => "text", "not null" => "1"),
460 "site-pubkey" => array("type" => "text", "not null" => "1"),
461 "issued-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
462 "dfrn-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
463 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
464 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
465 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
466 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
467 "pubkey" => array("type" => "text", "not null" => "1"),
468 "prvkey" => array("type" => "text", "not null" => "1"),
469 "batch" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
470 "request" => array("type" => "text", "not null" => "1"),
471 "notify" => array("type" => "text", "not null" => "1"),
472 "poll" => array("type" => "text", "not null" => "1"),
473 "confirm" => array("type" => "text", "not null" => "1"),
474 "poco" => array("type" => "text", "not null" => "1"),
475 "aes_allow" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
476 "ret-aes" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
477 "usehub" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
478 "subhub" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
479 "hub-verify" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
480 "last-update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
481 "success_update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
482 "failure_update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
483 "name-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
484 "uri-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
485 "avatar-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
486 "term-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
487 "last-item" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
488 "priority" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
489 "blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
490 "readonly" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
491 "writable" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
492 "forum" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
493 "prv" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
494 "hidden" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
495 "archive" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
496 "pending" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
497 "rating" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
498 "reason" => array("type" => "text", "not null" => "1"),
499 "closeness" => array("type" => "tinyint(2)", "not null" => "1", "default" => "99"),
500 "info" => array("type" => "mediumtext", "not null" => "1"),
501 "profile-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
502 "bdyear" => array("type" => "varchar(4)", "not null" => "1", "default" => ""),
503 "bd" => array("type" => "date", "not null" => "1", "default" => "0000-00-00"),
504 "notify_new_posts" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
505 "fetch_further_information" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
506 "ffi_keyword_blacklist" => array("type" => "mediumtext", "not null" => "1"),
509 "PRIMARY" => array("id"),
510 "uid" => array("uid"),
513 $database["conv"] = array(
515 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
516 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
517 "recips" => array("type" => "mediumtext", "not null" => "1"),
518 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
519 "creator" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
520 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
521 "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
522 "subject" => array("type" => "mediumtext", "not null" => "1"),
525 "PRIMARY" => array("id"),
526 "uid" => array("uid"),
529 $database["deliverq"] = array(
531 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
532 "cmd" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
533 "item" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
534 "contact" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
537 "PRIMARY" => array("id"),
540 $database["dsprphotoq"] = array(
542 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
543 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
544 "msg" => array("type" => "mediumtext", "not null" => "1"),
545 "attempt" => array("type" => "tinyint(4)", "not null" => "1", "default" => "0"),
548 "PRIMARY" => array("id"),
551 $database["event"] = array(
553 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
554 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
555 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
556 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
557 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
558 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
559 "start" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
560 "finish" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
561 "summary" => array("type" => "text", "not null" => "1"),
562 "desc" => array("type" => "text", "not null" => "1"),
563 "location" => array("type" => "text", "not null" => "1"),
564 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
565 "nofinish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
566 "adjust" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
567 "ignore" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
568 "allow_cid" => array("type" => "mediumtext", "not null" => "1"),
569 "allow_gid" => array("type" => "mediumtext", "not null" => "1"),
570 "deny_cid" => array("type" => "mediumtext", "not null" => "1"),
571 "deny_gid" => array("type" => "mediumtext", "not null" => "1"),
574 "PRIMARY" => array("id"),
575 "uid" => array("uid"),
578 $database["fcontact"] = array(
580 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
581 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
582 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
583 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
584 "request" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
585 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
586 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
587 "batch" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
588 "notify" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
589 "poll" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
590 "confirm" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
591 "priority" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
592 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
593 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
594 "pubkey" => array("type" => "text", "not null" => "1"),
595 "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
598 "PRIMARY" => array("id"),
599 "addr" => array("addr"),
602 $database["ffinder"] = array(
604 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
605 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
606 "cid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
607 "fid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
610 "PRIMARY" => array("id"),
613 $database["fserver"] = array(
615 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
616 "server" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
617 "posturl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
618 "key" => array("type" => "text", "not null" => "1"),
621 "PRIMARY" => array("id"),
622 "server" => array("server"),
625 $database["fsuggest"] = array(
627 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
628 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
629 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
630 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
631 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
632 "request" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
633 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
634 "note" => array("type" => "text", "not null" => "1"),
635 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
638 "PRIMARY" => array("id"),
641 $database["gcign"] = array(
643 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
644 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
645 "gcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
648 "PRIMARY" => array("id"),
649 "uid" => array("uid"),
650 "gcid" => array("gcid"),
653 $database["gcontact"] = array(
655 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
656 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
657 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
658 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
659 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
660 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
661 "connect" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
662 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
663 "updated" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
664 "last_contact" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
665 "last_failure" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
666 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
667 "about" => array("type" => "text", "not null" => "1"),
668 "keywords" => array("type" => "text", "not null" => "1"),
669 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
670 "birthday" => array("type" => "varchar(32)", "not null" => "1", "default" => "0000-00-00"),
671 "community" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
672 "hide" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
673 "nsfw" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
674 "network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
675 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
676 "notify" => array("type" => "text", "not null" => "1"),
677 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
678 "generation" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
679 "server_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
682 "PRIMARY" => array("id"),
683 "nurl" => array("nurl"),
684 "updated" => array("updated"),
687 $database["glink"] = array(
689 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
690 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
691 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
692 "gcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
693 "zcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
694 "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
697 "PRIMARY" => array("id"),
698 "cid_uid_gcid_zcid" => array("cid","uid","gcid","zcid"),
699 "gcid" => array("gcid"),
700 "zcid" => array("zcid"),
703 $database["group"] = array(
705 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
706 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
707 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
708 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
709 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
712 "PRIMARY" => array("id"),
713 "uid" => array("uid"),
716 $database["group_member"] = array(
718 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
719 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
720 "gid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
721 "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
724 "PRIMARY" => array("id"),
725 "uid_gid_contactid" => array("uid","gid","contact-id"),
728 $database["gserver"] = array(
730 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
731 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
732 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
733 "version" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
734 "site_name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
735 "info" => array("type" => "text", "not null" => "1"),
736 "register_policy" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
737 "poco" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
738 "noscrape" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
739 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
740 "platform" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
741 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
742 "last_poco_query" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
743 "last_contact" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
744 "last_failure" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
747 "PRIMARY" => array("id"),
748 "nurl" => array("nurl"),
751 $database["hook"] = array(
753 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
754 "hook" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
755 "file" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
756 "function" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
757 "priority" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
760 "PRIMARY" => array("id"),
761 "hook_file_function" => array("hook(30)","file(60)","function(30)"),
764 $database["intro"] = array(
766 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
767 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
768 "fid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
769 "contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
770 "knowyou" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
771 "duplex" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
772 "note" => array("type" => "text", "not null" => "1"),
773 "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
774 "datetime" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
775 "blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
776 "ignore" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
779 "PRIMARY" => array("id"),
782 $database["item"] = array(
784 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
785 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
786 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
787 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
788 "contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
789 "gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
790 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
791 "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
792 "gravity" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
793 "parent" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
794 "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
795 "extid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
796 "thr-parent" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
797 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
798 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
799 "commented" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
800 "received" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
801 "changed" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
802 "owner-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
803 "owner-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
804 "owner-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
805 "author-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
806 "author-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
807 "author-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
808 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
809 "body" => array("type" => "mediumtext", "not null" => "1"),
810 "app" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
811 "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
812 "object-type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
813 "object" => array("type" => "text", "not null" => "1"),
814 "target-type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
815 "target" => array("type" => "text", "not null" => "1"),
816 "postopts" => array("type" => "text", "not null" => "1"),
817 "plink" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
818 "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
819 "event-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
820 "tag" => array("type" => "mediumtext", "not null" => "1"),
821 "attach" => array("type" => "mediumtext", "not null" => "1"),
822 "inform" => array("type" => "mediumtext", "not null" => "1"),
823 "file" => array("type" => "mediumtext", "not null" => "1"),
824 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
825 "coord" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
826 "allow_cid" => array("type" => "mediumtext", "not null" => "1"),
827 "allow_gid" => array("type" => "mediumtext", "not null" => "1"),
828 "deny_cid" => array("type" => "mediumtext", "not null" => "1"),
829 "deny_gid" => array("type" => "mediumtext", "not null" => "1"),
830 "private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
831 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
832 "moderated" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
833 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
834 "spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
835 "starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
836 "bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
837 "unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
838 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
839 "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
840 "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
841 "last-child" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "1"),
842 "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
843 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
844 "rendered-hash" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
845 "rendered-html" => array("type" => "mediumtext", "not null" => "1"),
846 "global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
849 "PRIMARY" => array("id"),
850 "guid" => array("guid"),
851 "uri" => array("uri"),
852 "parent" => array("parent"),
853 "parent-uri" => array("parent-uri"),
854 "extid" => array("extid"),
855 "uid_id" => array("uid","id"),
856 "uid_created" => array("uid","created"),
857 "uid_unseen" => array("uid","unseen"),
858 "uid_network_received" => array("uid","network","received"),
859 "uid_received" => array("uid","received"),
860 "uid_network_commented" => array("uid","network","commented"),
861 "uid_commented" => array("uid","commented"),
862 "uid_title" => array("uid","title"),
863 "uid_thrparent" => array("uid","thr-parent"),
864 "uid_parenturi" => array("uid","parent-uri"),
865 "uid_contactid_created" => array("uid","contact-id","created"),
866 "gcontactid_uid_created" => array("gcontact-id","uid","created"),
867 "wall_body" => array("wall","body(6)"),
868 "uid_visible_moderated_created" => array("uid","visible","moderated","created"),
869 "uid_uri" => array("uid","uri"),
870 "uid_wall_created" => array("uid","wall","created"),
871 "resource-id" => array("resource-id"),
872 "uid_type" => array("uid","type"),
873 "uid_starred" => array("uid","starred"),
874 "contactid_allowcid_allowpid_denycid_denygid" => array("contact-id","allow_cid(10)","allow_gid(10)","deny_cid(10)","deny_gid(10)"),
875 "uid_wall_parent_created" => array("uid","wall","parent","created"),
876 "uid_type_changed" => array("uid","type","changed"),
877 "contactid_verb" => array("contact-id","verb"),
878 "deleted_changed" => array("deleted","changed"),
879 "uid_wall_changed" => array("uid","wall","changed"),
880 "uid_eventid" => array("uid","event-id"),
881 "uid_authorlink" => array("uid","author-link"),
882 "uid_ownerlink" => array("uid","owner-link"),
885 $database["item_id"] = array(
887 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
888 "iid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
889 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
890 "sid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
891 "service" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
894 "PRIMARY" => array("id"),
895 "uid" => array("uid"),
896 "sid" => array("sid"),
897 "service" => array("service"),
898 "iid" => array("iid"),
901 $database["locks"] = array(
903 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
904 "name" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
905 "locked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
906 "created" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
909 "PRIMARY" => array("id"),
912 $database["mail"] = array(
914 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
915 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
916 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
917 "from-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
918 "from-photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
919 "from-url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
920 "contact-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
921 "convid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
922 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
923 "body" => array("type" => "mediumtext", "not null" => "1"),
924 "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
925 "reply" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
926 "replied" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
927 "unknown" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
928 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
929 "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
930 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
933 "PRIMARY" => array("id"),
934 "uid" => array("uid"),
935 "guid" => array("guid"),
936 "convid" => array("convid"),
937 "reply" => array("reply"),
938 "uri" => array("uri"),
939 "parent-uri" => array("parent-uri"),
942 $database["mailacct"] = array(
944 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
945 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
946 "server" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
947 "port" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
948 "ssltype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
949 "mailbox" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
950 "user" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
951 "pass" => array("type" => "text", "not null" => "1"),
952 "reply_to" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
953 "action" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
954 "movetofolder" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
955 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
956 "last_check" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
959 "PRIMARY" => array("id"),
962 $database["manage"] = 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 "mid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
969 "PRIMARY" => array("id"),
970 "uid_mid" => array("uid","mid"),
973 $database["notify"] = array(
975 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
976 "hash" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
977 "type" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
978 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
979 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
980 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
981 "date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
982 "msg" => array("type" => "mediumtext", "not null" => "1"),
983 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
984 "link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
985 "iid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
986 "parent" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
987 "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
988 "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
989 "otype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
992 "PRIMARY" => array("id"),
993 "uid" => array("uid"),
996 $database["notify-threads"] = array(
998 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
999 "notify-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1000 "master-parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1001 "parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1002 "receiver-uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1005 "PRIMARY" => array("id"),
1006 "master-parent-item" => array("master-parent-item"),
1007 "receiver-uid" => array("receiver-uid"),
1010 $database["oembed"] = array(
1012 "url" => array("type" => "varchar(255)", "not null" => "1", "primary" => "1"),
1013 "content" => array("type" => "text", "not null" => "1"),
1014 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1017 "PRIMARY" => array("url"),
1018 "created" => array("created"),
1021 $database["parsed_url"] = array(
1023 "url" => array("type" => "varchar(255)", "not null" => "1", "primary" => "1"),
1024 "guessing" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
1025 "oembed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
1026 "content" => array("type" => "text", "not null" => "1"),
1027 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1030 "PRIMARY" => array("url", "guessing", "oembed"),
1031 "created" => array("created"),
1034 $database["pconfig"] = array(
1036 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1037 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1038 "cat" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1039 "k" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1040 "v" => array("type" => "mediumtext", "not null" => "1"),
1043 "PRIMARY" => array("id"),
1044 "uid_cat_k" => array("uid","cat(30)","k(30)"),
1047 $database["photo"] = array(
1049 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1050 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1051 "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1052 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1053 "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1054 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1055 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1056 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1057 "desc" => array("type" => "text", "not null" => "1"),
1058 "album" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1059 "filename" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1060 "type" => array("type" => "varchar(128)", "not null" => "1", "default" => "image/jpeg"),
1061 "height" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
1062 "width" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
1063 "datasize" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1064 "data" => array("type" => "mediumblob", "not null" => "1"),
1065 "scale" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
1066 "profile" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1067 "allow_cid" => array("type" => "mediumtext", "not null" => "1"),
1068 "allow_gid" => array("type" => "mediumtext", "not null" => "1"),
1069 "deny_cid" => array("type" => "mediumtext", "not null" => "1"),
1070 "deny_gid" => array("type" => "mediumtext", "not null" => "1"),
1073 "PRIMARY" => array("id"),
1074 "uid" => array("uid"),
1075 "resource-id" => array("resource-id"),
1076 "guid" => array("guid"),
1079 $database["poll"] = array(
1081 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1082 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1083 "q0" => array("type" => "mediumtext", "not null" => "1"),
1084 "q1" => array("type" => "mediumtext", "not null" => "1"),
1085 "q2" => array("type" => "mediumtext", "not null" => "1"),
1086 "q3" => array("type" => "mediumtext", "not null" => "1"),
1087 "q4" => array("type" => "mediumtext", "not null" => "1"),
1088 "q5" => array("type" => "mediumtext", "not null" => "1"),
1089 "q6" => array("type" => "mediumtext", "not null" => "1"),
1090 "q7" => array("type" => "mediumtext", "not null" => "1"),
1091 "q8" => array("type" => "mediumtext", "not null" => "1"),
1092 "q9" => array("type" => "mediumtext", "not null" => "1"),
1095 "PRIMARY" => array("id"),
1096 "uid" => array("uid"),
1099 $database["poll_result"] = array(
1101 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1102 "poll_id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1103 "choice" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1106 "PRIMARY" => array("id"),
1107 "poll_id" => array("poll_id"),
1108 "choice" => array("choice"),
1111 $database["profile"] = array(
1113 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1114 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1115 "profile-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1116 "is-default" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1117 "hide-friends" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1118 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1119 "pdesc" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1120 "dob" => array("type" => "varchar(32)", "not null" => "1", "default" => "0000-00-00"),
1121 "address" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1122 "locality" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1123 "region" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1124 "postal-code" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1125 "country-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1126 "hometown" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1127 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1128 "marital" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1129 "with" => array("type" => "text", "not null" => "1"),
1130 "howlong" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1131 "sexual" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1132 "politic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1133 "religion" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1134 "pub_keywords" => array("type" => "text", "not null" => "1"),
1135 "prv_keywords" => array("type" => "text", "not null" => "1"),
1136 "likes" => array("type" => "text", "not null" => "1"),
1137 "dislikes" => array("type" => "text", "not null" => "1"),
1138 "about" => array("type" => "text", "not null" => "1"),
1139 "summary" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1140 "music" => array("type" => "text", "not null" => "1"),
1141 "book" => array("type" => "text", "not null" => "1"),
1142 "tv" => array("type" => "text", "not null" => "1"),
1143 "film" => array("type" => "text", "not null" => "1"),
1144 "interest" => array("type" => "text", "not null" => "1"),
1145 "romance" => array("type" => "text", "not null" => "1"),
1146 "work" => array("type" => "text", "not null" => "1"),
1147 "education" => array("type" => "text", "not null" => "1"),
1148 "contact" => array("type" => "text", "not null" => "1"),
1149 "homepage" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1150 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1151 "thumb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1152 "publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1153 "net-publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1156 "PRIMARY" => array("id"),
1157 "hometown" => array("hometown"),
1160 $database["profile_check"] = array(
1162 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1163 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1164 "cid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1165 "dfrn_id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1166 "sec" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1167 "expire" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1170 "PRIMARY" => array("id"),
1173 $database["push_subscriber"] = array(
1175 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1176 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1177 "callback_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1178 "topic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1179 "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1180 "push" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1181 "last_update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1182 "secret" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1185 "PRIMARY" => array("id"),
1188 $database["queue"] = array(
1190 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1191 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1192 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1193 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1194 "last" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1195 "content" => array("type" => "mediumtext", "not null" => "1"),
1196 "batch" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1199 "PRIMARY" => array("id"),
1200 "cid" => array("cid"),
1201 "created" => array("created"),
1202 "last" => array("last"),
1203 "network" => array("network"),
1204 "batch" => array("batch"),
1207 $database["register"] = array(
1209 "id" => array("type" => "int(11) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1210 "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1211 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1212 "uid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1213 "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1214 "language" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1217 "PRIMARY" => array("id"),
1220 $database["search"] = array(
1222 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1223 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1224 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1227 "PRIMARY" => array("id"),
1228 "uid" => array("uid"),
1229 "term" => array("term"),
1232 $database["session"] = array(
1234 "id" => array("type" => "bigint(20) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1235 "sid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1236 "data" => array("type" => "text", "not null" => "1"),
1237 "expire" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1240 "PRIMARY" => array("id"),
1241 "sid" => array("sid"),
1242 "expire" => array("expire"),
1245 $database["sign"] = array(
1247 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1248 "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1249 "retract_iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1250 "signed_text" => array("type" => "mediumtext", "not null" => "1"),
1251 "signature" => array("type" => "text", "not null" => "1"),
1252 "signer" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1255 "PRIMARY" => array("id"),
1256 "iid" => array("iid"),
1257 "retract_iid" => array("retract_iid"),
1260 $database["spam"] = array(
1262 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1263 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1264 "spam" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1265 "ham" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1266 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1267 "date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1270 "PRIMARY" => array("id"),
1271 "uid" => array("uid"),
1272 "spam" => array("spam"),
1273 "ham" => array("ham"),
1274 "term" => array("term"),
1277 $database["term"] = array(
1279 "tid" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1280 "oid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1281 "otype" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1282 "type" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1283 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1284 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1285 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1286 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1287 "received" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1288 "global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1289 "aid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1290 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1293 "PRIMARY" => array("tid"),
1294 "oid_otype_type_term" => array("oid","otype","type","term"),
1295 "uid_term_tid" => array("uid","term","tid"),
1296 "type_term" => array("type","term"),
1297 "uid_otype_type_term_global_created" => array("uid","otype","type","term","global","created"),
1298 "otype_type_term_tid" => array("otype","type","term","tid"),
1299 "guid" => array("guid"),
1302 $database["thread"] = array(
1304 "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "primary" => "1"),
1305 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1306 "contact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1307 "gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1308 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1309 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1310 "commented" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1311 "received" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1312 "changed" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1313 "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1314 "private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1315 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1316 "moderated" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1317 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1318 "spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1319 "starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1320 "ignored" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1321 "bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1322 "unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
1323 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1324 "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1325 "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1326 "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1327 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1330 "PRIMARY" => array("iid"),
1331 "created" => array("created"),
1332 "commented" => array("commented"),
1333 "uid_network_commented" => array("uid","network","commented"),
1334 "uid_network_created" => array("uid","network","created"),
1335 "uid_contactid_commented" => array("uid","contact-id","commented"),
1336 "uid_contactid_created" => array("uid","contact-id","created"),
1337 "uid_gcontactid_commented" => array("uid","gcontact-id","commented"),
1338 "uid_gcontactid_created" => array("uid","gcontact-id","created"),
1339 "wall_private_received" => array("wall","private","received"),
1340 "uid_created" => array("uid","created"),
1341 "uid_commented" => array("uid","commented"),
1344 $database["tokens"] = array(
1346 "id" => array("type" => "varchar(40)", "not null" => "1", "primary" => "1"),
1347 "secret" => array("type" => "text", "not null" => "1"),
1348 "client_id" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
1349 "expires" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1350 "scope" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
1351 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1354 "PRIMARY" => array("id"),
1357 $database["user"] = array(
1359 "uid" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1360 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1361 "username" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1362 "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1363 "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1364 "email" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1365 "openid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1366 "timezone" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
1367 "language" => array("type" => "varchar(32)", "not null" => "1", "default" => "en"),
1368 "register_date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1369 "login_date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1370 "default-location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1371 "allow_location" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1372 "theme" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1373 "pubkey" => array("type" => "text", "not null" => "1"),
1374 "prvkey" => array("type" => "text", "not null" => "1"),
1375 "spubkey" => array("type" => "text", "not null" => "1"),
1376 "sprvkey" => array("type" => "text", "not null" => "1"),
1377 "verified" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1378 "blocked" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1379 "blockwall" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1380 "hidewall" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1381 "blocktags" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1382 "unkmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1383 "cntunkmail" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
1384 "notify-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "65535"),
1385 "page-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1386 "prvnets" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1387 "pwdreset" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1388 "maxreq" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
1389 "expire" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1390 "account_removed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1391 "account_expired" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1392 "account_expires_on" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1393 "expire_notification_sent" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1394 "service_class" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1395 "def_gid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1396 "allow_cid" => array("type" => "mediumtext", "not null" => "1"),
1397 "allow_gid" => array("type" => "mediumtext", "not null" => "1"),
1398 "deny_cid" => array("type" => "mediumtext", "not null" => "1"),
1399 "deny_gid" => array("type" => "mediumtext", "not null" => "1"),
1400 "openidserver" => array("type" => "text", "not null" => "1"),
1403 "PRIMARY" => array("uid"),
1404 "nickname" => array("nickname"),
1407 $database["userd"] = array(
1409 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1410 "username" => array("type" => "varchar(255)", "not null" => "1"),
1413 "PRIMARY" => array("id"),
1414 "username" => array("username"),
1417 $database["workerqueue"] = array(
1419 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1420 "parameter" => array("type" => "text", "not null" => "1"),
1421 "priority" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1422 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1423 "pid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1424 "executed" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1427 "PRIMARY" => array("id"),
1428 "created" => array("created"),
1437 * run from command line
1439 function dbstructure_run(&$argv, &$argc) {
1447 @include(".htconfig.php");
1448 require_once("include/dba.php");
1449 $db = new dba($db_host, $db_user, $db_pass, $db_data);
1450 unset($db_host, $db_user, $db_pass, $db_data);
1456 update_structure(true, true);
1459 print_structure(db_definition());
1466 echo $argv[0]." <command>\n";
1469 echo "update update database schema\n";
1470 echo "dumpsql dump database schema\n";
1478 if (array_search(__file__,get_included_files())===0){
1479 dbstructure_run($_SERVER["argv"],$_SERVER["argc"]);