Browse Source

Merge develop into 20170316_-_fix_event_edit

Conflicts:
	mod/events.php
tags/3.5.2
rabuzarus 3 years ago
parent
commit
0060e2449e
51 changed files with 6019 additions and 6390 deletions
  1. +24
    -91
      boot.php
  2. +64
    -74
      database.sql
  3. +3
    -3
      include/Contact.php
  4. +0
    -22
      include/create_shadowentry.php
  5. +21
    -88
      include/cron.php
  6. +5
    -37
      include/cronhooks.php
  7. +1
    -36
      include/cronjobs.php
  8. +1
    -1
      include/datetime.php
  9. +4
    -2
      include/dba.php
  10. +4
    -31
      include/dbclean.php
  11. +2
    -9
      include/dbm.php
  12. +72
    -78
      include/dbstructure.php
  13. +2
    -22
      include/dbupdate.php
  14. +5
    -53
      include/delivery.php
  15. +1
    -1
      include/dfrn.php
  16. +7
    -32
      include/directory.php
  17. +94
    -68
      include/discover_poco.php
  18. +1
    -25
      include/expire.php
  19. +3
    -30
      include/gprobe.php
  20. +1
    -1
      include/identity.php
  21. +2
    -1
      include/lock.php
  22. +3
    -2
      include/network.php
  23. +7
    -104
      include/notifier.php
  24. +4
    -35
      include/onepoll.php
  25. +36
    -25
      include/poller.php
  26. +24
    -72
      include/pubsubpublish.php
  27. +100
    -163
      include/queue.php
  28. +0
    -22
      include/remove_contact.php
  29. +1
    -1
      include/security.php
  30. +19
    -13
      include/shadowupdate.php
  31. +459
    -53
      include/socgraph.php
  32. +1
    -20
      include/spool_post.php
  33. +2
    -20
      include/tagupdate.php
  34. +3
    -3
      include/text.php
  35. +3
    -21
      include/threadupdate.php
  36. +2
    -2
      include/uimport.php
  37. +5
    -33
      include/update_gcontact.php
  38. +1
    -1
      library/Smarty/libs/plugins/modifier.date_format.php
  39. +181
    -175
      mod/admin.php
  40. +6
    -6
      mod/contacts.php
  41. +13
    -1
      mod/maintenance.php
  42. +121
    -91
      mod/poco.php
  43. +5
    -5
      mod/profiles.php
  44. +1
    -1
      mod/settings.php
  45. +1
    -1
      mod/worker.php
  46. +23
    -23
      update.php
  47. +37
    -8
      util/maintenance.php
  48. +4637
    -4770
      util/messages.po
  49. +4
    -12
      view/templates/admin_site.tpl
  50. +1
    -1
      view/templates/admin_summary.tpl
  51. +2
    -1
      view/templates/maintenance.tpl

+ 24
- 91
boot.php View File

@@ -32,7 +32,6 @@ require_once('include/cache.php');
require_once('library/Mobile_Detect/Mobile_Detect.php');
require_once('include/features.php');
require_once('include/identity.php');
require_once('include/pidfile.php');
require_once('update.php');
require_once('include/dbstructure.php');

@@ -40,7 +39,7 @@ define ( 'FRIENDICA_PLATFORM', 'Friendica');
define ( 'FRIENDICA_CODENAME', 'Asparagus');
define ( 'FRIENDICA_VERSION', '3.5.2-dev' );
define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
define ( 'DB_UPDATE_VERSION', 1215 );
define ( 'DB_UPDATE_VERSION', 1216 );

/**
* @brief Constant with a HTML line break.
@@ -442,10 +441,17 @@ define('SR_SCOPE_ALL', 'all');
define('SR_SCOPE_TAGS', 'tags');
/* @}*/

/**
* Lowest possible date time value
*/

define ('NULL_DATE', '0001-01-01 00:00:00');


// Normally this constant is defined - but not if "pcntl" isn't installed
if (!defined("SIGTERM"))
if (!defined("SIGTERM")) {
define("SIGTERM", 15);

}
/**
*
* Reverse the effect of magic_quotes_gpc if it is enabled.
@@ -1346,60 +1352,25 @@ class App {
return false;
}

/**
* @brief Checks if the process is already running
*
* @param string $taskname The name of the task that will be used for the name of the lockfile
* @param string $task The path and name of the php script
* @param int $timeout The timeout after which a task should be killed
*
* @return bool Is the process running?
*/
function is_already_running($taskname, $task = "", $timeout = 540) {

$lockpath = get_lockpath();
if ($lockpath != '') {
$pidfile = new pidfile($lockpath, $taskname);
if ($pidfile->is_already_running()) {
logger("Already running");
if ($pidfile->running_time() > $timeout) {
$pidfile->kill();
logger("killed stale process");
// Calling a new instance
if ($task != "")
proc_run(PRIORITY_MEDIUM, $task);
}
return true;
}
}
return false;
}

