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 "photo" => array("type" => "text", "not null" => "1"),
457 "thumb" => array("type" => "text", "not null" => "1"),
458 "micro" => array("type" => "text", "not null" => "1"),
459 "site-pubkey" => array("type" => "text", "not null" => "1"),
460 "issued-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
461 "dfrn-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
462 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
463 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
464 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
465 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
466 "pubkey" => array("type" => "text", "not null" => "1"),
467 "prvkey" => array("type" => "text", "not null" => "1"),
468 "batch" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
469 "request" => array("type" => "text", "not null" => "1"),
470 "notify" => array("type" => "text", "not null" => "1"),
471 "poll" => array("type" => "text", "not null" => "1"),
472 "confirm" => array("type" => "text", "not null" => "1"),
473 "poco" => array("type" => "text", "not null" => "1"),
474 "aes_allow" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
475 "ret-aes" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
476 "usehub" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
477 "subhub" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
478 "hub-verify" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
479 "last-update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
480 "success_update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
481 "failure_update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
482 "name-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
483 "uri-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
484 "avatar-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
485 "term-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
486 "last-item" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
487 "priority" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
488 "blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
489 "readonly" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
490 "writable" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
491 "forum" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
492 "prv" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
493 "hidden" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
494 "archive" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
495 "pending" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
496 "rating" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
497 "reason" => array("type" => "text", "not null" => "1"),
498 "closeness" => array("type" => "tinyint(2)", "not null" => "1", "default" => "99"),
499 "info" => array("type" => "mediumtext", "not null" => "1"),
500 "profile-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
501 "bdyear" => array("type" => "varchar(4)", "not null" => "1", "default" => ""),
502 "bd" => array("type" => "date", "not null" => "1", "default" => "0000-00-00"),
503 "notify_new_posts" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
504 "fetch_further_information" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
505 "ffi_keyword_blacklist" => array("type" => "mediumtext", "not null" => "1"),
508 "PRIMARY" => array("id"),
509 "uid" => array("uid"),
512 $database["conv"] = array(
514 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
515 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
516 "recips" => array("type" => "mediumtext", "not null" => "1"),
517 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
518 "creator" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
519 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
520 "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
521 "subject" => array("type" => "mediumtext", "not null" => "1"),
524 "PRIMARY" => array("id"),
525 "uid" => array("uid"),
528 $database["deliverq"] = array(
530 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
531 "cmd" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
532 "item" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
533 "contact" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
536 "PRIMARY" => array("id"),
539 $database["dsprphotoq"] = array(
541 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
542 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
543 "msg" => array("type" => "mediumtext", "not null" => "1"),
544 "attempt" => array("type" => "tinyint(4)", "not null" => "1", "default" => "0"),
547 "PRIMARY" => array("id"),
550 $database["event"] = array(
552 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
553 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
554 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
555 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
556 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
557 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
558 "start" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
559 "finish" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
560 "summary" => array("type" => "text", "not null" => "1"),
561 "desc" => array("type" => "text", "not null" => "1"),
562 "location" => array("type" => "text", "not null" => "1"),
563 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
564 "nofinish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
565 "adjust" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
566 "ignore" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
567 "allow_cid" => array("type" => "mediumtext", "not null" => "1"),
568 "allow_gid" => array("type" => "mediumtext", "not null" => "1"),
569 "deny_cid" => array("type" => "mediumtext", "not null" => "1"),
570 "deny_gid" => array("type" => "mediumtext", "not null" => "1"),
573 "PRIMARY" => array("id"),
574 "uid" => array("uid"),
577 $database["fcontact"] = array(
579 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
580 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
581 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
582 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
583 "request" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
584 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
585 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
586 "batch" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
587 "notify" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
588 "poll" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
589 "confirm" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
590 "priority" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
591 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
592 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
593 "pubkey" => array("type" => "text", "not null" => "1"),
594 "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
597 "PRIMARY" => array("id"),
598 "addr" => array("addr"),
601 $database["ffinder"] = array(
603 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
604 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
605 "cid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
606 "fid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
609 "PRIMARY" => array("id"),
612 $database["fserver"] = array(
614 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
615 "server" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
616 "posturl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
617 "key" => array("type" => "text", "not null" => "1"),
620 "PRIMARY" => array("id"),
621 "server" => array("server"),
624 $database["fsuggest"] = array(
626 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
627 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
628 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
629 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
630 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
631 "request" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
632 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
633 "note" => array("type" => "text", "not null" => "1"),
634 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
637 "PRIMARY" => array("id"),
640 $database["gcign"] = array(
642 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
643 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
644 "gcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
647 "PRIMARY" => array("id"),
648 "uid" => array("uid"),
649 "gcid" => array("gcid"),
652 $database["gcontact"] = array(
654 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
655 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
656 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
657 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
658 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
659 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
660 "connect" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
661 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
662 "updated" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
663 "last_contact" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
664 "last_failure" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
665 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
666 "about" => array("type" => "text", "not null" => "1"),
667 "keywords" => array("type" => "text", "not null" => "1"),
668 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
669 "birthday" => array("type" => "varchar(32)", "not null" => "1", "default" => "0000-00-00"),
670 "community" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
671 "hide" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
672 "nsfw" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
673 "network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
674 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
675 "generation" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
676 "server_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
679 "PRIMARY" => array("id"),
680 "nurl" => array("nurl"),
681 "updated" => array("updated"),
684 $database["glink"] = array(
686 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
687 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
688 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
689 "gcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
690 "zcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
691 "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
694 "PRIMARY" => array("id"),
695 "cid_uid_gcid_zcid" => array("cid","uid","gcid","zcid"),
696 "gcid" => array("gcid"),
697 "zcid" => array("zcid"),
700 $database["group"] = array(
702 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
703 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
704 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
705 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
706 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
709 "PRIMARY" => array("id"),
710 "uid" => array("uid"),
713 $database["group_member"] = array(
715 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
716 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
717 "gid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
718 "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
721 "PRIMARY" => array("id"),
722 "uid_gid_contactid" => array("uid","gid","contact-id"),
725 $database["gserver"] = array(
727 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
728 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
729 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
730 "version" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
731 "site_name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
732 "info" => array("type" => "text", "not null" => "1"),
733 "register_policy" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
734 "poco" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
735 "noscrape" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
736 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
737 "platform" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
738 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
739 "last_poco_query" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
740 "last_contact" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
741 "last_failure" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
744 "PRIMARY" => array("id"),
745 "nurl" => array("nurl"),
748 $database["guid"] = array(
750 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
751 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
752 "plink" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
753 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
754 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
757 "PRIMARY" => array("id"),
758 "guid" => array("guid"),
759 "plink" => array("plink"),
760 "uri" => array("uri"),
763 $database["hook"] = array(
765 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
766 "hook" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
767 "file" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
768 "function" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
769 "priority" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
772 "PRIMARY" => array("id"),
773 "hook_file_function" => array("hook(30)","file(60)","function(30)"),
776 $database["intro"] = array(
778 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
779 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
780 "fid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
781 "contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
782 "knowyou" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
783 "duplex" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
784 "note" => array("type" => "text", "not null" => "1"),
785 "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
786 "datetime" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
787 "blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
788 "ignore" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
791 "PRIMARY" => array("id"),
794 $database["item"] = array(
796 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
797 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
798 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
799 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
800 "contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
801 "gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
802 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
803 "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
804 "gravity" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
805 "parent" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
806 "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
807 "extid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
808 "thr-parent" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
809 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
810 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
811 "commented" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
812 "received" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
813 "changed" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
814 "owner-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
815 "owner-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
816 "owner-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
817 "author-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
818 "author-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
819 "author-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
820 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
821 "body" => array("type" => "mediumtext", "not null" => "1"),
822 "app" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
823 "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
824 "object-type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
825 "object" => array("type" => "text", "not null" => "1"),
826 "target-type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
827 "target" => array("type" => "text", "not null" => "1"),
828 "postopts" => array("type" => "text", "not null" => "1"),
829 "plink" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
830 "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
831 "event-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
832 "tag" => array("type" => "mediumtext", "not null" => "1"),
833 "attach" => array("type" => "mediumtext", "not null" => "1"),
834 "inform" => array("type" => "mediumtext", "not null" => "1"),
835 "file" => array("type" => "mediumtext", "not null" => "1"),
836 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
837 "coord" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
838 "allow_cid" => array("type" => "mediumtext", "not null" => "1"),
839 "allow_gid" => array("type" => "mediumtext", "not null" => "1"),
840 "deny_cid" => array("type" => "mediumtext", "not null" => "1"),
841 "deny_gid" => array("type" => "mediumtext", "not null" => "1"),
842 "private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
843 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
844 "moderated" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
845 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
846 "spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
847 "starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
848 "bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
849 "unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
850 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
851 "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
852 "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
853 "last-child" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "1"),
854 "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
855 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
856 "rendered-hash" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
857 "rendered-html" => array("type" => "mediumtext", "not null" => "1"),
858 "global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
861 "PRIMARY" => array("id"),
862 "guid" => array("guid"),
863 "uri" => array("uri"),
864 "parent" => array("parent"),
865 "parent-uri" => array("parent-uri"),
866 "extid" => array("extid"),
867 "uid_id" => array("uid","id"),
868 "uid_created" => array("uid","created"),
869 "uid_unseen" => array("uid","unseen"),
870 "uid_network_received" => array("uid","network","received"),
871 "uid_received" => array("uid","received"),
872 "uid_network_commented" => array("uid","network","commented"),
873 "uid_commented" => array("uid","commented"),
874 "uid_title" => array("uid","title"),
875 "uid_thrparent" => array("uid","thr-parent"),
876 "uid_parenturi" => array("uid","parent-uri"),
877 "uid_contactid_created" => array("uid","contact-id","created"),
878 "uid_gcontactid_created" => array("uid","gcontact-id","created"),
879 "wall_body" => array("wall","body(6)"),
880 "uid_visible_moderated_created" => array("uid","visible","moderated","created"),
881 "uid_uri" => array("uid","uri"),
882 "uid_wall_created" => array("uid","wall","created"),
883 "resource-id" => array("resource-id"),
884 "uid_type" => array("uid","type"),
885 "uid_starred" => array("uid","starred"),
886 "contactid_allowcid_allowpid_denycid_denygid" => array("contact-id","allow_cid(10)","allow_gid(10)","deny_cid(10)","deny_gid(10)"),
887 "uid_wall_parent_created" => array("uid","wall","parent","created"),
888 "uid_type_changed" => array("uid","type","changed"),
889 "contactid_verb" => array("contact-id","verb"),
890 "deleted_changed" => array("deleted","changed"),
891 "uid_wall_changed" => array("uid","wall","changed"),
892 "uid_eventid" => array("uid","event-id"),
893 "uid_authorlink" => array("uid","author-link"),
894 "uid_ownerlink" => array("uid","owner-link"),
897 $database["item_id"] = array(
899 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
900 "iid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
901 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
902 "sid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
903 "service" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
906 "PRIMARY" => array("id"),
907 "uid" => array("uid"),
908 "sid" => array("sid"),
909 "service" => array("service"),
910 "iid" => array("iid"),
913 $database["locks"] = array(
915 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
916 "name" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
917 "locked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
918 "created" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
921 "PRIMARY" => array("id"),
924 $database["mail"] = array(
926 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
927 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
928 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
929 "from-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
930 "from-photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
931 "from-url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
932 "contact-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
933 "convid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
934 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
935 "body" => array("type" => "mediumtext", "not null" => "1"),
936 "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
937 "reply" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
938 "replied" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
939 "unknown" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
940 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
941 "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
942 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
945 "PRIMARY" => array("id"),
946 "uid" => array("uid"),
947 "guid" => array("guid"),
948 "convid" => array("convid"),
949 "reply" => array("reply"),
950 "uri" => array("uri"),
951 "parent-uri" => array("parent-uri"),
954 $database["mailacct"] = array(
956 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
957 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
958 "server" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
959 "port" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
960 "ssltype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
961 "mailbox" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
962 "user" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
963 "pass" => array("type" => "text", "not null" => "1"),
964 "reply_to" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
965 "action" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
966 "movetofolder" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
967 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
968 "last_check" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
971 "PRIMARY" => array("id"),
974 $database["manage"] = array(
976 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
977 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
978 "mid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
981 "PRIMARY" => array("id"),
982 "uid_mid" => array("uid","mid"),
985 $database["notify"] = array(
987 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
988 "hash" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
989 "type" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
990 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
991 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
992 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
993 "date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
994 "msg" => array("type" => "mediumtext", "not null" => "1"),
995 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
996 "link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
997 "iid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
998 "parent" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
999 "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1000 "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1001 "otype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1004 "PRIMARY" => array("id"),
1005 "uid" => array("uid"),
1008 $database["notify-threads"] = array(
1010 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1011 "notify-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1012 "master-parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1013 "parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1014 "receiver-uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1017 "PRIMARY" => array("id"),
1018 "master-parent-item" => array("master-parent-item"),
1019 "receiver-uid" => array("receiver-uid"),
1022 $database["pconfig"] = array(
1024 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1025 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1026 "cat" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1027 "k" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1028 "v" => array("type" => "mediumtext", "not null" => "1"),
1031 "PRIMARY" => array("id"),
1032 "uid_cat_k" => array("uid","cat(30)","k(30)"),
1035 $database["photo"] = array(
1037 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1038 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1039 "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1040 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1041 "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1042 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1043 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1044 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1045 "desc" => array("type" => "text", "not null" => "1"),
1046 "album" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1047 "filename" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1048 "type" => array("type" => "varchar(128)", "not null" => "1", "default" => "image/jpeg"),
1049 "height" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
1050 "width" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
1051 "datasize" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1052 "data" => array("type" => "mediumblob", "not null" => "1"),
1053 "scale" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
1054 "profile" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1055 "allow_cid" => array("type" => "mediumtext", "not null" => "1"),
1056 "allow_gid" => array("type" => "mediumtext", "not null" => "1"),
1057 "deny_cid" => array("type" => "mediumtext", "not null" => "1"),
1058 "deny_gid" => array("type" => "mediumtext", "not null" => "1"),
1061 "PRIMARY" => array("id"),
1062 "uid" => array("uid"),
1063 "resource-id" => array("resource-id"),
1064 "guid" => array("guid"),
1067 $database["poll"] = array(
1069 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1070 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1071 "q0" => array("type" => "mediumtext", "not null" => "1"),
1072 "q1" => array("type" => "mediumtext", "not null" => "1"),
1073 "q2" => array("type" => "mediumtext", "not null" => "1"),
1074 "q3" => array("type" => "mediumtext", "not null" => "1"),
1075 "q4" => array("type" => "mediumtext", "not null" => "1"),
1076 "q5" => array("type" => "mediumtext", "not null" => "1"),
1077 "q6" => array("type" => "mediumtext", "not null" => "1"),
1078 "q7" => array("type" => "mediumtext", "not null" => "1"),
1079 "q8" => array("type" => "mediumtext", "not null" => "1"),
1080 "q9" => array("type" => "mediumtext", "not null" => "1"),
1083 "PRIMARY" => array("id"),
1084 "uid" => array("uid"),
1087 $database["poll_result"] = array(
1089 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1090 "poll_id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1091 "choice" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1094 "PRIMARY" => array("id"),
1095 "poll_id" => array("poll_id"),
1096 "choice" => array("choice"),
1099 $database["profile"] = 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 "profile-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1104 "is-default" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1105 "hide-friends" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1106 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1107 "pdesc" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1108 "dob" => array("type" => "varchar(32)", "not null" => "1", "default" => "0000-00-00"),
1109 "address" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1110 "locality" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1111 "region" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1112 "postal-code" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1113 "country-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1114 "hometown" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1115 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1116 "marital" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1117 "with" => array("type" => "text", "not null" => "1"),
1118 "howlong" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1119 "sexual" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1120 "politic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1121 "religion" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1122 "pub_keywords" => array("type" => "text", "not null" => "1"),
1123 "prv_keywords" => array("type" => "text", "not null" => "1"),
1124 "likes" => array("type" => "text", "not null" => "1"),
1125 "dislikes" => array("type" => "text", "not null" => "1"),
1126 "about" => array("type" => "text", "not null" => "1"),
1127 "summary" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1128 "music" => array("type" => "text", "not null" => "1"),
1129 "book" => array("type" => "text", "not null" => "1"),
1130 "tv" => array("type" => "text", "not null" => "1"),
1131 "film" => array("type" => "text", "not null" => "1"),
1132 "interest" => array("type" => "text", "not null" => "1"),
1133 "romance" => array("type" => "text", "not null" => "1"),
1134 "work" => array("type" => "text", "not null" => "1"),
1135 "education" => array("type" => "text", "not null" => "1"),
1136 "contact" => array("type" => "text", "not null" => "1"),
1137 "homepage" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1138 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1139 "thumb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1140 "publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1141 "net-publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1144 "PRIMARY" => array("id"),
1145 "hometown" => array("hometown"),
1148 $database["profile_check"] = array(
1150 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1151 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1152 "cid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1153 "dfrn_id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1154 "sec" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1155 "expire" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1158 "PRIMARY" => array("id"),
1161 $database["push_subscriber"] = array(
1163 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1164 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1165 "callback_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1166 "topic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1167 "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1168 "push" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1169 "last_update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1170 "secret" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1173 "PRIMARY" => array("id"),
1176 $database["queue"] = array(
1178 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1179 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1180 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1181 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1182 "last" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1183 "content" => array("type" => "mediumtext", "not null" => "1"),
1184 "batch" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1187 "PRIMARY" => array("id"),
1188 "cid" => array("cid"),
1189 "created" => array("created"),
1190 "last" => array("last"),
1191 "network" => array("network"),
1192 "batch" => array("batch"),
1195 $database["register"] = array(
1197 "id" => array("type" => "int(11) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1198 "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1199 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1200 "uid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1201 "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1202 "language" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1205 "PRIMARY" => array("id"),
1208 $database["search"] = array(
1210 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1211 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1212 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1215 "PRIMARY" => array("id"),
1216 "uid" => array("uid"),
1217 "term" => array("term"),
1220 $database["session"] = array(
1222 "id" => array("type" => "bigint(20) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1223 "sid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1224 "data" => array("type" => "text", "not null" => "1"),
1225 "expire" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1228 "PRIMARY" => array("id"),
1229 "sid" => array("sid"),
1230 "expire" => array("expire"),
1233 $database["sign"] = array(
1235 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1236 "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1237 "retract_iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1238 "signed_text" => array("type" => "mediumtext", "not null" => "1"),
1239 "signature" => array("type" => "text", "not null" => "1"),
1240 "signer" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1243 "PRIMARY" => array("id"),
1244 "iid" => array("iid"),
1245 "retract_iid" => array("retract_iid"),
1248 $database["spam"] = array(
1250 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1251 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1252 "spam" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1253 "ham" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1254 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1255 "date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1258 "PRIMARY" => array("id"),
1259 "uid" => array("uid"),
1260 "spam" => array("spam"),
1261 "ham" => array("ham"),
1262 "term" => array("term"),
1265 $database["term"] = array(
1267 "tid" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1268 "oid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1269 "otype" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1270 "type" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1271 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1272 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1273 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1274 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1275 "received" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1276 "global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1277 "aid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1278 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1281 "PRIMARY" => array("tid"),
1282 "oid_otype_type_term" => array("oid","otype","type","term"),
1283 "uid_term_tid" => array("uid","term","tid"),
1284 "type_term" => array("type","term"),
1285 "uid_otype_type_term_global_created" => array("uid","otype","type","term","global","created"),
1286 "otype_type_term_tid" => array("otype","type","term","tid"),
1287 "guid" => array("guid"),
1290 $database["thread"] = array(
1292 "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "primary" => "1"),
1293 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1294 "contact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1295 "gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1296 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1297 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1298 "commented" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1299 "received" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1300 "changed" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1301 "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1302 "private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1303 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1304 "moderated" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1305 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1306 "spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1307 "starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1308 "ignored" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1309 "bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1310 "unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
1311 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1312 "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1313 "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1314 "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1315 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1318 "PRIMARY" => array("iid"),
1319 "created" => array("created"),
1320 "commented" => array("commented"),
1321 "uid_network_commented" => array("uid","network","commented"),
1322 "uid_network_created" => array("uid","network","created"),
1323 "uid_contactid_commented" => array("uid","contact-id","commented"),
1324 "uid_contactid_created" => array("uid","contact-id","created"),
1325 "wall_private_received" => array("wall","private","received"),
1326 "uid_created" => array("uid","created"),
1327 "uid_commented" => array("uid","commented"),
1330 $database["tokens"] = array(
1332 "id" => array("type" => "varchar(40)", "not null" => "1", "primary" => "1"),
1333 "secret" => array("type" => "text", "not null" => "1"),
1334 "client_id" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
1335 "expires" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1336 "scope" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
1337 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1340 "PRIMARY" => array("id"),
1343 $database["unique_contacts"] = array(
1345 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1346 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1347 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1348 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1349 "avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1350 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1351 "about" => array("type" => "text", "not null" => "1"),
1354 "PRIMARY" => array("id"),
1355 "url" => array("url"),
1358 $database["user"] = array(
1360 "uid" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1361 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1362 "username" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1363 "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1364 "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1365 "email" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1366 "openid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1367 "timezone" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
1368 "language" => array("type" => "varchar(32)", "not null" => "1", "default" => "en"),
1369 "register_date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1370 "login_date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1371 "default-location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1372 "allow_location" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1373 "theme" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1374 "pubkey" => array("type" => "text", "not null" => "1"),
1375 "prvkey" => array("type" => "text", "not null" => "1"),
1376 "spubkey" => array("type" => "text", "not null" => "1"),
1377 "sprvkey" => array("type" => "text", "not null" => "1"),
1378 "verified" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1379 "blocked" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1380 "blockwall" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1381 "hidewall" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1382 "blocktags" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1383 "unkmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1384 "cntunkmail" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
1385 "notify-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "65535"),
1386 "page-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1387 "prvnets" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1388 "pwdreset" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1389 "maxreq" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
1390 "expire" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1391 "account_removed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1392 "account_expired" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1393 "account_expires_on" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1394 "expire_notification_sent" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1395 "service_class" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1396 "def_gid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1397 "allow_cid" => array("type" => "mediumtext", "not null" => "1"),
1398 "allow_gid" => array("type" => "mediumtext", "not null" => "1"),
1399 "deny_cid" => array("type" => "mediumtext", "not null" => "1"),
1400 "deny_gid" => array("type" => "mediumtext", "not null" => "1"),
1401 "openidserver" => array("type" => "text", "not null" => "1"),
1404 "PRIMARY" => array("uid"),
1405 "nickname" => array("nickname"),
1408 $database["userd"] = array(
1410 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1411 "username" => array("type" => "varchar(255)", "not null" => "1"),
1414 "PRIMARY" => array("id"),
1415 "username" => array("username"),
1418 $database["workerqueue"] = array(
1420 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1421 "parameter" => array("type" => "text", "not null" => "1"),
1422 "priority" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1423 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1424 "pid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1425 "executed" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1428 "PRIMARY" => array("id"),
1429 "created" => array("created"),
1438 * run from command line
1440 function dbstructure_run(&$argv, &$argc) {
1448 @include(".htconfig.php");
1449 require_once("include/dba.php");
1450 $db = new dba($db_host, $db_user, $db_pass, $db_data);
1451 unset($db_host, $db_user, $db_pass, $db_data);
1457 update_structure(true, true);
1460 print_structure(db_definition());
1467 echo $argv[0]." <command>\n";
1470 echo "update update database schema\n";
1471 echo "dumpsql dump database schema\n";
1479 if (array_search(__file__,get_included_files())===0){
1480 dbstructure_run($_SERVER["argv"],$_SERVER["argc"]);