Browse Source

This merge brings back dbm::is_result() where I could find it.

Merge branch 'develop' of github.com:friendica/friendica into rhaeder-develop

Signed-off-by: Roland Haeder <roland@mxchange.org>
pull/3010/head
Roland Haeder 4 years ago
parent
commit
c825cc8d0d
No known key found for this signature in database GPG Key ID: B72F8185C6C7BD78
691 changed files with 121501 additions and 35639 deletions
  1. +8
    -1
      .htaccess
  2. +60
    -0
      CHANGELOG
  3. +20
    -4
      INSTALL.txt
  4. +294
    -99
      boot.php
  5. +166
    -158
      database.sql
  6. +6
    -0
      doc/BBCode.md
  7. +2
    -2
      doc/Developers-Intro.md
  8. +1
    -1
      doc/Home.md
  9. +3
    -3
      doc/Install.md
  10. +240
    -148
      doc/Settings.md
  11. +56
    -8
      doc/api.md
  12. +1
    -0
      doc/database/db_fcontact.md
  13. +2
    -0
      doc/database/db_item.md
  14. +2
    -0
      doc/database/db_thread.md
  15. +6
    -0
      doc/de/BBCode.md
  16. +1
    -1
      doc/de/Home.md
  17. +227
    -181
      doc/de/Settings.md
  18. +4
    -1
      doc/htconfig.md
  19. +1
    -1
      doc/readme.md
  20. +5
    -0
      htconfig.php
  21. +104
    -59
      include/Contact.php
  22. +236
    -0
      include/Core/Config.php
  23. +222
    -0
      include/Core/PConfig.php
  24. +2
    -2
      include/Emailer.php
  25. +4
    -2
      include/ForumManager.php
  26. +782
    -108
      include/NotificationsManager.php
  27. +7
    -5
      include/Photo.php
  28. +1124
    -0
      include/Probe.php
  29. +9
    -916
      include/Scrape.php
  30. +37
    -36
      include/Smilies.php
  31. +12
    -12
      include/acl_selectors.php
  32. +840
    -452
      include/api.php
  33. +2
    -2
      include/auth.php
  34. +43
    -28
      include/auth_ejabberd.php
  35. +1
    -0
      include/autoloader/autoload_psr4.php
  36. +67
    -27
      include/bbcode.php
  37. +2
    -2
      include/cache.php
  38. +1
    -1
      include/cli_startup.php
  39. +127
    -317
      include/config.php
  40. +3
    -3
      include/contact_selectors.php
  41. +3
    -3
      include/contact_widgets.php
  42. +132
    -76
      include/conversation.php
  43. +85
    -51
      include/cron.php
  44. +18
    -3
      include/cronhooks.php
  45. +77
    -0
      include/cronjobs.php
  46. +26
    -12
      include/datetime.php
  47. +23
    -14
      include/dba.php
  48. +0
    -10
      include/dba_pdo.php
  49. +49
    -0
      include/dbm.php
  50. +133
    -106
      include/dbstructure.php
  51. +2
    -2
      include/delivery.php
  52. +117
    -49
      include/dfrn.php
  53. +301
    -121
      include/diaspora.php
  54. +246
    -226
      include/enotify.php
  55. +429
    -23
      include/event.php
  56. +1
    -1
      include/expire.php
  57. +2
    -2
      include/fcontact.php
  58. +1
    -0
      include/features.php
  59. +26
    -6
      include/feed.php
  60. +5
    -5
      include/follow.php
  61. +1
    -1
      include/gprobe.php
  62. +10
    -10
      include/group.php
  63. +64
    -25
      include/identity.php
  64. +35
    -29
      include/items.php
  65. +6
    -6
      include/like.php
  66. +1
    -1
      include/lock.php
  67. +5
    -5
      include/message.php
  68. +1
    -1
      include/nav.php
  69. +64
    -322
      include/network.php
  70. +55
    -21
      include/notifier.php
  71. +7
    -7
      include/oauth.php
  72. +6
    -3
      include/oembed.php
  73. +4
    -5
      include/onepoll.php
  74. +5
    -1
      include/ostatus.php
  75. +17
    -10
      include/plaintext.php
  76. +69
    -27
      include/plugin.php
  77. +100
    -28
      include/poller.php
  78. +77
    -0
      include/post_update.php
  79. +58
    -43
      include/pubsubpublish.php
  80. +43
    -41
      include/queue.php
  81. +2
    -2
      include/queue_fn.php
  82. +2
    -3
      include/salmon.php
  83. +6
    -6
      include/security.php
  84. +1
    -1
      include/session.php
  85. +77
    -23
      include/socgraph.php
  86. +112
    -193
      include/text.php
  87. +9
    -7
      include/threads.php
  88. +1
    -1
      include/uimport.php
  89. +3
    -3
      include/user.php
  90. +41
    -18
      include/xml.php
  91. +35
    -98
      index.php
  92. +10
    -3
      js/autocomplete.js
  93. +43
    -2
      js/main.js
  94. +455
    -0
      library/Text_Highlighter/README
  95. +12
    -0
      library/Text_Highlighter/TODO
  96. +398
    -0
      library/Text_Highlighter/Text/Highlighter.php
  97. +519
    -0
      library/Text_Highlighter/Text/Highlighter/ABAP.php
  98. +894
    -0
      library/Text_Highlighter/Text/Highlighter/AVRC.php
  99. +891
    -0
      library/Text_Highlighter/Text/Highlighter/CPP.php
  100. +437
    -0
      library/Text_Highlighter/Text/Highlighter/CSS.php

+ 8
- 1
.htaccess View File

@ -4,7 +4,14 @@ AddType audio/ogg .oga
#AddHandler php53-cgi .php
<FilesMatch "\.(out|log)$">
Deny from all
<IfModule authz_host_module>
#Apache 2.4
Require all denied
</IfModule>
<IfModule !authz_host_module>
#Apache 2.2
Deny from all
</IfModule>
</FilesMatch>
<IfModule mod_rewrite.c>


+ 60
- 0
CHANGELOG View File