function proc_run($args) {

if (!function_exists("proc_open")) {
return;
}

// Add the php path if it is a php call
if (count($args) && ($args[0] === 'php' OR !is_string($args[0]))) {

// If the last worker fork was less than 10 seconds before then don't fork another one.
// This should prevent the forking of masses of workers.
if (get_config("system", "worker")) {
$cachekey = "app:proc_run:started";
$result = Cache::get($cachekey);
if (!is_null($result)) {
if ((time() - $result) < 10) {
return;
}
}
// Set the timestamp of the last proc_run
Cache::set($cachekey, time(), CACHE_MINUTE);
// If the last worker fork was less than 10 seconds before then don't fork another one.
// This should prevent the forking of masses of workers.
$cachekey = "app:proc_run:started";
$result = Cache::get($cachekey);
if (!is_null($result)) {
if ((time() - $result) < 10) {
return;
}

$args[0] = ((x($this->config,'php_path')) && (strlen($this->config['php_path'])) ? $this->config['php_path'] : 'php');
}
// Set the timestamp of the last proc_run
Cache::set($cachekey, time(), CACHE_MINUTE);

array_unshift($args, ((x($this->config,'php_path')) && (strlen($this->config['php_path'])) ? $this->config['php_path'] : 'php'));

// add baseurl to args. cli scripts can't construct it
$args[] = $this->get_baseurl();
@@ -1976,10 +1947,9 @@ function get_max_import_size() {
* @brief Wrap calls to proc_close(proc_open()) and call hook
* so plugins can take part in process :)
*
* @param (string|integer|array) $cmd program to run, priority or parameter array
* @param (integer|array) priority or parameter array, $cmd atrings are deprecated and are ignored
*
* next args are passed as $cmd command line
* e.g.: proc_run("ls","-la","/tmp");
* or: proc_run(PRIORITY_HIGH, "include/notifier.php", "drop", $drop_id);
* or: proc_run(array('priority' => PRIORITY_HIGH, 'dont_fork' => true), "include/create_shadowentry.php", $post_id);
*
@@ -2024,11 +1994,6 @@ function proc_run($cmd){
if (!$arr['run_cmd'] OR !count($args))
return;

if (!get_config("system", "worker") OR (is_string($run_parameter) AND ($run_parameter != 'php'))) {
$a->proc_run($args);
return;
}

$priority = PRIORITY_MEDIUM;
$dont_fork = get_config("system", "worker_dont_fork");

@@ -2063,7 +2028,7 @@ function proc_run($cmd){
}

// Checking number of workers
$workers = q("SELECT COUNT(*) AS `workers` FROM `workerqueue` WHERE `executed` != '0000-00-00 00:00:00'");
$workers = q("SELECT COUNT(*) AS `workers` FROM `workerqueue` WHERE `executed` > '%s'", dbesc(NULL_DATE));

// Get number of allowed number of worker threads
$queues = intval(get_config("system", "worker_queues"));
@@ -2076,7 +2041,7 @@ function proc_run($cmd){
return;

// Now call the poller to execute the jobs that we just added to the queue
$args = array("php", "include/poller.php", "no_cron");
$args = array("include/poller.php", "no_cron");

$a->proc_run($args);
}
@@ -2410,38 +2375,6 @@ function get_itemcachepath() {
return "";
}

function get_lockpath() {
$lockpath = get_config('system','lockpath');
if (($lockpath != "") AND App::directory_usable($lockpath)) {
// We have a lock path and it is usable
return $lockpath;
}

// We don't have a working preconfigured lock path, so we take the temp path.
$temppath = get_temppath();

if ($temppath != "") {
// To avoid any interferences with other systems we create our own directory
$lockpath = $temppath."/lock";
if (!is_dir($lockpath)) {
mkdir($lockpath);
}

if (App::directory_usable($lockpath)) {
// The new path is usable, we are happy
set_config("system", "lockpath", $lockpath);
return $lockpath;
} else {
// We can't create a subdirectory, strange.
// But the directory seems to work, so we use it but don't store it.
return $temppath;
}
}

// Reaching this point means that the operating system is configured badly.
return "";
}

/**
* @brief Returns the path where spool files are stored
*


+ 64
- 74
database.sql View File

@@ -1,5 +1,5 @@
-- ------------------------------------------
-- Friendica 3.5.2-dev (Asparagus)
-- DB_UPDATE_VERSION 1215
-- ------------------------------------------

@@ -30,8 +30,8 @@ CREATE TABLE IF NOT EXISTS `attach` (
`filetype` varchar(64) NOT NULL DEFAULT '',
`filesize` int(11) NOT NULL DEFAULT 0,
`data` longblob NOT NULL,
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`edited` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`allow_cid` mediumtext,
`allow_gid` mediumtext,
`deny_cid` mediumtext,
@@ -58,7 +58,7 @@ CREATE TABLE IF NOT EXISTS `cache` (
`k` varbinary(255) NOT NULL,
`v` mediumtext,
`expire_mode` int(11) NOT NULL DEFAULT 0,
`updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
PRIMARY KEY(`k`),
INDEX `expire_mode_updated` (`expire_mode`,`updated`)
) DEFAULT CHARSET=utf8mb4;
@@ -107,7 +107,7 @@ CREATE TABLE IF NOT EXISTS `config` (
CREATE TABLE IF NOT EXISTS `contact` (
`id` int(11) NOT NULL auto_increment,
`uid` int(11) NOT NULL DEFAULT 0,
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`self` tinyint(1) NOT NULL DEFAULT 0,
`remote_self` tinyint(1) NOT NULL DEFAULT 0,
`rel` tinyint(1) NOT NULL DEFAULT 0,
@@ -145,14 +145,14 @@ CREATE TABLE IF NOT EXISTS `contact` (
`usehub` tinyint(1) NOT NULL DEFAULT 0,
`subhub` tinyint(1) NOT NULL DEFAULT 0,
`hub-verify` varchar(255) NOT NULL DEFAULT '',
`last-update` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`success_update` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`failure_update` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`name-date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`uri-date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`avatar-date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`term-date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`last-item` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`last-update` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`success_update` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`failure_update` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`name-date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`uri-date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`avatar-date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`term-date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`last-item` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`priority` tinyint(3) NOT NULL DEFAULT 0,
`blocked` tinyint(1) NOT NULL DEFAULT 1,
`readonly` tinyint(1) NOT NULL DEFAULT 0,
@@ -197,25 +197,13 @@ CREATE TABLE IF NOT EXISTS `conv` (
`recips` text,
`uid` int(11) NOT NULL DEFAULT 0,
`creator` varchar(255) NOT NULL DEFAULT '',
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`subject` text,
PRIMARY KEY(`id`),
INDEX `uid` (`uid`)
) DEFAULT CHARSET=utf8mb4;

--
--
CREATE TABLE IF NOT EXISTS `deliverq` (
`id` int(10) unsigned NOT NULL auto_increment,
`cmd` varbinary(32) NOT NULL DEFAULT '',
`item` int(11) NOT NULL DEFAULT 0,
`contact` int(11) NOT NULL DEFAULT 0,
PRIMARY KEY(`id`),
UNIQUE INDEX `cmd_item_contact` (`cmd`,`item`,`contact`)
) DEFAULT CHARSET=utf8mb4;

--
-- TABLE event
--
@@ -225,10 +213,10 @@ CREATE TABLE IF NOT EXISTS `event` (
`uid` int(11) NOT NULL DEFAULT 0,
`cid` int(11) NOT NULL DEFAULT 0,
`uri` varchar(255) NOT NULL DEFAULT '',
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`edited` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`start` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`finish` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`start` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`finish` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`summary` text,
`desc` text,
`location` text,
@@ -264,7 +252,7 @@ CREATE TABLE IF NOT EXISTS `fcontact` (
`network` varchar(32) NOT NULL DEFAULT '',
`alias` varchar(255) NOT NULL DEFAULT '',
`pubkey` text,
`updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
PRIMARY KEY(`id`),
INDEX `addr` (`addr`(32)),
INDEX `url` (`url`)
@@ -305,7 +293,7 @@ CREATE TABLE IF NOT EXISTS `fsuggest` (
`request` varchar(255) NOT NULL DEFAULT '',
`photo` varchar(255) NOT NULL DEFAULT '',
`note` text,
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
PRIMARY KEY(`id`)
) DEFAULT CHARSET=utf8mb4;

@@ -332,10 +320,10 @@ CREATE TABLE IF NOT EXISTS `gcontact` (
`nurl` varchar(255) NOT NULL DEFAULT '',
`photo` varchar(255) NOT NULL DEFAULT '',
`connect` varchar(255) NOT NULL DEFAULT '',
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`updated` datetime DEFAULT '0000-00-00 00:00:00',
`last_contact` datetime DEFAULT '0000-00-00 00:00:00',
`last_failure` datetime DEFAULT '0000-00-00 00:00:00',
`created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`updated` datetime DEFAULT '0001-01-01 00:00:00',
`last_contact` datetime DEFAULT '0001-01-01 00:00:00',
`last_failure` datetime DEFAULT '0001-01-01 00:00:00',
`location` varchar(255) NOT NULL DEFAULT '',
`about` text,
`keywords` text,
@@ -369,7 +357,7 @@ CREATE TABLE IF NOT EXISTS `glink` (
`uid` int(11) NOT NULL DEFAULT 0,
`gcid` int(11) NOT NULL DEFAULT 0,
`zcid` int(11) NOT NULL DEFAULT 0,
`updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
PRIMARY KEY(`id`),
UNIQUE INDEX `cid_uid_gcid_zcid` (`cid`,`uid`,`gcid`,`zcid`),
INDEX `gcid` (`gcid`)
@@ -417,10 +405,10 @@ CREATE TABLE IF NOT EXISTS `gserver` (
`noscrape` varchar(255) NOT NULL DEFAULT '',
`network` varchar(32) NOT NULL DEFAULT '',
`platform` varchar(255) NOT NULL DEFAULT '',
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`last_poco_query` datetime DEFAULT '0000-00-00 00:00:00',
`last_contact` datetime DEFAULT '0000-00-00 00:00:00',
`last_failure` datetime DEFAULT '0000-00-00 00:00:00',
`created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`last_poco_query` datetime DEFAULT '0001-01-01 00:00:00',
`last_contact` datetime DEFAULT '0001-01-01 00:00:00',
`last_failure` datetime DEFAULT '0001-01-01 00:00:00',
PRIMARY KEY(`id`),
INDEX `nurl` (`nurl`(32))
) DEFAULT CHARSET=utf8mb4;
@@ -450,7 +438,7 @@ CREATE TABLE IF NOT EXISTS `intro` (
`duplex` tinyint(1) NOT NULL DEFAULT 0,
`note` text,
`hash` varchar(255) NOT NULL DEFAULT '',
`datetime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`datetime` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`blocked` tinyint(1) NOT NULL DEFAULT 1,
`ignore` tinyint(1) NOT NULL DEFAULT 0,
PRIMARY KEY(`id`)
@@ -473,11 +461,11 @@ CREATE TABLE IF NOT EXISTS `item` (
`parent-uri` varchar(255) NOT NULL DEFAULT '',
`extid` varchar(255) NOT NULL DEFAULT '',
`thr-parent` varchar(255) NOT NULL DEFAULT '',
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`edited` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`commented` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`received` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`changed` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`commented` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`changed` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`owner-id` int(11) NOT NULL DEFAULT 0,
`owner-name` varchar(255) NOT NULL DEFAULT '',
`owner-link` varchar(255) NOT NULL DEFAULT '',
@@ -576,7 +564,7 @@ CREATE TABLE IF NOT EXISTS `locks` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(128) NOT NULL DEFAULT '',
`locked` tinyint(1) NOT NULL DEFAULT 0,
`created` datetime DEFAULT '0000-00-00 00:00:00',
`created` datetime DEFAULT '0001-01-01 00:00:00',
PRIMARY KEY(`id`)
) DEFAULT CHARSET=utf8mb4;

@@ -600,7 +588,7 @@ CREATE TABLE IF NOT EXISTS `mail` (
`unknown` tinyint(1) NOT NULL DEFAULT 0,
`uri` varchar(255) NOT NULL DEFAULT '',
`parent-uri` varchar(255) NOT NULL DEFAULT '',
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
PRIMARY KEY(`id`),
INDEX `uid_seen` (`uid`,`seen`),
INDEX `convid` (`convid`),
@@ -624,7 +612,7 @@ CREATE TABLE IF NOT EXISTS `mailacct` (
`action` int(11) NOT NULL DEFAULT 0,
`movetofolder` varchar(255) NOT NULL DEFAULT '',
`pubmail` tinyint(1) NOT NULL DEFAULT 0,
`last_check` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`last_check` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
PRIMARY KEY(`id`)
) DEFAULT CHARSET=utf8mb4;

@@ -649,7 +637,7 @@ CREATE TABLE IF NOT EXISTS `notify` (
`name` varchar(255) NOT NULL DEFAULT '',
`url` varchar(255) NOT NULL DEFAULT '',
`photo` varchar(255) NOT NULL DEFAULT '',
`date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`msg` mediumtext,
`uid` int(11) NOT NULL DEFAULT 0,
`link` varchar(255) NOT NULL DEFAULT '',
@@ -685,7 +673,7 @@ CREATE TABLE IF NOT EXISTS `notify-threads` (
CREATE TABLE IF NOT EXISTS `oembed` (
`url` varbinary(255) NOT NULL,
`content` mediumtext,
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
PRIMARY KEY(`url`),
INDEX `created` (`created`)
) DEFAULT CHARSET=utf8mb4;
@@ -698,7 +686,7 @@ CREATE TABLE IF NOT EXISTS `parsed_url` (
`guessing` tinyint(1) NOT NULL DEFAULT 0,
`oembed` tinyint(1) NOT NULL DEFAULT 0,
`content` mediumtext,
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
PRIMARY KEY(`url`,`guessing`,`oembed`),
INDEX `created` (`created`)
) DEFAULT CHARSET=utf8mb4;
@@ -725,8 +713,8 @@ CREATE TABLE IF NOT EXISTS `photo` (
`contact-id` int(10) unsigned NOT NULL DEFAULT 0,
`guid` varchar(64) NOT NULL DEFAULT '',
`resource-id` varchar(255) NOT NULL DEFAULT '',
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`edited` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`title` varchar(255) NOT NULL DEFAULT '',
`desc` text,
`album` varchar(255) NOT NULL DEFAULT '',
@@ -788,7 +776,7 @@ CREATE TABLE IF NOT EXISTS `poll_result` (
CREATE TABLE IF NOT EXISTS `process` (
`pid` int(10) unsigned NOT NULL,
`command` varbinary(32) NOT NULL DEFAULT '',
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
PRIMARY KEY(`pid`),
INDEX `command` (`command`)
) DEFAULT CHARSET=utf8mb4;
@@ -814,7 +802,7 @@ CREATE TABLE IF NOT EXISTS `profile` (
`gender` varchar(32) NOT NULL DEFAULT '',
`marital` varchar(255) NOT NULL DEFAULT '',
`with` text,
`howlong` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`howlong` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`sexual` varchar(255) NOT NULL DEFAULT '',
`politic` varchar(255) NOT NULL DEFAULT '',
`religion` varchar(255) NOT NULL DEFAULT '',
@@ -866,7 +854,7 @@ CREATE TABLE IF NOT EXISTS `push_subscriber` (
`topic` varchar(255) NOT NULL DEFAULT '',
`nickname` varchar(255) NOT NULL DEFAULT '',
`push` int(11) NOT NULL DEFAULT 0,
`last_update` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`last_update` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`secret` varchar(255) NOT NULL DEFAULT '',
PRIMARY KEY(`id`)
) DEFAULT CHARSET=utf8mb4;
@@ -878,8 +866,8 @@ CREATE TABLE IF NOT EXISTS `queue` (
`id` int(11) NOT NULL auto_increment,
`cid` int(11) NOT NULL DEFAULT 0,
`network` varchar(32) NOT NULL DEFAULT '',
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`last` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`last` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`content` mediumtext,
`batch` tinyint(1) NOT NULL DEFAULT 0,
PRIMARY KEY(`id`),
@@ -896,7 +884,7 @@ CREATE TABLE IF NOT EXISTS `queue` (
CREATE TABLE IF NOT EXISTS `register` (
`id` int(11) unsigned NOT NULL auto_increment,
`hash` varchar(255) NOT NULL DEFAULT '',
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`uid` int(11) unsigned NOT NULL DEFAULT 0,
`password` varchar(255) NOT NULL DEFAULT '',
`language` varchar(16) NOT NULL DEFAULT '',
@@ -950,7 +938,7 @@ CREATE TABLE IF NOT EXISTS `spam` (
`spam` int(11) NOT NULL DEFAULT 0,
`ham` int(11) NOT NULL DEFAULT 0,
`term` varchar(255) NOT NULL DEFAULT '',
`date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
PRIMARY KEY(`id`),
INDEX `uid` (`uid`),
INDEX `spam` (`spam`),
@@ -969,8 +957,8 @@ CREATE TABLE IF NOT EXISTS `term` (
`term` varchar(255) NOT NULL DEFAULT '',
`url` varchar(255) NOT NULL DEFAULT '',
`guid` varchar(255) NOT NULL DEFAULT '',
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`received` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`global` tinyint(1) NOT NULL DEFAULT 0,
`aid` int(10) unsigned NOT NULL DEFAULT 0,
`uid` int(10) unsigned NOT NULL DEFAULT 0,
@@ -991,11 +979,11 @@ CREATE TABLE IF NOT EXISTS `thread` (
`gcontact-id` int(11) unsigned NOT NULL DEFAULT 0,
`owner-id` int(11) unsigned NOT NULL DEFAULT 0,
`author-id` int(11) unsigned NOT NULL DEFAULT 0,
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`edited` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`commented` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`received` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`changed` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`commented` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`changed` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`wall` tinyint(1) NOT NULL DEFAULT 0,
`private` tinyint(1) NOT NULL DEFAULT 0,
`pubmail` tinyint(1) NOT NULL DEFAULT 0,
@@ -1047,8 +1035,8 @@ CREATE TABLE IF NOT EXISTS `user` (
`openid` varchar(255) NOT NULL DEFAULT '',
`timezone` varchar(128) NOT NULL DEFAULT '',
`language` varchar(32) NOT NULL DEFAULT 'en',
`register_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`login_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`register_date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`login_date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`default-location` varchar(255) NOT NULL DEFAULT '',
`allow_location` tinyint(1) NOT NULL DEFAULT 0,
`theme` varchar(255) NOT NULL DEFAULT '',
@@ -1072,8 +1060,8 @@ CREATE TABLE IF NOT EXISTS `user` (
`expire` int(11) unsigned NOT NULL DEFAULT 0,
`account_removed` tinyint(1) NOT NULL DEFAULT 0,
`account_expired` tinyint(1) NOT NULL DEFAULT 0,
`account_expires_on` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`expire_notification_sent` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`account_expires_on` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`expire_notification_sent` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`service_class` varchar(32) NOT NULL DEFAULT '',
`def_gid` int(11) NOT NULL DEFAULT 0,
`allow_cid` mediumtext,
@@ -1102,9 +1090,9 @@ CREATE TABLE IF NOT EXISTS `workerqueue` (
`id` int(11) NOT NULL auto_increment,
`parameter` text,
`priority` tinyint(3) unsigned NOT NULL DEFAULT 0,
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`pid` int(11) NOT NULL DEFAULT 0,
`executed` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`executed` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
PRIMARY KEY(`id`)
) DEFAULT CHARSET=utf8mb4;


+ 3
- 3
include/Contact.php View File

@@ -127,7 +127,7 @@ function mark_for_death($contact) {
if($contact['archive'])
return;

if($contact['term-date'] == '0000-00-00 00:00:00') {
if ($contact['term-date'] <= NULL_DATE) {
q("UPDATE `contact` SET `term-date` = '%s' WHERE `id` = %d",
dbesc(datetime_convert()),
intval($contact['id'])
@@ -185,13 +185,13 @@ function unmark_for_death($contact) {

// It's a miracle. Our dead contact has inexplicably come back to life.
q("UPDATE `contact` SET `term-date` = '%s' WHERE `id` = %d",
dbesc('0000-00-00 00:00:00'),
dbesc(NULL_DATE),
intval($contact['id'])
);

if ($contact['url'] != '') {
q("UPDATE `contact` SET `term-date` = '%s' WHERE `nurl` = '%s'",
dbesc('0000-00-00 00:00:00'),
dbesc(NULL_DATE),
dbesc(normalise_link($contact['url']))
);
}


+ 0
- 22
include/create_shadowentry.php View File

@@ -6,26 +6,9 @@
* This script is started from mod/item.php to save some time when doing a post.
*/

use \Friendica\Core\Config;

require_once("boot.php");
require_once("include/threads.php");

function create_shadowentry_run($argv, $argc) {
global $a, $db;

if (is_null($a))
$a = new App;

if (is_null($db)) {
@include(".htconfig.php");
require_once("include/dba.php");
$db = new dba($db_host, $db_user, $db_pass, $db_data);
unset($db_host, $db_user, $db_pass, $db_data);
}

Config::load();

if ($argc != 2) {
return;
}
@@ -34,9 +17,4 @@ function create_shadowentry_run($argv, $argc) {

add_shadow_entry($message_id);
}

if (array_search(__file__,get_included_files())===0){
create_shadowentry_run($_SERVER["argv"],$_SERVER["argc"]);
killme();
}
?>

+ 21
- 88
include/cron.php View File

@@ -1,35 +1,11 @@
<?php
if (!file_exists("boot.php") AND (sizeof($_SERVER["argv"]) != 0)) {
$directory = dirname($_SERVER["argv"][0]);

if (substr($directory, 0, 1) != "/")
$directory = $_SERVER["PWD"]."/".$directory;

$directory = realpath($directory."/..");

chdir($directory);
}

use \Friendica\Core\Config;

require_once("boot.php");
require_once("include/photos.php");
require_once("include/user.php");

require_once('include/photos.php');
require_once('include/user.php');

function cron_run(&$argv, &$argc){
global $a, $db;

if(is_null($a)) {
$a = new App;
}

if(is_null($db)) {
@include(".htconfig.php");
require_once("include/dba.php");
$db = new dba($db_host, $db_user, $db_pass, $db_data);
unset($db_host, $db_user, $db_pass, $db_data);
};
global $a;

require_once('include/session.php');
require_once('include/datetime.php');
@@ -40,16 +16,6 @@ function cron_run(&$argv, &$argc){
require_once('mod/nodeinfo.php');
require_once('include/post_update.php');

Config::load();

// Don't check this stuff if the function is called by the poller
if (App::callstack() != "poller_run") {
if ($a->maxload_reached())
return;
if (App::is_already_running('cron', 'include/cron.php', 540))
return;
}

$last = get_config('system','last_cron');

$poll_interval = intval(get_config('system','cron_interval'));
@@ -64,10 +30,6 @@ function cron_run(&$argv, &$argc){
}
}

$a->set_baseurl(get_config('system','url'));

load_hooks();

logger('cron: start');

// run queue delivery process in the background
@@ -85,34 +47,17 @@ function cron_run(&$argv, &$argc){
// Expire and remove user entries
cron_expire_and_remove_users();

// If the worker is active, split the jobs in several sub processes
if (get_config("system", "worker")) {
// Check OStatus conversations
proc_run(PRIORITY_MEDIUM, "include/cronjobs.php", "ostatus_mentions");

// Check every conversation
proc_run(PRIORITY_MEDIUM, "include/cronjobs.php", "ostatus_conversations");

// Call possible post update functions
proc_run(PRIORITY_LOW, "include/cronjobs.php", "post_update");
// Check OStatus conversations
proc_run(PRIORITY_MEDIUM, "include/cronjobs.php", "ostatus_mentions");

// update nodeinfo data
proc_run(PRIORITY_LOW, "include/cronjobs.php", "nodeinfo");
} else {
// Check OStatus conversations
// Check only conversations with mentions (for a longer time)
ostatus::check_conversations(true);
// Check every conversation
proc_run(PRIORITY_MEDIUM, "include/cronjobs.php", "ostatus_conversations");

// Check every conversation
ostatus::check_conversations(false);
// Call possible post update functions
proc_run(PRIORITY_LOW, "include/cronjobs.php", "post_update");

// Call possible post update functions
// see include/post_update.php for more details
post_update();

// update nodeinfo data
nodeinfo_cron();
}
// update nodeinfo data
proc_run(PRIORITY_LOW, "include/cronjobs.php", "nodeinfo");

// once daily run birthday_updates and then expire in background

@@ -123,6 +68,8 @@ function cron_run(&$argv, &$argc){

update_contact_birthdays();

proc_run(PRIORITY_LOW, "include/discover_poco.php", "update_server");

proc_run(PRIORITY_LOW, "include/discover_poco.php", "suggestions");

set_config('system','last_expire_day',$d2);
@@ -173,8 +120,8 @@ function cron_update_photo_albums() {
function cron_expire_and_remove_users() {
// expire any expired accounts
q("UPDATE user SET `account_expired` = 1 where `account_expired` = 0
AND `account_expires_on` != '0000-00-00 00:00:00'
AND `account_expires_on` < UTC_TIMESTAMP() ");
AND `account_expires_on` > '%s'
AND `account_expires_on` < UTC_TIMESTAMP()", dbesc(NULL_DATE));

// delete user and contact records for recently removed accounts
$r = q("SELECT * FROM `user` WHERE `account_removed` AND `account_expires_on` < UTC_TIMESTAMP() - INTERVAL 3 DAY");
@@ -213,14 +160,6 @@ function cron_poll_contacts($argc, $argv) {
$force = true;
}

$interval = intval(get_config('system','poll_interval'));
if (!$interval)
$interval = ((get_config('system','delivery_interval') === false) ? 3 : intval(get_config('system','delivery_interval')));

// If we are using the worker we don't need a delivery interval
if (get_config("system", "worker"))
$interval = false;

$sql_extra = (($manual_id) ? " AND `id` = $manual_id " : "");

reload_plugins();
@@ -275,13 +214,15 @@ function cron_poll_contacts($argc, $argv) {

$xml = false;

if($manual_id)
$contact['last-update'] = '0000-00-00 00:00:00';
if ($manual_id) {
$contact['last-update'] = NULL_DATE;
}

if(in_array($contact['network'], array(NETWORK_DFRN, NETWORK_ZOT, NETWORK_OSTATUS)))
if (in_array($contact['network'], array(NETWORK_DFRN, NETWORK_ZOT, NETWORK_OSTATUS))) {
$contact['priority'] = 2;
}

if($contact['subhub'] AND in_array($contact['network'], array(NETWORK_DFRN, NETWORK_ZOT, NETWORK_OSTATUS))) {
if ($contact['subhub'] AND in_array($contact['network'], array(NETWORK_DFRN, NETWORK_ZOT, NETWORK_OSTATUS))) {
// We should be getting everything via a hub. But just to be sure, let's check once a day.
// (You can make this more or less frequent if desired by setting 'pushpoll_frequency' appropriately)
// This also lets us update our subscription to the hub, and add or replace hubs in case it
@@ -335,9 +276,6 @@ function cron_poll_contacts($argc, $argv) {
} else {
proc_run(PRIORITY_LOW, 'include/onepoll.php', $contact['id']);
}

if($interval)
@time_sleep_until(microtime(true) + (float) $interval);
}
}
}
@@ -488,8 +426,3 @@ function cron_repair_database() {
/// - remove children when parent got lost
/// - set contact-id in item when not present
}

if (array_search(__file__,get_included_files())===0){
cron_run($_SERVER["argv"],$_SERVER["argc"]);
killme();
}

+ 5
- 37
include/cronhooks.php View File

@@ -2,37 +2,11 @@

use \Friendica\Core\Config;

require_once("boot.php");

function cronhooks_run(&$argv, &$argc){
global $a, $db;

if(is_null($a)) {
$a = new App;
}

if(is_null($db)) {
@include(".htconfig.php");
require_once("include/dba.php");
$db = new dba($db_host, $db_user, $db_pass, $db_data);
unset($db_host, $db_user, $db_pass, $db_data);
};
global $a;

require_once('include/session.php');
require_once('include/datetime.php');

Config::load();

// Don't check this stuff if the function is called by the poller
if (App::callstack() != "poller_run") {
if ($a->maxload_reached())
return;
if (App::is_already_running('cronhooks', 'include/cronhooks.php', 1140))
return;
}

load_hooks();

if (($argc == 2) AND is_array($a->hooks) AND array_key_exists("cron", $a->hooks)) {
foreach ($a->hooks["cron"] as $hook)
if ($hook[1] == $argv[1]) {
@@ -42,7 +16,7 @@ function cronhooks_run(&$argv, &$argc){
return;
}

$last = get_config('system','last_cronhook');
$last = get_config('system', 'last_cronhook');

$poll_interval = intval(get_config('system','cronhook_interval'));
if(! $poll_interval)
@@ -62,22 +36,16 @@ function cronhooks_run(&$argv, &$argc){

$d = datetime_convert();

if (get_config("system", "worker") AND is_array($a->hooks) AND array_key_exists("cron", $a->hooks)) {
if (is_array($a->hooks) AND array_key_exists("cron", $a->hooks)) {
foreach ($a->hooks["cron"] as $hook) {
logger("Calling cronhooks for '".$hook[1]."'", LOGGER_DEBUG);
proc_run(PRIORITY_MEDIUM, "include/cronhooks.php", $hook[1]);
}
} else
call_hooks('cron', $d);
}

logger('cronhooks: end');

set_config('system','last_cronhook', time());
set_config('system', 'last_cronhook', time());

return;
}

if (array_search(__file__,get_included_files())===0){
cronhooks_run($_SERVER["argv"],$_SERVER["argc"]);
killme();
}

+ 1
- 36
include/cronjobs.php View File

@@ -1,44 +1,14 @@
<?php
use \Friendica\Core\Config;

if (!file_exists("boot.php") AND (sizeof($_SERVER["argv"]) != 0)) {
$directory = dirname($_SERVER["argv"][0]);

if (substr($directory, 0, 1) != "/")
$directory = $_SERVER["PWD"]."/".$directory;

$directory = realpath($directory."/..");

chdir($directory);
}

require_once("boot.php");


function cronjobs_run(&$argv, &$argc){
global $a, $db;
global $a;

if(is_null($a)) {
$a = new App;
}

if(is_null($db)) {
@include(".htconfig.php");
require_once("include/dba.php");
$db = new dba($db_host, $db_user, $db_pass, $db_data);
unset($db_host, $db_user, $db_pass, $db_data);
};

require_once('include/session.php');
require_once('include/datetime.php');
require_once('include/ostatus.php');
require_once('include/post_update.php');
require_once('mod/nodeinfo.php');

Config::load();

$a->set_baseurl(get_config('system','url'));

// No parameter set? So return
if ($argc <= 1)
return;
@@ -71,8 +41,3 @@ function cronjobs_run(&$argv, &$argc){

return;
}

if (array_search(__file__,get_included_files())===0){
cronjobs_run($_SERVER["argv"],$_SERVER["argc"]);
killme();
}

+ 1
- 1
include/datetime.php View File

@@ -339,7 +339,7 @@ function relative_date($posted_date, $format = null) {

$abs = strtotime($localtime);

if (is_null($posted_date) || $posted_date === '0000-00-00 00:00:00' || $abs === False) {
if (is_null($posted_date) || $posted_date <= NULL_DATE || $abs === False) {
return t('never');
}



+ 4
- 2
include/dba.php View File

@@ -234,7 +234,9 @@ class dba {
case 'pdo':
$result = @$this->db->query($sql);
// Is used to separate between queries that returning data - or not
$columns = $result->columnCount();
if (!is_bool($result)) {
$columns = $result->columnCount();
}
break;
case 'mysqli':
$result = @$this->db->query($sql);
@@ -329,7 +331,7 @@ class dba {
}
}

if (($result === true) || ($result === false)) {
if (is_bool($result)) {
return $result;
}
if ($onlyquery) {


+ 4
- 31
include/dbclean.php View File

@@ -5,26 +5,8 @@
*/

use \Friendica\Core\Config;
use \Friendica\Core\PConfig;

require_once("boot.php");

function dbclean_run(&$argv, &$argc) {
global $a, $db;

if (is_null($a)) {
$a = new App;
}

if (is_null($db)) {
@include(".htconfig.php");
require_once("include/dba.php");
$db = new dba($db_host, $db_user, $db_pass, $db_data);
unset($db_host, $db_user, $db_pass, $db_data);
}

Config::load();

if (!Config::get('system', 'dbclean', false)) {
return;
}
@@ -35,7 +17,7 @@ function dbclean_run(&$argv, &$argc) {
$stage = 0;
}

if (Config::get("system", "worker") AND ($stage == 0)) {
if ($stage == 0) {
proc_run(PRIORITY_LOW, 'include/dbclean.php', 1);
proc_run(PRIORITY_LOW, 'include/dbclean.php', 2);
proc_run(PRIORITY_LOW, 'include/dbclean.php', 3);
@@ -56,12 +38,8 @@ function remove_orphans($stage = 0) {

$count = 0;

// With activated worker we split the deletion in many small tasks
if (Config::get("system", "worker")) {
$limit = 1000;
} else {
$limit = 10000;
}
// We split the deletion in many small tasks
$limit = 1000;

if (($stage == 1) OR ($stage == 0)) {
logger("Deleting old global item entries from item table without user copy");
@@ -159,14 +137,9 @@ function remove_orphans($stage = 0) {
}

// Call it again if not all entries were purged
if (($stage != 0) AND ($count > 0) AND Config::get("system", "worker")) {
if (($stage != 0) AND ($count > 0)) {
proc_run(PRIORITY_MEDIUM, 'include/dbclean.php');
}

}

if (array_search(__file__,get_included_files())===0){
dbclean_run($_SERVER["argv"],$_SERVER["argc"]);
killme();
}
?>

+ 2
- 9
include/dbm.php View File

@@ -96,18 +96,11 @@ class dbm {
public static function date($date = 'now') {
$timestamp = strtotime($date);

// Workaround for 3.5.1
// Don't allow lower date strings as '0001-01-01 00:00:00'
if ($timestamp < -62135596800) {
return '0000-00-00 00:00:00';
$timestamp = -62135596800;
}

// The above will be removed in 3.5.2
// The following will then be enabled
// Don't allow lower date strings as '0001-01-01 00:00:00'
//if ($timestamp < -62135596800) {
// $timestamp = -62135596800;
//}

return date('Y-m-d H:i:s', $timestamp);
}
}


+ 72
- 78
include/dbstructure.php View File

@@ -1,4 +1,7 @@
<?php

use \Friendica\Core\Config;

require_once("boot.php");
require_once("include/text.php");

@@ -144,7 +147,8 @@ function update_structure($verbose, $action, $tables=null, $definition=null) {
global $a, $db;

if ($action) {
set_config('system', 'maintenance', 1);
Config::set('system', 'maintenance', 1);
Config::set('system', 'maintenance_reason', 'Database update');
}

if (isset($a->config["system"]["db_charset"])) {
@@ -361,8 +365,10 @@ function update_structure($verbose, $action, $tables=null, $definition=null) {
}
}

if ($action)
set_config('system', 'maintenance', 0);
if ($action) {
Config::set('system', 'maintenance', 0);
Config::set('system', 'maintenance_reason', '');
}

return $errors;
}
@@ -536,8 +542,8 @@ function db_definition($charset) {
"filetype" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
"filesize" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
"data" => array("type" => "longblob", "not null" => "1"),
"created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
"edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
"created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
"edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
"allow_cid" => array("type" => "mediumtext"),
"allow_gid" => array("type" => "mediumtext"),
"deny_cid" => array("type" => "mediumtext"),
@@ -564,7 +570,7 @@ function db_definition($charset) {
"k" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
"v" => array("type" => "mediumtext"),
"expire_mode" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
"updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
"updated" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
),
"indexes" => array(
"PRIMARY" => array("k"),
@@ -613,7 +619,7 @@ function db_definition($charset) {
"fields" => array(
"id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
"uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
"created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
"created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
"self" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
"remote_self" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
"rel" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
@@ -651,14 +657,14 @@ function db_definition($charset) {
"usehub" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
"subhub" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
"hub-verify" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"last-update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
"success_update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
"failure_update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
"name-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
"uri-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
"avatar-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
"term-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
"last-item" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
"last-update" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
"success_update" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
"failure_update" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
"name-date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
"uri-date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
"avatar-date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
"term-date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
"last-item" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
"priority" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
"blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
"readonly" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
@@ -703,8 +709,8 @@ function db_definition($charset) {
"recips" => array("type" => "text"),
"uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
"creator" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
"updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
"created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
"updated" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
"subject" => array("type" => "text"),
),
"indexes" => array(
@@ -712,18 +718,6 @@ function db_definition($charset) {
"uid" => array("uid"),
)
);
$database["deliverq"] = array(
"fields" => array(
"id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
"cmd" => array("type" => "varbinary(32)", "not null" => "1", "default" => ""),
"item" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
"contact" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
),
"indexes" => array(
"PRIMARY" => array("id"),
"cmd_item_contact" => array("UNIQUE", "cmd", "item", "contact"),
)
);
$database["event"] = array(
"fields" => array(
"id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
@@ -731,10 +725,10 @@ function db_definition($charset) {
"uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
"cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
"uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
"edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
"start" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
"finish" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
"created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
"edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
"start" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
"finish" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
"summary" => array("type" => "text"),
"desc" => array("type" => "text"),
"location" => array("type" => "text"),
@@ -770,7 +764,7 @@ function db_definition($charset) {
"network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
"alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"pubkey" => array("type" => "text"),
"updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
"updated" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
),
"indexes" => array(
"PRIMARY" => array("id"),
@@ -811,7 +805,7 @@ function db_definition($charset) {
"request" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"note" => array("type" => "text"),
"created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
"created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
),
"indexes" => array(
"PRIMARY" => array("id"),
@@ -838,10 +832,10 @@ function db_definition($charset) {
"nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"connect" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
"updated" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
"last_contact" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
"last_failure" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
"created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
"updated" => array("type" => "datetime", "default" => NULL_DATE),
"last_contact" => array("type" => "datetime", "default" => NULL_DATE),
"last_failure" => array("type" => "datetime", "default" => NULL_DATE),
"location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"about" => array("type" => "text"),
"keywords" => array("type" => "text"),
@@ -875,7 +869,7 @@ function db_definition($charset) {
"uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
"gcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
"zcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
"updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
"updated" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
),
"indexes" => array(
"PRIMARY" => array("id"),
@@ -923,10 +917,10 @@ function db_definition($charset) {
"noscrape" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
"platform" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
"last_poco_query" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
"last_contact" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
"last_failure" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
"created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
"last_poco_query" => array("type" => "datetime", "default" => NULL_DATE),
"last_contact" => array("type" => "datetime", "default" => NULL_DATE),
"last_failure" => array("type" => "datetime", "default" => NULL_DATE),
),
"indexes" => array(
"PRIMARY" => array("id"),
@@ -956,7 +950,7 @@ function db_definition($charset) {
"duplex" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
"note" => array("type" => "text"),
"hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"datetime" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
"datetime" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
"blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
"ignore" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
),
@@ -979,11 +973,11 @@ function db_definition($charset) {
"parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"extid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"thr-parent" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
"edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
"commented" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
"received" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
"changed" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
"created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
"edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
"commented" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
"received" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
"changed" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
"owner-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
"owner-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"owner-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
@@ -1082,7 +1076,7 @@ function db_definition($charset) {
"id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
"name" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
"locked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
"created" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
"created" => array("type" => "datetime", "default" => NULL_DATE),
),
"indexes" => array(
"PRIMARY" => array("id"),
@@ -1106,7 +1100,7 @@ function db_definition($charset) {
"unknown" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
"uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
"created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
),
"indexes" => array(
"PRIMARY" => array("id"),
@@ -1130,7 +1124,7 @@ function db_definition($charset) {
"action" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
"movetofolder" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
"last_check" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
"last_check" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
),
"indexes" => array(
"PRIMARY" => array("id"),
@@ -1155,7 +1149,7 @@ function db_definition($charset) {
"name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
"date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
"msg" => array("type" => "mediumtext"),
"uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
"link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
@@ -1191,7 +1185,7 @@ function db_definition($charset) {
"fields" => array(
"url" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
"content" => array("type" => "mediumtext"),
"created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
"created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
),
"indexes" => array(
"PRIMARY" => array("url"),
@@ -1204,7 +1198,7 @@ function db_definition($charset) {
"guessing" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
"oembed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
"content" => array("type" => "mediumtext"),
"created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
"created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
),
"indexes" => array(
"PRIMARY" => array("url", "guessing", "oembed"),
@@ -1231,8 +1225,8 @@ function db_definition($charset) {
"contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
"guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
"resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
"edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
"created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
"edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
"title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"desc" => array("type" => "text"),
"album" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
@@ -1294,7 +1288,7 @@ function db_definition($charset) {
"fields" => array(
"pid" => array("type" => "int(10) unsigned", "not null" => "1", "primary" => "1"),
"command" => array("type" => "varbinary(32)", "not null" => "1", "default" => ""),
"created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
"created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
),
"indexes" => array(
"PRIMARY" => array("pid"),
@@ -1320,7 +1314,7 @@ function db_definition($charset) {
"gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
"marital" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"with" => array("type" => "text"),
"howlong" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
"howlong" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
"sexual" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"politic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"religion" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
@@ -1372,7 +1366,7 @@ function db_definition($charset) {
"topic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"push" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
"last_update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
"last_update" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
"secret" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
),
"indexes" => array(
@@ -1384,8 +1378,8 @@ function db_definition($charset) {
"id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
"cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
"network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
"created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
"last" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
"created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
"last" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
"content" => array("type" => "mediumtext"),
"batch" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
),
@@ -1402,7 +1396,7 @@ function db_definition($charset) {
"fields" => array(
"id" => array("type" => "int(11) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
"hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
"created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
"uid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
"password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"language" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
@@ -1456,7 +1450,7 @@ function db_definition($charset) {
"spam" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
"ham" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
"term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
"date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
),
"indexes" => array(
"PRIMARY" => array("id"),
@@ -1475,8 +1469,8 @@ function db_definition($charset) {
"term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
"received" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
"created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
"received" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
"global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
"aid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
"uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
@@ -1497,11 +1491,11 @@ function db_definition($charset) {
"gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
"owner-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
"author-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
"created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
"edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
"commented" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
"received" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
"changed" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
"created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
"edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
"commented" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
"received" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
"changed" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
"wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
"private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
"pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
@@ -1553,8 +1547,8 @@ function db_definition($charset) {
"openid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"timezone" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
"language" => array("type" => "varchar(32)", "not null" => "1", "default" => "en"),
"register_date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
"login_date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
"register_date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
"login_date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
"default-location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"allow_location" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
"theme" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
@@ -1578,8 +1572,8 @@ function db_definition($charset) {
"expire" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
"account_removed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
"account_expired" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
"account_expires_on" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
"expire_notification_sent" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
"account_expires_on" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
"expire_notification_sent" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
"service_class" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
"def_gid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
"allow_cid" => array("type" => "mediumtext"),
@@ -1608,9 +1602,9 @@ function db_definition($charset) {
"id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
"parameter" => array("type" => "text"),
"priority" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
"created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
"created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
"pid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
"executed" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
"executed" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
),
"indexes" => array(
"PRIMARY" => array("id"),


+ 2
- 22
include/dbupdate.php View File

@@ -2,32 +2,12 @@

use \Friendica\Core\Config;

require_once("boot.php");

function dbupdate_run(&$argv, &$argc) {
global $a, $db;

if(is_null($a)){
$a = new App;
}

if(is_null($db)) {
@include(".htconfig.php");
require_once("include/dba.php");
$db = new dba($db_host, $db_user, $db_pass, $db_data);
unset($db_host, $db_user, $db_pass, $db_data);
}

Config::load();
global $a;

// We are deleting the latest dbupdate entry.
// This is done to avoid endless loops because the update was interupted.
Config::delete('database','dbupdate_'.DB_UPDATE_VERSION);
Config::delete('database', 'dbupdate_'.DB_UPDATE_VERSION);

update_db($a);
}

if (array_search(__file__,get_included_files())===0){
dbupdate_run($_SERVER["argv"],$_SERVER["argc"]);
killme();
}

+ 5
- 53
include/delivery.php View File

@@ -2,44 +2,25 @@

use \Friendica\Core\Config;

require_once("boot.php");
require_once('include/queue_fn.php');
require_once('include/html2plain.php');
require_once("include/Scrape.php");
require_once('include/Scrape.php');
require_once('include/diaspora.php');
require_once("include/ostatus.php");
require_once("include/dfrn.php");
require_once('include/ostatus.php');
require_once('include/dfrn.php');

function delivery_run(&$argv, &$argc){
global $a, $db;
global $a;

if (is_null($a)) {
$a = new App;
}

if (is_null($db)) {
@include(".htconfig.php");
require_once("include/dba.php");
$db = new dba($db_host, $db_user, $db_pass, $db_data);
unset($db_host, $db_user, $db_pass, $db_data);
}

require_once("include/session.php");
require_once("include/datetime.php");
require_once('include/datetime.php');
require_once('include/items.php');
require_once('include/bbcode.php');
require_once('include/email.php');

Config::load();

load_hooks();

if ($argc < 3) {
return;
}

$a->set_baseurl(get_config('system','url'));

logger('delivery: invoked: '. print_r($argv,true), LOGGER_DEBUG);

$cmd = $argv[1];
@@ -49,30 +30,6 @@ function delivery_run(&$argv, &$argc){

$contact_id = intval($argv[$x]);

/// @todo When switching completely to the worker we won't need this anymore
// Some other process may have delivered this item already.

$r = q("SELECT * FROM `deliverq` WHERE `cmd` = '%s' AND `item` = %d AND `contact` = %d LIMIT 1",
dbesc($cmd),
dbesc($item_id),
dbesc($contact_id)
);
if (!dbm::is_result($r)) {
continue;
}

if ($a->maxload_reached()) {
return;
}

// It's ours to deliver. Remove it from the queue.

q("DELETE FROM `deliverq` WHERE `cmd` = '%s' AND `item` = %d AND `contact` = %d",
dbesc($cmd),
dbesc($item_id),
dbesc($contact_id)
);

if (!$item_id || !$contact_id) {
continue;
}
@@ -577,8 +534,3 @@ function delivery_run(&$argv, &$argc){

return;
}

if (array_search(__file__,get_included_files())===0){
delivery_run($_SERVER["argv"],$_SERVER["argc"]);
killme();
}

+ 1
- 1
include/dfrn.php View File

@@ -1094,7 +1094,7 @@ class dfrn {
return 3;
}

if($contact['term-date'] != '0000-00-00 00:00:00') {
if ($contact['term-date'] > NULL_DATE) {
logger("dfrn_deliver: $url back from the dead - removing mark for death");
require_once('include/Contact.php');
unmark_for_death($contact);


+ 7
- 32
include/directory.php View File

@@ -1,36 +1,16 @@
<?php
require_once("boot.php");

use \Friendica\Core\Config;

function directory_run(&$argv, &$argc){
global $a, $db;

if(is_null($a)) {
$a = new App;
}

if(is_null($db)) {
@include(".htconfig.php");
require_once("include/dba.php");
$db = new dba($db_host, $db_user, $db_pass, $db_data);
unset($db_host, $db_user, $db_pass, $db_data);
};

Config::load();

if($argc != 2)
if ($argc != 2) {
return;
}

load_hooks();


$a->set_baseurl(get_config('system','url'));

$dir = get_config('system','directory');
$dir = get_config('system', 'directory');

if(! strlen($dir))
if (!strlen($dir)) {
return;
}

$dir .= "/submit";

@@ -39,13 +19,8 @@ function directory_run(&$argv, &$argc){
call_hooks('globaldir_update', $arr);

logger('Updating directory: ' . $arr['url'], LOGGER_DEBUG);
if(strlen($arr['url']))
if (strlen($arr['url'])) {
fetch_url($dir . '?url=' . bin2hex($arr['url']));
}
return;
}

if (array_search(__file__,get_included_files())===0){
directory_run($_SERVER["argv"],$_SERVER["argc"]);
killme();
}

+ 94
- 68
include/discover_poco.php View File

@@ -2,62 +2,64 @@

use \Friendica\Core\Config;

require_once("boot.php");
require_once("include/socgraph.php");
require_once('include/socgraph.php');
require_once('include/datetime.php');

function discover_poco_run(&$argv, &$argc){
global $a, $db;
function discover_poco_run(&$argv, &$argc) {

if(is_null($a)) {
$a = new App;
}

if(is_null($db)) {
@include(".htconfig.php");
require_once("include/dba.php");
$db = new dba($db_host, $db_user, $db_pass, $db_data);
unset($db_host, $db_user, $db_pass, $db_data);
};

require_once('include/session.php');
require_once('include/datetime.php');

Config::load();
/*
This function can be called in these ways:
- dirsearch <search pattern>: Searches for "search pattern" in the directory. "search pattern" is url encoded.
- checkcontact: Updates gcontact entries
- suggestions: Discover other servers for their contacts.
- server <poco url>: Searches for the poco server list. "poco url" is base64 encoded.
- update_server: Frequently check the first 250 servers for vitality.
*/

// Don't check this stuff if the function is called by the poller
if (App::callstack() != "poller_run")
if ($a->maxload_reached())
return;

if(($argc > 2) && ($argv[1] == "dirsearch")) {
if (($argc > 2) && ($argv[1] == "dirsearch")) {
$search = urldecode($argv[2]);
$mode = 1;
} elseif(($argc == 2) && ($argv[1] == "checkcontact")) {
} elseif (($argc == 2) && ($argv[1] == "checkcontact")) {
$mode = 2;
} elseif(($argc == 2) && ($argv[1] == "suggestions")) {
} elseif (($argc == 2) && ($argv[1] == "suggestions")) {
$mode = 3;
} elseif (($argc == 3) && ($argv[1] == "server")) {
$mode = 4;
} elseif (($argc == 2) && ($argv[1] == "update_server")) {
$mode = 5;
} elseif ($argc == 1) {
$search = "";
$mode = 0;
} else
} else {
die("Unknown or missing parameter ".$argv[1]."\n");

// Don't check this stuff if the function is called by the poller
if (App::callstack() != "poller_run")
if (App::is_already_running('discover_poco'.$mode.urlencode($search), 'include/discover_poco.php', 1140))
return;

$a->set_baseurl(get_config('system','url'));

load_hooks();
}

logger('start '.$search);

if ($mode==3)
if ($mode == 5) {
update_server();
} elseif ($mode == 4) {
$server_url = base64_decode($argv[2]);
if ($server_url == "") {
return;
}
$server_url = filter_var($server_url, FILTER_SANITIZE_URL);
if (substr(normalise_link($server_url), 0, 7) != "http://") {
return;
}
$result = "Checking server ".$server_url." - ";
$ret = poco_check_server($server_url);
if ($ret) {
$result .= "success";
} else {
$result .= "failed";
}
logger($result, LOGGER_DEBUG);
} elseif ($mode == 3) {
update_suggestions();
elseif (($mode == 2) AND get_config('system','poco_completion'))
} elseif (($mode == 2) AND get_config('system','poco_completion')) {
discover_users();
elseif (($mode == 1) AND ($search != "") and get_config('system','poco_local_search')) {
} elseif (($mode == 1) AND ($search != "") and get_config('system','poco_local_search')) {
discover_directory($search);
gs_search_user($search);
} elseif (($mode == 0) AND ($search == "") and (get_config('system','poco_discovery') > 0)) {
@@ -74,6 +76,33 @@ function discover_poco_run(&$argv, &$argc){
return;
}

/**
* @brief Updates the first 250 servers
*
*/
function update_server() {
$r = q("SELECT `url`, `created`, `last_failure`, `last_contact` FROM `gserver` ORDER BY rand()");

if (!dbm::is_result($r)) {
return;
}

$updated = 0;

foreach ($r AS $server) {
if (!poco_do_update($server["created"], "", $server["last_failure"], $server["last_contact"])) {
continue;
}
logger('Update server status for server '.$server["url"], LOGGER_DEBUG);

proc_run(PRIORITY_LOW, "include/discover_poco.php", "server", base64_encode($server["url"]));

if (++$updated > 250) {
return;
}
}
}

function discover_users() {
logger("Discover users", LOGGER_DEBUG);

@@ -84,9 +113,9 @@ function discover_users() {
dbesc(NETWORK_DFRN), dbesc(NETWORK_DIASPORA),
dbesc(NETWORK_OSTATUS), dbesc(NETWORK_FEED));

if (!$users)
if (!$users) {
return;
}
$checked = 0;

foreach ($users AS $user) {
@@ -111,27 +140,29 @@ function discover_users() {
continue;
}

if ($user["server_url"] != "")
if ($user["server_url"] != "") {
$server_url = $user["server_url"];
else
} else {
$server_url = poco_detect_server($user["url"]);