@ -1,3 +1,63 @@
Version 3.5
Friendica Core:
NEW Optional local directory with possible federated contacts [heluecht]
NEW Autocompletion for @-mentions and BBCode tags [rabuzarus]
NEW Added a composer derived autoloader which allows composer autoloaders in addons/libraries [fabrixxm]
NEW theme: frio [rabuzarus, heluecht, fabrixxm]
Enhance .htaccess file (nerdoc, dissolve)
Updates to the translations (DE, ES, IS, IT, RU) [translation teams]
Updates to the documentation [tobiasd, heluecht, mexcon, silke, rabuzarus, fabrixxm, Olivier Mehani, gerhard6380, ben utzer]
Extended the BBCode by [abstract] tag used for bridged postings to networks with limited character length [heluecht]
Code cleanup [heluecht, QuixOr]
Improvements to the API and Friendica specific extensions [heluecht, fabrixxm, gerhard6380]
Improvements to the RSS/Atom feed import [mexcon]
Improvements to the communication with federated networks (Diaspora, Hubzilla, OStatus) [heluecht]
Improvements on the themes (quattro, vier, frost) [rabuzarus, fabrixxm, stieben, heluecht, Quix0r, tobiasd]
Improvements to the ACL dialog [fabrixxm, rabuzarus]
Improvements to the database structure and optimization of queries [heluecht]
Improvements to the UI (contacts, hotkeys, remember me, ARIA, code hightlighting) [rabuzarus, heluecht, tobiasd]
Improvements to the background process (poller, worker) [heluecht]
Improvements to the admin panel [tobiasd, heluecht, fabrixxm]
Improvements to the performance [heluecht]
Improvements to the installation wizzard (language selection, RINO version, check required PHP modules, default theme is now vier) [tobiasd]
Improvements to the relocation of nodes and accounts [heluecht]
Improvements to the DDoS detection [heluecht]
Improvements to the calendar/events module [heluecht, rabuzarus]
Improvements to OpenID login [strk]
Improvements to the ShaShape font [andi]
Reworked the implementation of the DFRN, Diaspora protocols [heluecht]
Reworked the notifications code [fabrixxm, rabuzarus, heluecht]
Reworked the p/config code [fabrixxm, rabuzarus]
Reworked XML generation [heluecht]
Removed now unused simplepie from library [heluecht]
Friendica Addons
Updated to the translations (DE, ES, IS, NL, PT BR), [translation teams]
Piwik [tobiasd]
Twitter Connector [heluecht]
Pumpio Connector [heluecht]
Rendertime [heluecht]
wppost [heluecht]
showmore [rabuzarus]
fromgplus [heluecht]
app.net Connector [heluecht]
GNU Social Connector [heluecht]
LDAP [Olivier Mehani]
smileybutton [rabuzarus]
retriver [mexon]
mailstream [mexon]
forumdirectory [tobiasd]
NEW notifyall (port from Hubzilla) [rabuzarus, tobiasd]
DEPRECATED cal (now in core), FB Connector, FB Post Connector, FB Sync
Closed Issues
683, 786, 796, 922, 1261, 1576, 1701, 1769, 1970, 1145, 1494,
1728, 1877, 2063, 2059, 2078, 2079, 2133, 2165, 2194, 2229, 2230,
2241, 2254, 2242, 2270, 2277, 2339, 2320, 2345, 2352, 2358, 2367,
2373, 2376, 2378, 2385, 2395, 2402, 2406, 2433, 2472, 2485, 2492,
2506, 2512, 2516, 2539, 2540, 2893, 2597, 2611, 2617, 2629, 2645,
2687, 2716, 2757, 2764
Version 3.4.3
What's new for the users:
Updates to the documentation (silke, tobiasd, annando, rebeka-catalina)


+ 20
- 4
INSTALL.txt View File

@ -32,8 +32,7 @@ link if your cert is self-signed).
- Apache with mod-rewrite enabled and "Options All" so you can use a
local .htaccess file
- PHP 5.2+. The later the better. PHP 5.3 is required for communications
with the Diaspora network and improved security.
- PHP 5.4+.
- PHP *command line* access with register_argc_argv set to true in the
php.ini file [or see 'poormancron' in section 8]
@ -42,7 +41,7 @@ php.ini file [or see 'poormancron' in section 8]
- some form of email server or email gateway such that PHP mail() works
- Mysql 5.x
- Mysql 5.5.3+ or an equivalant alternative for MySQL (MariaDB, Percona Server etc.)
- ability to schedule jobs with cron (Linux/Mac) or Scheduled Tasks
(Windows) [Note: other options are presented in Section 8 of this document]
@ -136,8 +135,25 @@ $a->config['system']['addon'] = 'js_upload,poormancron';
and save your changes.
9. (Optional) Reverse-proxying and HTTPS
Friendica looks for some well-known HTTP headers indicating a reverse-proxy
terminating an HTTPS connection. While the standard from RFC 7239 specifies
the use of the `Forwaded` header.
Forwarded: for=192.0.2.1; proto=https; by=192.0.2.2
Friendica also supports a number on non-standard headers in common use.
X-Forwarded-Proto: https
Front-End-Https: on
X-Forwarded-Ssl: on
It is however preferable to use the standard approach if configuring a new server.
#####################################################################
If things don't work...


+ 294
- 99
boot.php View File

@ -36,9 +36,9 @@ require_once('include/dbstructure.php');
define ( 'FRIENDICA_PLATFORM', 'Friendica');
define ( 'FRIENDICA_CODENAME', 'Asparagus');
define ( 'FRIENDICA_VERSION', '3.5-dev' );
define ( 'FRIENDICA_VERSION', '3.5.1-dev' );
define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
define ( 'DB_UPDATE_VERSION', 1195 );
define ( 'DB_UPDATE_VERSION', 1202 );
/**
* @brief Constant with a HTML line break.
@ -386,6 +386,24 @@ define ( 'GRAVITY_LIKE', 3);
define ( 'GRAVITY_COMMENT', 6);
/* @}*/
/**
* @name Priority
*
* Process priority for the worker
* @{
*/
define('PRIORITY_UNDEFINED', 0);
define('PRIORITY_CRITICAL', 10);
define('PRIORITY_HIGH', 20);
define('PRIORITY_MEDIUM', 30);
define('PRIORITY_LOW', 40);
define('PRIORITY_NEGLIGIBLE',50);
/* @}*/
// Normally this constant is defined - but not if "pcntl" isn't installed
if (!defined("SIGTERM"))
define("SIGTERM", 15);
/**
*
@ -471,6 +489,7 @@ class App {
public $performance = array();
public $callstack = array();
public $theme_info = array();
public $backend = true;
public $nav_sel;
@ -512,6 +531,8 @@ class App {
*/
public $template_engine_instance = array();
public $process_id;
private $ldelim = array(
'internal' => '',
'smarty3' => '{{'
@ -553,6 +574,7 @@ class App {
$this->performance["start"] = microtime(true);
$this->performance["database"] = 0;
$this->performance["database_write"] = 0;
$this->performance["network"] = 0;
$this->performance["file"] = 0;
$this->performance["rendering"] = 0;
@ -572,6 +594,8 @@ class App {
$this->query_string = '';
$this->process_id = uniqid("log", true);
startup();
set_include_path(
@ -583,10 +607,15 @@ class App {
$this->scheme = 'http';
if(x($_SERVER,'HTTPS') && $_SERVER['HTTPS'])
$this->scheme = 'https';
elseif(x($_SERVER,'SERVER_PORT') && (intval($_SERVER['SERVER_PORT']) == 443))
if((x($_SERVER,'HTTPS') && $_SERVER['HTTPS']) ||
(x($_SERVER['HTTP_FORWARDED']) && preg_match("/proto=https/", $_SERVER['HTTP_FORWARDED'])) ||
(x($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') ||
(x($_SERVER['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] == 'on') ||
(x($_SERVER['FRONT_END_HTTPS']) && $_SERVER['FRONT_END_HTTPS'] == 'on') ||
(x($_SERVER,'SERVER_PORT') && (intval($_SERVER['SERVER_PORT']) == 443)) // XXX: reasonable assumption, but isn't this hardcoding too much?
) {
$this->scheme = 'https';
}
if(x($_SERVER,'SERVER_NAME')) {
$this->hostname = $_SERVER['SERVER_NAME'];
@ -862,6 +891,9 @@ class App {
if ($touch_icon == "")
$touch_icon = "images/friendica-128.png";
// get data wich is needed for infinite scroll on the network page
$invinite_scroll = infinite_scroll_data($this->module);
$tpl = get_markup_template('head.tpl');
$this->page['htmlhead'] = replace_macros($tpl,array(
'$baseurl' => $this->get_baseurl(), // FIXME for z_path!!!!
@ -874,7 +906,8 @@ class App {
'$update_interval' => $interval,
'$shortcut_icon' => $shortcut_icon,
'$touch_icon' => $touch_icon,
'$stylesheet' => $stylesheet
'$stylesheet' => $stylesheet,
'$infinite_scroll' => $invinite_scroll,
)) . $this->page['htmlhead'];
}
@ -927,7 +960,7 @@ class App {
} else {
$r = q("SELECT `contact`.`avatar-date` AS picdate FROM `contact` WHERE `contact`.`thumb` like '%%/%s'",
$common_filename);
if(! dba::is_result($r)){
if(! dbm::is_result($r)){
$this->cached_profile_image[$avatar_image] = $avatar_image;
} else {
$this->cached_profile_picdate[$common_filename] = "?rev=".urlencode($r[0]['picdate']);
@ -1066,6 +1099,42 @@ class App {
}
/**
* @brief Log active processes into the "process" table
*/
function start_process() {
$trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
$command = basename($trace[0]["file"]);
$this->remove_inactive_processes();
$r = q("SELECT `pid` FROM `process` WHERE `pid` = %d", intval(getmypid()));
if(!dbm::is_result($r))
q("INSERT INTO `process` (`pid`,`command`,`created`) VALUES (%d, '%s', '%s')",
intval(getmypid()),
dbesc($command),
dbesc(datetime_convert()));
}
/**
* @brief Remove inactive processes
*/
function remove_inactive_processes() {
$r = q("SELECT `pid` FROM `process`");
if(dbm::is_result($r))
foreach ($r AS $process)
if (!posix_kill($process["pid"], 0))
q("DELETE FROM `process` WHERE `pid` = %d", intval($process["pid"]));
}
/**
* @brief Remove the active process from the "process" table
*/
function end_process() {
q("DELETE FROM `process` WHERE `pid` = %d", intval(getmypid()));
}
/**
* @brief Returns a string with a callstack. Can be used for logging.
*
@ -1098,6 +1167,77 @@ class App {
return($this->is_friendica_app);
}
/**
* @brief Checks if the site is called via a backend process
*
* This isn't a perfect solution. But we need this check very early.
* So we cannot wait until the modules are loaded.
*
* @return bool Is it a known backend?
*/
function is_backend() {
$backend = array();
$backend[] = "_well_known";
$backend[] = "api";
$backend[] = "dfrn_notify";
$backend[] = "fetch";
$backend[] = "hcard";
$backend[] = "hostxrd";
$backend[] = "nodeinfo";
$backend[] = "noscrape";
$backend[] = "p";
$backend[] = "poco";
$backend[] = "post";
$backend[] = "proxy";
$backend[] = "pubsub";
$backend[] = "pubsubhubbub";
$backend[] = "receive";
$backend[] = "rsd_xml";
$backend[] = "salmon";
$backend[] = "statistics_json";
$backend[] = "xrd";
if (in_array($this->module, $backend))
return(true);
else
return($this->backend);
}
/**
* @brief Checks if the maximum number of database processes is reached
*
* @return bool Is the limit reached?
*/
function max_processes_reached() {
// Is the function called statically?
if (!is_object($this))
return(self::$a->max_processes_reached());
if ($this->is_backend()) {
$process = "backend";
$max_processes = get_config('system', 'max_processes_backend');
if (intval($max_processes) == 0)
$max_processes = 5;
} else {
$process = "frontend";
$max_processes = get_config('system', 'max_processes_frontend');
if (intval($max_processes) == 0)
$max_processes = 20;
}
$processlist = dbm::processlist();
if ($processlist["list"] != "") {
logger("Processcheck: Processes: ".$processlist["amount"]." - Processlist: ".$processlist["list"], LOGGER_DEBUG);
if ($processlist["amount"] > $max_processes) {
logger("Processcheck: Maximum number of processes for ".$process." tasks (".$max_processes.") reached.", LOGGER_DEBUG);
return true;
}
}
return false;
}
/**
* @brief Checks if the maximum load is reached
*
@ -1105,14 +1245,26 @@ class App {
*/
function maxload_reached() {
$maxsysload = intval(get_config('system', 'maxloadavg'));
if ($maxsysload < 1)
$maxsysload = 50;
// Is the function called statically?
if (!is_object($this))
return(self::$a->maxload_reached());
if ($this->is_backend()) {
$process = "backend";
$maxsysload = intval(get_config('system', 'maxloadavg'));
if ($maxsysload < 1)
$maxsysload = 50;
} else {
$process = "frontend";
$maxsysload = intval(get_config('system','maxloadavg_frontend'));
if ($maxsysload < 1)
$maxsysload = 50;
}
$load = current_load();
if ($load) {
if (intval($load) > $maxsysload) {
logger('system: load '.$load.' too high.');
logger('system: load '.$load.' for '.$process.' tasks ('.$maxsysload.') too high.');
return true;
}
}
@ -1140,13 +1292,46 @@ class App {
logger("killed stale process");
// Calling a new instance
if ($task != "")
proc_run('php', $task);
proc_run(PRIORITY_MEDIUM, $task);
}
return true;
}
}
return false;
}
function proc_run($args) {
// Add the php path if it is a php call
if (count($args) && ($args[0] === 'php' OR is_int($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")) {
if ((time() - get_config("system", "proc_run_started")) < 10)
return;
// Set the timestamp of the last proc_run
set_config("system", "proc_run_started", time());
}
$args[0] = ((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();
for($x = 0; $x < count($args); $x ++)
$args[$x] = escapeshellarg($args[$x]);
$cmdline = implode($args," ");
if(get_config('system','proc_windows'))
proc_close(proc_open('cmd /c start /b ' . $cmdline,array(),$foo,dirname(__FILE__)));
else
proc_close(proc_open($cmdline." &",array(),$foo,dirname(__FILE__)));
}
}
/**
@ -1262,7 +1447,7 @@ function check_db() {
$build = DB_UPDATE_VERSION;
}
if($build != DB_UPDATE_VERSION)
proc_run('php', 'include/dbupdate.php');
proc_run(PRIORITY_CRITICAL, 'include/dbupdate.php');
}
@ -1412,7 +1597,7 @@ function run_update_function($x) {
function check_plugins(&$a) {
$r = q("SELECT * FROM `addon` WHERE `installed` = 1");
if(dba::is_result($r))
if(dbm::is_result($r))
$installed = $r;
else
$installed = array();
@ -1515,20 +1700,20 @@ function login($register = false, $hiddens=false) {
$o .= replace_macros($tpl, array(
'$dest_url' => $dest_url,
'$logout' => t('Logout'),
'$login' => t('Login'),
'$dest_url' => $dest_url,
'$logout' => t('Logout'),
'$login' => t('Login'),
'$lname' => array('username', t('Nickname or Email address: ') , '', ''),
'$lname' => array('username', t('Nickname or Email: ') , '', ''),
'$lpassword' => array('password', t('Password: '), '', ''),
'$lremember' => array('remember', t('Remember me'), 0, ''),
'$openid' => !$noid,
'$lopenid' => array('openid_url', t('Or login using OpenID: '),'',''),
'$openid' => !$noid,
'$lopenid' => array('openid_url', t('Or login using OpenID: '),'',''),
'$hiddens' => $hiddens,
'$hiddens' => $hiddens,
'$register' => $reg,
'$register' => $reg,
'$lostpass' => t('Forgot your password?'),
'$lostlink' => t('Password Reset'),
@ -1550,7 +1735,10 @@ function login($register = false, $hiddens=false) {
* @brief Used to end the current process, after saving session state.
*/
function killme() {
session_write_close();
if (!get_app()->is_backend())
session_write_close();
exit;
}
@ -1635,10 +1823,11 @@ 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 $cmd program to run
* @param (string|integer) $cmd program to run or priority
*
* 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);
*
* @note $cmd and string args are surrounded with ""
*
@ -1652,7 +1841,7 @@ function proc_run($cmd){
$args = func_get_args();
$newargs = array();
if(! count($args))
if (!count($args))
return;
// expand any arrays
@ -1662,8 +1851,7 @@ function proc_run($cmd){
foreach($arg as $n) {
$newargs[] = $n;
}
}
else
} else
$newargs[] = $arg;
}
@ -1672,62 +1860,55 @@ function proc_run($cmd){
$arr = array('args' => $args, 'run_cmd' => true);
call_hooks("proc_run", $arr);
if(! $arr['run_cmd'])
if (!$arr['run_cmd'] OR !count($args))
return;
if(count($args) && $args[0] === 'php') {
if (get_config("system", "worker")) {
$argv = $args;
array_shift($argv);
$parameters = json_encode($argv);
$found = q("SELECT `id` FROM `workerqueue` WHERE `parameter` = '%s'",
dbesc($parameters));
if (!$found)
q("INSERT INTO `workerqueue` (`parameter`, `created`, `priority`)
VALUES ('%s', '%s', %d)",
dbesc($parameters),
dbesc(datetime_convert()),
intval(0));
if (!get_config("system", "worker") OR
(($args[0] != 'php') AND !is_int($args[0]))) {
$a->proc_run($args);
return;
}
// Should we quit and wait for the poller to be called as a cronjob?
if (get_config("system", "worker_dont_fork"))
return;
if (is_int($args[0]))
$priority = $args[0];
else
$priority = PRIORITY_MEDIUM;
// Checking number of workers
$workers = q("SELECT COUNT(*) AS `workers` FROM `workerqueue` WHERE `executed` != '0000-00-00 00:00:00'");
$argv = $args;
array_shift($argv);
// Get number of allowed number of worker threads
$queues = intval(get_config("system", "worker_queues"));
$parameters = json_encode($argv);
$found = q("SELECT `id` FROM `workerqueue` WHERE `parameter` = '%s'",
dbesc($parameters));
if ($queues == 0)
$queues = 4;
if (!$found)
q("INSERT INTO `workerqueue` (`parameter`, `created`, `priority`)
VALUES ('%s', '%s', %d)",
dbesc($parameters),
dbesc(datetime_convert()),
intval($priority));
// If there are already enough workers running, don't fork another one
if ($workers[0]["workers"] >= $queues)
return;
// Should we quit and wait for the poller to be called as a cronjob?
if (get_config("system", "worker_dont_fork"))
return;
// Now call the poller to execute the jobs that we just added to the queue
$args = array("php", "include/poller.php", "no_cron");
}
// Checking number of workers
$workers = q("SELECT COUNT(*) AS `workers` FROM `workerqueue` WHERE `executed` != '0000-00-00 00:00:00'");
$args[0] = ((x($a->config,'php_path')) && (strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
}
// Get number of allowed number of worker threads
$queues = intval(get_config("system", "worker_queues"));
// add baseurl to args. cli scripts can't construct it
$args[] = $a->get_baseurl();
if ($queues == 0)
$queues = 4;
for($x = 0; $x < count($args); $x ++)
$args[$x] = escapeshellarg($args[$x]);
// If there are already enough workers running, don't fork another one
if ($workers[0]["workers"] >= $queues)
return;
$cmdline = implode($args," ");
// Now call the poller to execute the jobs that we just added to the queue
$args = array("php", "include/poller.php", "no_cron");
if(get_config('system','proc_windows'))
proc_close(proc_open('cmd /c start /b ' . $cmdline,array(),$foo,dirname(__FILE__)));
else
proc_close(proc_open($cmdline." &",array(),$foo,dirname(__FILE__)));
$a->proc_run($args);
}
function current_theme(){
@ -1743,7 +1924,7 @@ function current_theme(){
$r = q("select theme from user where uid = %d limit 1",
intval($a->profile_uid)
);
if(dba::is_result($r))
if(dbm::is_result($r))
$page_theme = $r[0]['theme'];
}
@ -1856,7 +2037,7 @@ function feed_birthday($uid,$tz) {
intval($uid)
);
if(dba::is_result($p)) {
if(dbm::is_result($p)) {
$tmp_dob = substr($p[0]['dob'],5);
if(intval($tmp_dob)) {
$y = datetime_convert($tz,$tz,'now','Y');
@ -1888,32 +2069,6 @@ function is_site_admin() {
return false;
}
function load_contact_links($uid) {
$a = get_app();
$ret = array();
if(! $uid || x($a->contacts,'empty'))
return;
$r = q("SELECT `id`,`network`,`url`,`thumb`, `rel` FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `thumb` != ''",
intval($uid)
);
if(dba::is_result($r)) {
foreach($r as $rr){
$url = normalise_link($rr['url']);
$ret[$url] = $rr;
}
} else
$ret['empty'] = true;
$a->contacts = $ret;
return;
}
/**
* @brief Returns querystring as string from a mapped array.
*
@ -2178,7 +2333,7 @@ function current_load() {
if (!is_array($load_arr))
return false;
return max($load_arr);
return max($load_arr[0], $load_arr[1]);
}
/**
@ -2202,3 +2357,43 @@ function argv($x) {
return '';
}
/**
* @brief Get the data which is needed for infinite scroll
*
* For invinite scroll we need the page number of the actual page
* and the the URI where the content of the next page comes from.
* This data is needed for the js part in main.js.
* Note: infinite scroll does only work for the network page (module)
*
* @param string $module The name of the module (e.g. "network")
* @return array Of infinite scroll data
* 'pageno' => $pageno The number of the actual page
* 'reload_uri' => $reload_uri The URI of the content we have to load
*/
function infinite_scroll_data($module) {
if (get_pconfig(local_user(),'system','infinite_scroll')
AND ($module == "network") AND ($_GET["mode"] != "minimal")) {
// get the page number
if (is_string($_GET["page"]))
$pageno = $_GET["page"];
else
$pageno = 1;
$reload_uri = "";
// try to get the uri from which we load the content
foreach ($_GET AS $param => $value)
if (($param != "page") AND ($param != "q"))
$reload_uri .= "&".$param."=".urlencode($value);
if (($a->page_offset != "") AND !strstr($reload_uri, "&offset="))
$reload_uri .= "&offset=".urlencode($a->page_offset);
$arr = array("pageno" => $pageno, "reload_uri" => $reload_uri);
return $arr;
}
}

+ 166
- 158
database.sql View File

@ -1,6 +1,6 @@
-- ------------------------------------------
-- Friendica 3.5-dev (Asparagus)
-- DB_UPDATE_VERSION 1195
-- DB_UPDATE_VERSION 1200
-- ------------------------------------------
@ -16,7 +16,7 @@ CREATE TABLE IF NOT EXISTS `addon` (
`timestamp` bigint(20) NOT NULL DEFAULT 0,
`plugin_admin` tinyint(1) NOT NULL DEFAULT 0,
PRIMARY KEY(`id`)
) DEFAULT CHARSET=utf8;
) DEFAULT CHARSET=utf8mb4;
--
-- TABLE attach
@ -31,12 +31,12 @@ CREATE TABLE IF NOT EXISTS `attach` (
`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',
`allow_cid` mediumtext NOT NULL,
`allow_gid` mediumtext NOT NULL,
`deny_cid` mediumtext NOT NULL,
`deny_gid` mediumtext NOT NULL,
`allow_cid` mediumtext,
`allow_gid` mediumtext,
`deny_cid` mediumtext,
`deny_gid` mediumtext,
PRIMARY KEY(`id`)
) DEFAULT CHARSET=utf8;
) DEFAULT CHARSET=utf8mb4;
--
-- TABLE auth_codes
@ -48,19 +48,19 @@ CREATE TABLE IF NOT EXISTS `auth_codes` (
`expires` int(11) NOT NULL DEFAULT 0,
`scope` varchar(250) NOT NULL DEFAULT '',
PRIMARY KEY(`id`)
) DEFAULT CHARSET=utf8;
) DEFAULT CHARSET=utf8mb4;
--
-- TABLE cache
--
CREATE TABLE IF NOT EXISTS `cache` (
`k` varchar(255) NOT NULL,
`v` text NOT NULL,
`v` text,
`expire_mode` int(11) NOT NULL DEFAULT 0,
`updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY(`k`),
INDEX `updated` (`updated`)
) DEFAULT CHARSET=utf8;
) DEFAULT CHARSET=utf8mb4;
--
-- TABLE challenge
@ -73,7 +73,7 @@ CREATE TABLE IF NOT EXISTS `challenge` (
`type` varchar(255) NOT NULL DEFAULT '',
`last_update` varchar(255) NOT NULL DEFAULT '',
PRIMARY KEY(`id`)
) DEFAULT CHARSET=utf8;
) DEFAULT CHARSET=utf8mb4;
--
-- TABLE clients
@ -86,7 +86,7 @@ CREATE TABLE IF NOT EXISTS `clients` (
`icon` text,
`uid` int(11) NOT NULL DEFAULT 0,
PRIMARY KEY(`client_id`)
) DEFAULT CHARSET=utf8;
) DEFAULT CHARSET=utf8mb4;
--
-- TABLE config
@ -95,10 +95,10 @@ CREATE TABLE IF NOT EXISTS `config` (
`id` int(10) unsigned NOT NULL auto_increment,
`cat` varchar(255) NOT NULL DEFAULT '',
`k` varchar(255) NOT NULL DEFAULT '',
`v` text NOT NULL,
`v` text,
PRIMARY KEY(`id`),
INDEX `cat_k` (`cat`(30),`k`(30))
) DEFAULT CHARSET=utf8;
) DEFAULT CHARSET=utf8mb4;
--
-- TABLE contact
@ -115,29 +115,29 @@ CREATE TABLE IF NOT EXISTS `contact` (
`name` varchar(255) NOT NULL DEFAULT '',
`nick` varchar(255) NOT NULL DEFAULT '',
`location` varchar(255) NOT NULL DEFAULT '',
`about` text NOT NULL,
`keywords` text NOT NULL,
`about` text,
`keywords` text,
`gender` varchar(32) NOT NULL DEFAULT '',
`attag` varchar(255) NOT NULL DEFAULT '',
`avatar` varchar(255) NOT NULL DEFAULT '',
`photo` text NOT NULL,
`thumb` text NOT NULL,
`micro` text NOT NULL,
`site-pubkey` text NOT NULL,
`photo` text,
`thumb` text,
`micro` text,
`site-pubkey` text,
`issued-id` varchar(255) NOT NULL DEFAULT '',
`dfrn-id` varchar(255) NOT NULL DEFAULT '',
`url` varchar(255) NOT NULL DEFAULT '',
`nurl` varchar(255) NOT NULL DEFAULT '',
`addr` varchar(255) NOT NULL DEFAULT '',
`alias` varchar(255) NOT NULL DEFAULT '',
`pubkey` text NOT NULL,
`prvkey` text NOT NULL,
`pubkey` text,
`prvkey` text,
`batch` varchar(255) NOT NULL DEFAULT '',
`request` text NOT NULL,
`notify` text NOT NULL,
`poll` text NOT NULL,
`confirm` text NOT NULL,
`poco` text NOT NULL,
`request` text,
`notify` text,
`poll` text,
`confirm` text,
`poco` text,
`aes_allow` tinyint(1) NOT NULL DEFAULT 0,
`ret-aes` tinyint(1) NOT NULL DEFAULT 0,
`usehub` tinyint(1) NOT NULL DEFAULT 0,
@ -161,19 +161,19 @@ CREATE TABLE IF NOT EXISTS `contact` (
`archive` tinyint(1) NOT NULL DEFAULT 0,
`pending` tinyint(1) NOT NULL DEFAULT 1,
`rating` tinyint(1) NOT NULL DEFAULT 0,
`reason` text NOT NULL,
`reason` text,
`closeness` tinyint(2) NOT NULL DEFAULT 99,
`info` mediumtext NOT NULL,
`info` mediumtext,
`profile-id` int(11) NOT NULL DEFAULT 0,
`bdyear` varchar(4) NOT NULL DEFAULT '',
`bd` date NOT NULL DEFAULT '0000-00-00',
`notify_new_posts` tinyint(1) NOT NULL DEFAULT 0,
`fetch_further_information` tinyint(1) NOT NULL DEFAULT 0,
`ffi_keyword_blacklist` mediumtext NOT NULL,
`ffi_keyword_blacklist` mediumtext,
PRIMARY KEY(`id`),
INDEX `uid` (`uid`),
INDEX `nurl` (`nurl`)
) DEFAULT CHARSET=utf8;
) DEFAULT CHARSET=utf8mb4;
--
-- TABLE conv
@ -181,15 +181,15 @@ CREATE TABLE IF NOT EXISTS `contact` (
CREATE TABLE IF NOT EXISTS `conv` (
`id` int(10) unsigned NOT NULL auto_increment,
`guid` varchar(64) NOT NULL DEFAULT '',
`recips` mediumtext NOT NULL,
`recips` mediumtext,
`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',
`subject` mediumtext NOT NULL,
`subject` mediumtext,
PRIMARY KEY(`id`),
INDEX `uid` (`uid`)
) DEFAULT CHARSET=utf8;
) DEFAULT CHARSET=utf8mb4;
--
-- TABLE deliverq
@ -200,7 +200,7 @@ CREATE TABLE IF NOT EXISTS `deliverq` (
`item` int(11) NOT NULL DEFAULT 0,
`contact` int(11) NOT NULL DEFAULT 0,
PRIMARY KEY(`id`)
) DEFAULT CHARSET=utf8;
) DEFAULT CHARSET=utf8mb4;
--
-- TABLE event
@ -214,26 +214,27 @@ CREATE TABLE IF NOT EXISTS `event` (
`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',
`summary` text NOT NULL,
`desc` text NOT NULL,
`location` text NOT NULL,
`summary` text,
`desc` text,
`location` text,
`type` varchar(255) NOT NULL DEFAULT '',
`nofinish` tinyint(1) NOT NULL DEFAULT 0,
`adjust` tinyint(1) NOT NULL DEFAULT 1,
`ignore` tinyint(1) unsigned NOT NULL DEFAULT 0,
`allow_cid` mediumtext NOT NULL,
`allow_gid` mediumtext NOT NULL,
`deny_cid` mediumtext NOT NULL,
`deny_gid` mediumtext NOT NULL,
`allow_cid` mediumtext,
`allow_gid` mediumtext,
`deny_cid` mediumtext,
`deny_gid` mediumtext,
PRIMARY KEY(`id`),
INDEX `uid` (`uid`)
) DEFAULT CHARSET=utf8;
) DEFAULT CHARSET=utf8mb4;
--
-- TABLE fcontact
--
CREATE TABLE IF NOT EXISTS `fcontact` (
`id` int(10) unsigned NOT NULL auto_increment,
`guid` varchar(255) NOT NULL DEFAULT '',
`url` varchar(255) NOT NULL DEFAULT '',
`name` varchar(255) NOT NULL DEFAULT '',
`photo` varchar(255) NOT NULL DEFAULT '',
@ -247,11 +248,11 @@ CREATE TABLE IF NOT EXISTS `fcontact` (
`priority` tinyint(1) NOT NULL DEFAULT 0,
`network` varchar(32) NOT NULL DEFAULT '',
`alias` varchar(255) NOT NULL DEFAULT '',
`pubkey` text NOT NULL,
`pubkey` text,
`updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY(`id`),
INDEX `addr` (`addr`)
) DEFAULT CHARSET=utf8;
) DEFAULT CHARSET=utf8mb4;
--
-- TABLE ffinder
@ -262,7 +263,7 @@ CREATE TABLE IF NOT EXISTS `ffinder` (
`cid` int(10) unsigned NOT NULL DEFAULT 0,
`fid` int(10) unsigned NOT NULL DEFAULT 0,
PRIMARY KEY(`id`)
) DEFAULT CHARSET=utf8;
) DEFAULT CHARSET=utf8mb4;
--
-- TABLE fserver
@ -271,10 +272,10 @@ CREATE TABLE IF NOT EXISTS `fserver` (
`id` int(11) NOT NULL auto_increment,
`server` varchar(255) NOT NULL DEFAULT '',
`posturl` varchar(255) NOT NULL DEFAULT '',
`key` text NOT NULL,
`key` text,
PRIMARY KEY(`id`),
INDEX `server` (`server`)
) DEFAULT CHARSET=utf8;
) DEFAULT CHARSET=utf8mb4;
--
-- TABLE fsuggest
@ -287,10 +288,10 @@ CREATE TABLE IF NOT EXISTS `fsuggest` (
`url` varchar(255) NOT NULL DEFAULT '',
`request` varchar(255) NOT NULL DEFAULT '',
`photo` varchar(255) NOT NULL DEFAULT '',
`note` text NOT NULL,
`note` text,
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY(`id`)
) DEFAULT CHARSET=utf8;
) DEFAULT CHARSET=utf8mb4;
--
-- TABLE gcign
@ -302,7 +303,7 @@ CREATE TABLE IF NOT EXISTS `gcign` (
PRIMARY KEY(`id`),
INDEX `uid` (`uid`),
INDEX `gcid` (`gcid`)
) DEFAULT CHARSET=utf8;
) DEFAULT CHARSET=utf8mb4;
--
-- TABLE gcontact
@ -320,8 +321,8 @@ CREATE TABLE IF NOT EXISTS `gcontact` (
`last_contact` datetime DEFAULT '0000-00-00 00:00:00',
`last_failure` datetime DEFAULT '0000-00-00 00:00:00',
`location` varchar(255) NOT NULL DEFAULT '',
`about` text NOT NULL,
`keywords` text NOT NULL,
`about` text,
`keywords` text,
`gender` varchar(32) NOT NULL DEFAULT '',
`birthday` varchar(32) NOT NULL DEFAULT '0000-00-00',
`community` tinyint(1) NOT NULL DEFAULT 0,
@ -329,7 +330,7 @@ CREATE TABLE IF NOT EXISTS `gcontact` (
`nsfw` tinyint(1) NOT NULL DEFAULT 0,
`network` varchar(255) NOT NULL DEFAULT '',
`addr` varchar(255) NOT NULL DEFAULT '',
`notify` text NOT NULL,
`notify` text,
`alias` varchar(255) NOT NULL DEFAULT '',
`generation` tinyint(3) NOT NULL DEFAULT 0,
`server_url` varchar(255) NOT NULL DEFAULT '',
@ -339,7 +340,7 @@ CREATE TABLE IF NOT EXISTS `gcontact` (
INDEX `nick` (`nick`),
INDEX `addr` (`addr`),
INDEX `updated` (`updated`)
) DEFAULT CHARSET=utf8;
) DEFAULT CHARSET=utf8mb4;
--
-- TABLE glink
@ -355,7 +356,7 @@ CREATE TABLE IF NOT EXISTS `glink` (
INDEX `cid_uid_gcid_zcid` (`cid`,`uid`,`gcid`,`zcid`),
INDEX `gcid` (`gcid`),
INDEX `zcid` (`zcid`)
) DEFAULT CHARSET=utf8;
) DEFAULT CHARSET=utf8mb4;
--
-- TABLE group
@ -368,7 +369,7 @@ CREATE TABLE IF NOT EXISTS `group` (
`name` varchar(255) NOT NULL DEFAULT '',
PRIMARY KEY(`id`),
INDEX `uid` (`uid`)
) DEFAULT CHARSET=utf8;
) DEFAULT CHARSET=utf8mb4;
--
-- TABLE group_member
@ -380,7 +381,7 @@ CREATE TABLE IF NOT EXISTS `group_member` (
`contact-id` int(10) unsigned NOT NULL DEFAULT 0,
PRIMARY KEY(`id`),
INDEX `uid_gid_contactid` (`uid`,`gid`,`contact-id`)
) DEFAULT CHARSET=utf8;
) DEFAULT CHARSET=utf8mb4;
--
-- TABLE gserver
@ -391,7 +392,7 @@ CREATE TABLE IF NOT EXISTS `gserver` (
`nurl` varchar(255) NOT NULL DEFAULT '',
`version` varchar(255) NOT NULL DEFAULT '',
`site_name` varchar(255) NOT NULL DEFAULT '',
`info` text NOT NULL,
`info` text,
`register_policy` tinyint(1) NOT NULL DEFAULT 0,
`poco` varchar(255) NOT NULL DEFAULT '',
`noscrape` varchar(255) NOT NULL DEFAULT '',
@ -403,7 +404,7 @@ CREATE TABLE IF NOT EXISTS `gserver` (
`last_failure` datetime DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY(`id`),
INDEX `nurl` (`nurl`)
) DEFAULT CHARSET=utf8;
) DEFAULT CHARSET=utf8mb4;
--
-- TABLE hook
@ -416,7 +417,7 @@ CREATE TABLE IF NOT EXISTS `hook` (
`priority` int(11) unsigned NOT NULL DEFAULT 0,
PRIMARY KEY(`id`),
INDEX `hook_file_function` (`hook`(30),`file`(60),`function`(30))
) DEFAULT CHARSET=utf8;
) DEFAULT CHARSET=utf8mb4;
--
-- TABLE intro
@ -428,13 +429,13 @@ CREATE TABLE IF NOT EXISTS `intro` (
`contact-id` int(11) NOT NULL DEFAULT 0,
`knowyou` tinyint(1) NOT NULL DEFAULT 0,
`duplex` tinyint(1) NOT NULL DEFAULT 0,
`note` text NOT NULL,
`note` text,
`hash` varchar(255) NOT NULL DEFAULT '',
`datetime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`blocked` tinyint(1) NOT NULL DEFAULT 1,
`ignore` tinyint(1) NOT NULL DEFAULT 0,
PRIMARY KEY(`id`)
) DEFAULT CHARSET=utf8;
) DEFAULT CHARSET=utf8mb4;
--
-- TABLE item
@ -458,34 +459,36 @@ CREATE TABLE IF NOT EXISTS `item` (
`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',
`owner-id` int(11) NOT NULL DEFAULT 0,
`owner-name` varchar(255) NOT NULL DEFAULT '',
`owner-link` varchar(255) NOT NULL DEFAULT '',
`owner-avatar` varchar(255) NOT NULL DEFAULT '',
`author-id` int(11) NOT NULL DEFAULT 0,
`author-name` varchar(255) NOT NULL DEFAULT '',
`author-link` varchar(255) NOT NULL DEFAULT '',
`author-avatar` varchar(255) NOT NULL DEFAULT '',
`title` varchar(255) NOT NULL DEFAULT '',
`body` mediumtext NOT NULL,
`body` mediumtext,
`app` varchar(255) NOT NULL DEFAULT '',
`verb` varchar(255) NOT NULL DEFAULT '',
`object-type` varchar(255) NOT NULL DEFAULT '',
`object` text NOT NULL,
`object` text,
`target-type` varchar(255) NOT NULL DEFAULT '',
`target` text NOT NULL,
`postopts` text NOT NULL,
`target` text,
`postopts` text,
`plink` varchar(255) NOT NULL DEFAULT '',
`resource-id` varchar(255) NOT NULL DEFAULT '',
`event-id` int(11) NOT NULL DEFAULT 0,
`tag` mediumtext NOT NULL,
`attach` mediumtext NOT NULL,
`inform` mediumtext NOT NULL,
`file` mediumtext NOT NULL,
`tag` mediumtext,
`attach` mediumtext,
`inform` mediumtext,
`file` mediumtext,
`location` varchar(255) NOT NULL DEFAULT '',
`coord` varchar(255) NOT NULL DEFAULT '',
`allow_cid` mediumtext NOT NULL,
`allow_gid` mediumtext NOT NULL,
`deny_cid` mediumtext NOT NULL,
`deny_gid` mediumtext NOT NULL,
`allow_cid` mediumtext,
`allow_gid` mediumtext,
`deny_cid` mediumtext,
`deny_gid` mediumtext,
`private` tinyint(1) NOT NULL DEFAULT 0,
`pubmail` tinyint(1) NOT NULL DEFAULT 0,
`moderated` tinyint(1) NOT NULL DEFAULT 0,
@ -501,7 +504,7 @@ CREATE TABLE IF NOT EXISTS `item` (
`mention` tinyint(1) NOT NULL DEFAULT 0,
`network` varchar(32) NOT NULL DEFAULT '',
`rendered-hash` varchar(32) NOT NULL DEFAULT '',
`rendered-html` mediumtext NOT NULL,
`rendered-html` mediumtext,
`global` tinyint(1) NOT NULL DEFAULT 0,
PRIMARY KEY(`id`),
INDEX `guid` (`guid`),
@ -511,7 +514,7 @@ CREATE TABLE IF NOT EXISTS `item` (
INDEX `extid` (`extid`),
INDEX `uid_id` (`uid`,`id`),
INDEX `uid_created` (`uid`,`created`),
INDEX `uid_unseen` (`uid`,`unseen`),
INDEX `uid_unseen_contactid` (`uid`,`unseen`,`contact-id`),
INDEX `uid_network_received` (`uid`,`network`,`received`),
INDEX `uid_received` (`uid`,`received`),
INDEX `uid_network_commented` (`uid`,`network`,`commented`),
@ -519,15 +522,18 @@ CREATE TABLE IF NOT EXISTS `item` (
INDEX `uid_title` (`uid`,`title`),
INDEX `uid_thrparent` (`uid`,`thr-parent`),
INDEX `uid_parenturi` (`uid`,`parent-uri`),
INDEX `uid_contactid_id` (`uid`,`contact-id`,`id`),
INDEX `uid_contactid_created` (`uid`,`contact-id`,`created`),
INDEX `gcontactid_uid_created` (`gcontact-id`,`uid`,`created`),
INDEX `authorid_created` (`author-id`,`created`),
INDEX `ownerid_created` (`owner-id`,`created`),
INDEX `wall_body` (`wall`,`body`(6)),
INDEX `uid_visible_moderated_created` (`uid`,`visible`,`moderated`,`created`),
INDEX `uid_uri` (`uid`,`uri`),
INDEX `uid_wall_created` (`uid`,`wall`,`created`),
INDEX `resource-id` (`resource-id`),
INDEX `uid_type` (`uid`,`type`),
INDEX `uid_starred` (`uid`,`starred`),
INDEX `uid_starred_id` (`uid`,`starred`,`id`),
INDEX `contactid_allowcid_allowpid_denycid_denygid` (`contact-id`,`allow_cid`(10),`allow_gid`(10),`deny_cid`(10),`deny_gid`(10)),
INDEX `uid_wall_parent_created` (`uid`,`wall`,`parent`,`created`),
INDEX `uid_type_changed` (`uid`,`type`,`changed`),
@ -537,7 +543,7 @@ CREATE TABLE IF NOT EXISTS `item` (
INDEX `uid_eventid` (`uid`,`event-id`),
INDEX `uid_authorlink` (`uid`,`author-link`),
INDEX `uid_ownerlink` (`uid`,`owner-link`)
) DEFAULT CHARSET=utf8;
) DEFAULT CHARSET=utf8mb4;
--
-- TABLE item_id
@ -553,7 +559,7 @@ CREATE TABLE IF NOT EXISTS `item_id` (
INDEX `sid` (`sid`),
INDEX `service` (`service`),
INDEX `iid` (`iid`)
) DEFAULT CHARSET=utf8;
) DEFAULT CHARSET=utf8mb4;
--
-- TABLE locks
@ -564,7 +570,7 @@ CREATE TABLE IF NOT EXISTS `locks` (
`locked` tinyint(1) NOT NULL DEFAULT 0,
`created` datetime DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY(`id`)
) DEFAULT CHARSET=utf8;
) DEFAULT CHARSET=utf8mb4;
--
-- TABLE mail
@ -579,7 +585,7 @@ CREATE TABLE IF NOT EXISTS `mail` (
`contact-id` varchar(255) NOT NULL DEFAULT '',
`convid` int(11) unsigned NOT NULL DEFAULT 0,
`title` varchar(255) NOT NULL DEFAULT '',
`body` mediumtext NOT NULL,
`body` mediumtext,
`seen` tinyint(1) NOT NULL DEFAULT 0,
`reply` tinyint(1) NOT NULL DEFAULT 0,
`replied` tinyint(1) NOT NULL DEFAULT 0,
@ -594,7 +600,7 @@ CREATE TABLE IF NOT EXISTS `mail` (
INDEX `reply` (`reply`),
INDEX `uri` (`uri`),
INDEX `parent-uri` (`parent-uri`)
) DEFAULT CHARSET=utf8;
) DEFAULT CHARSET=utf8mb4;
--
-- TABLE mailacct
@ -607,14 +613,14 @@ CREATE TABLE IF NOT EXISTS `mailacct` (
`ssltype` varchar(16) NOT NULL DEFAULT '',
`mailbox` varchar(255) NOT NULL DEFAULT '',
`user` varchar(255) NOT NULL DEFAULT '',
`pass` text NOT NULL,
`pass` text,
`reply_to` varchar(255) NOT NULL DEFAULT '',
`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',
PRIMARY KEY(`id`)
) DEFAULT CHARSET=utf8;
) DEFAULT CHARSET=utf8mb4;
--
-- TABLE manage
@ -625,7 +631,7 @@ CREATE TABLE IF NOT EXISTS `manage` (
`mid` int(11) NOT NULL DEFAULT 0,
PRIMARY KEY(`id`),
INDEX `uid_mid` (`uid`,`mid`)
) DEFAULT CHARSET=utf8;
) DEFAULT CHARSET=utf8mb4;
--
-- TABLE notify
@ -638,7 +644,7 @@ CREATE TABLE IF NOT EXISTS `notify` (
`url` varchar(255) NOT NULL DEFAULT '',
`photo` varchar(255) NOT NULL DEFAULT '',
`date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`msg` mediumtext NOT NULL,
`msg` mediumtext,
`uid` int(11) NOT NULL DEFAULT 0,
`link` varchar(255) NOT NULL DEFAULT '',
`iid` int(11) NOT NULL DEFAULT 0,
@ -648,7 +654,7 @@ CREATE TABLE IF NOT EXISTS `notify` (
`otype` varchar(16) NOT NULL DEFAULT '',
PRIMARY KEY(`id`),
INDEX `uid` (`uid`)
) DEFAULT CHARSET=utf8;
) DEFAULT CHARSET=utf8mb4;
--
-- TABLE notify-threads
@ -662,18 +668,18 @@ CREATE TABLE IF NOT EXISTS `notify-threads` (
PRIMARY KEY(`id`),
INDEX `master-parent-item` (`master-parent-item`),
INDEX `receiver-uid` (`receiver-uid`)
) DEFAULT CHARSET=utf8;
) DEFAULT CHARSET=utf8mb4;
--
-- TABLE oembed
--
CREATE TABLE IF NOT EXISTS `oembed` (
`url` varchar(255) NOT NULL,
`content` text NOT NULL,
`content` text,
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY(`url`),
INDEX `created` (`created`)
) DEFAULT CHARSET=utf8;
) DEFAULT CHARSET=utf8mb4;
--
-- TABLE parsed_url
@ -682,11 +688,11 @@ CREATE TABLE IF NOT EXISTS `parsed_url` (
`url` varchar(255) NOT NULL,
`guessing` tinyint(1) NOT NULL DEFAULT 0,
`oembed` tinyint(1) NOT NULL DEFAULT 0,
`content` text NOT NULL,
`content` text,
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY(`url`,`guessing`,`oembed`),
INDEX `created` (`created`)
) DEFAULT CHARSET=utf8;
) DEFAULT CHARSET=utf8mb4;
--
-- TABLE pconfig
@ -696,10 +702,10 @@ CREATE TABLE IF NOT EXISTS `pconfig` (
`uid` int(11) NOT NULL DEFAULT 0,
`cat` varchar(255) NOT NULL DEFAULT '',
`k` varchar(255) NOT NULL DEFAULT '',
`v` mediumtext NOT NULL,
`v` mediumtext,
PRIMARY KEY(`id`),
INDEX `uid_cat_k` (`uid`,`cat`(30),`k`(30))
) DEFAULT CHARSET=utf8;
) DEFAULT CHARSET=utf8mb4;
--
-- TABLE photo
@ -713,7 +719,7 @@ CREATE TABLE IF NOT EXISTS `photo` (
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`edited` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`title` varchar(255) NOT NULL DEFAULT '',
`desc` text NOT NULL,
`desc` text,
`album` varchar(255) NOT NULL DEFAULT '',