diff --git a/.codecov.yml b/.codecov.yml index 4592266d81..35509a879e 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -1,36 +1,10 @@ -codecov: - branch: develop - -comment: off coverage: status: - patch: - default: off - source: - target: 80% - flags: source - backend: - target: 80% - flags: backend project: - default: off - source: - flags: source - backend: - flags: backend + default: + target: auto + threshold: null + base: auto -flags: - source: - paths: - - src/ - backend: - paths: - - mod/ - - include/ - binary: - paths: - - bin/ - tests: - paths: - - tests/ +comment: off diff --git a/.gitignore b/.gitignore index 87ce354c1f..0d18ab0bdc 100644 --- a/.gitignore +++ b/.gitignore @@ -71,3 +71,6 @@ venv/ #ignore .htaccess .htaccess + +#ignore filesystem storage default path +/storage diff --git a/.travis.yml b/.travis.yml index f9f9acff19..c66457325f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,10 @@ --- language: php -## Friendica supports PHP version >= 5.6.1 +## Friendica officially supports PHP version >= 7.1 php: - - 5.6 - - 7.0 - 7.1 - 7.2 + - 7.3 services: - mysql diff --git a/CHANGELOG b/CHANGELOG index 01208cbed9..6d908f0f45 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,92 @@ +Version 2019.03 (2019-03-22) + Friendica Core: + Update to the translation (CS, DE, EN-GB, EN-US, ES, FR, IT, PL, SV, ZH-CN) [translation teams] + Update to the documentation [Aditoo17, JeroenED, m4sk1n, softmetz, tobiasd] + Update to the themes (duepuntozero, frio, smoothy, quattro, vier) [lxiter, MrPetovan, nupplaphil, rabuzarus, tobiasd] + Enhancements to the API [jasonscheng] + Enhancements to the Vagrant development VM [JeroenED] + Enhancements to the storage of gender, sexual preferences and maritial status [JeroenED] + Enhancements to the wording of notifications [MrPetovan] + Enhancements to the display of contacts in the profile [MrPetovan] + Enhancements to the handling of local links [lxiter] + Enhancements to the explicit and implicit mentioning in conversations [annando, MrPetovan] + Enhancements to the warnings in the admin panel [tobiasd] + Enhancements to the AP implementation [annando] + Enhancements to the worker process [annando] + Enhancements to the testing process [MrPetovan, nupplaphil] + Enhancements to the LibreJS compatibility [tobiasd] + Enhancements to the federated display of postings [MrPetovan] + Enhancements to the photo menu [annando] + Enhancements to the probing of contacts [annando] + Fixed several bugs with weird tagging in code blocks [lxiter] + Fixed a bug during contact entries update [rabuzarus] + Fixed several PHP warnings and errors [annando, MrPetovan, tobiasd] + Fixed an issue when Friendica is installed in a subdirectory [rabuzarus] + Fixed several issues in the handling of the Markdown parsing from and to d* [lxiter, MrPetovan] + Fixed a bug that prevented blocked contacts from being removed from groups [MrPetovan] + Fixed a bug in the ACL with preselected items [lxiter] + Fixed an issue with polling Events via AP [annando] + Fixed a memory issue with the JSON-LD parser [annando] + Fixed an issue with the forced DB structure update [nupplaphil] + Fixed an issue with wrongly encoded HTML entities in URLs [annando] + Fixed an issue with the rotation of images in the gallery [nupplaphil] + Fixed issues with redirs in the photo menu of Friendica contacts [tobiasd] + Fixed an issue with sending out notification mails to the admin [nupplaphil] + Fixed an the issue, that the API was ignoring the globalsilence setting [nupplaphil] + Fixed issues with the autolinker of URLs in postings [MrPetovan] + Fixed an issue resulting in multible emails after successful updates of the database [nupplaphil] + Fixed a timeout issue during detection process of the remote profile [annando] + Fixed an issue with postings from blocked servers [annando, MrPetovan] + Fixed an issue with the paging of stored folders [MrPetovan] + Fixed an issue with notifications about interactions with Friendica contacts [annando] + Fixed an issue that caused double postings of images uploaded to the gallery [annando] + Fixed an issue handling legacy config files [nupplaphil] + Fixed an issue that caused notifications about interaction with a locally deleted posting [annando] + If the node does not want to publish information, nodeinfo now returns 404 instead of non-existing entries [nupplaphil] + General Code cleaning and restructuring [annando, JeroenED, MrPetovan, nupplaphil] + Switched logging engine to monolog [nupplaphil] + Added plugable storage backend [fabrixxm, nupplaphil] + Added item delivery indicator to posting header [MrPetovan] + Added URL parameter to force a specific language [JeroenED] + Added live preview of attachments to frio [rabuzarus] + Added a "friendica_author" field to the API results which holds the real author [annando] + Added support for AP with forum postings [annando] + Added a summary of articles send over AP [annando] + + Friendica Addons: + Updates to the translations (CS, DE, EN-GB, ES, FR, NL, PL, SV) [translation teams] + Updated documentation [softmetz, tobiasd] + blackout: + Fix applying the translations [JeroenED, tobiasd] + Fixed some templating of the settings [tobiasd] + blogger: + The addon was marked as unsupported as it does currently not work (needs OAuth support) [annando] + cookienotice: + Added new addon to display a cookie usage notice in the browser [lxiter] + forumdirectory: + Fixed a theming issue with frio [rabuzarus] + js_upload: + Fixed a missing extionsion index [nupplaphil] + mailstream: + Fixed a curl issue [MrPetovan] + piwik: + Make it clear that Piwik is now Matomo but the addon supports both [tobiasd] + securemail: + updated the addon dependencies [MrPetovan] + twitter: + @ mentions are now stripped from the posts send to Twitter [MrPetovan] + + Closed Issues: + 1777, 2487, 3218, 3506, 3837, 4496, 5884, 6087, 6161, 6167, 6205, + 6232, 6263, 6274, 6292, 6337, 6338, 6375, 6378, 6382, 6384, 6386, + 6403, 6405, 6449, 6468, 6472, 6489, 6491, 6492, 6495, 6498, 6501, + 6503, 6505, 6511, 6514, 6521, 6522, 6529, 6532, 6533, 6544, 6545, + 6551, 6553, 6537, 6558, 6552, 6561, 6570, 6575, 6585, 6603, 6610, + 6629, 6630, 6633, 6635, 6652, 6656, 6658, 6667, 6668, 6669, 6672, + 6674, 6676, 6677, 6679, 6691, 6710, 6711, 6714, 6716, 6733, 6758, + 6772, 6778, 6785, 6788, 6800, 6805, 6812, 6819, 6822, 6823, 6840, + 6855, 6866, 6874, 6891, 6901, 6913 + Version 2019.01 (2019-01-21) Friendica Core: Update to the translation (CS, DE, EN-UK, EN-US, FR, NB-NO, NL, PL) [translation teams] diff --git a/CREDITS.txt b/CREDITS.txt index 79f6dc10bf..3b3e6ad308 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -1,11 +1,11 @@ 23n Abinoam P. Marques Jr. +Abraham Pérez Hernández Abrax Adam Clark Adam Jurkiewicz Adam Magness Aditoo -Aditoo17 AgnesElisa Albert Alberto Díaz Tormo @@ -23,7 +23,6 @@ André Alves André Lohan Andy Andy Hee -AndyHee Angristan Anthronaut Arian - Cazare Muncitori @@ -93,10 +92,8 @@ greeneyedred Gregory Smith Haakon Meland Eriksen Hans Meine -hauke Hauke Hauke Altmann -Hauke Zühl Herbert Thielen hoergen Hubert Kościański @@ -167,6 +164,7 @@ Pascal Pascal Deklerck Pavel Morozov PerigGouanvic +Peter Liebetrau peturisfeld Philipp Philipp Holzer @@ -201,6 +199,7 @@ Seth Silke Meyer Simon L'nu Simó Albert i Beltran +softmetz soko1 St John Karp Stanislav N. @@ -233,12 +232,14 @@ Tubuntu Tupambae.org U-SOUND\mike ufic +Ulf Rompe Unknown Vasudev Kamath Vasya Novikov Vinzenz Vietzke vislav vladimir N +Vladimir Núñez VVelox Vít Šesták 'v6ak' Waldemar Stoczkowski diff --git a/VERSION b/VERSION index ca54cd8e0c..78b7dcf0ce 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2019.01 +2019.03 diff --git a/bin/auth_ejabberd.php b/bin/auth_ejabberd.php index e8a7b4963f..bf6d069d12 100755 --- a/bin/auth_ejabberd.php +++ b/bin/auth_ejabberd.php @@ -32,7 +32,7 @@ * */ -use Friendica\App; +use Friendica\Factory; use Friendica\Util\ExAuth; if (sizeof($_SERVER["argv"]) == 0) { @@ -51,7 +51,7 @@ chdir($directory); require dirname(__DIR__) . '/vendor/autoload.php'; -$a = new App(dirname(__DIR__)); +$a = Factory\DependencyFactory::setUp('auth_ejabbered', dirname(__DIR__)); if ($a->getMode()->isNormal()) { $oAuth = new ExAuth(); diff --git a/bin/console.php b/bin/console.php index c39df953f2..410eabda09 100755 --- a/bin/console.php +++ b/bin/console.php @@ -3,7 +3,9 @@ require dirname(__DIR__) . '/vendor/autoload.php'; -$a = new Friendica\App(dirname(__DIR__)); +use Friendica\Factory; + +$a = Factory\DependencyFactory::setUp('console', dirname(__DIR__)); \Friendica\BaseObject::setApp($a); (new Friendica\Core\Console($argv))->execute(); diff --git a/bin/daemon.php b/bin/daemon.php index e60e32b19e..298cfa2534 100755 --- a/bin/daemon.php +++ b/bin/daemon.php @@ -7,11 +7,11 @@ * This script was taken from http://php.net/manual/en/function.pcntl-fork.php */ -use Friendica\App; use Friendica\Core\Config; use Friendica\Core\Logger; use Friendica\Core\Worker; use Friendica\Database\DBA; +use Friendica\Factory; // Get options $shortopts = 'f'; @@ -32,7 +32,7 @@ if (!file_exists("boot.php") && (sizeof($_SERVER["argv"]) != 0)) { require dirname(__DIR__) . '/vendor/autoload.php'; -$a = new App(dirname(__DIR__)); +$a = Factory\DependencyFactory::setUp('daemon', dirname(__DIR__)); if ($a->getMode()->isInstall()) { die("Friendica isn't properly installed yet.\n"); @@ -102,7 +102,7 @@ if ($mode == "stop") { unlink($pidfile); - Logger::log("Worker daemon process $pid was killed.", Logger::DEBUG); + Logger::notice("Worker daemon process was killed", ["pid" => $pid]); Config::set('system', 'worker_daemon_mode', false); die("Worker daemon process $pid was killed.\n"); @@ -112,7 +112,7 @@ if (!empty($pid) && posix_kill($pid, 0)) { die("Daemon process $pid is already running.\n"); } -Logger::log('Starting worker daemon.', Logger::DEBUG); +Logger::notice('Starting worker daemon.', ["pid" => $pid]); if (!$foreground) { echo "Starting worker daemon.\n"; @@ -144,7 +144,9 @@ if (!$foreground) { file_put_contents($pidfile, $pid); // We lose the database connection upon forking - $a->loadDatabase(); + /// @todo refactoring during https://github.com/friendica/friendica/issues/6720 + $basePath = \Friendica\Util\BasePath::create(dirname(__DIR__), $_SERVER); + Factory\DBFactory::init($basePath, $a->getConfigCache(), $a->getProfiler(), $_SERVER); } Config::set('system', 'worker_daemon_mode', true); @@ -160,7 +162,7 @@ $last_cron = 0; // Now running as a daemon. while (true) { if (!$do_cron && ($last_cron + $wait_interval) < time()) { - Logger::log('Forcing cron worker call.', Logger::DEBUG); + Logger::info('Forcing cron worker call.', ["pid" => $pid]); $do_cron = true; } @@ -174,7 +176,7 @@ while (true) { $last_cron = time(); } - Logger::log("Sleeping", Logger::DEBUG); + Logger::info("Sleeping", ["pid" => $pid]); $start = time(); do { $seconds = (time() - $start); @@ -191,10 +193,10 @@ while (true) { if ($timeout) { $do_cron = true; - Logger::log("Woke up after $wait_interval seconds.", Logger::DEBUG); + Logger::info("Woke up after $wait_interval seconds.", ["pid" => $pid, 'sleep' => $wait_interval]); } else { $do_cron = false; - Logger::log("Worker jobs are calling to be forked.", Logger::DEBUG); + Logger::info("Worker jobs are calling to be forked.", ["pid" => $pid]); } } diff --git a/bin/worker.php b/bin/worker.php index 78b6da5857..c7174d81e1 100755 --- a/bin/worker.php +++ b/bin/worker.php @@ -4,10 +4,12 @@ * @file bin/worker.php * @brief Starts the background processing */ + use Friendica\App; use Friendica\Core\Config; -use Friendica\Core\Worker; use Friendica\Core\Update; +use Friendica\Core\Worker; +use Friendica\Factory; // Get options $shortopts = 'sn'; @@ -28,10 +30,10 @@ if (!file_exists("boot.php") && (sizeof($_SERVER["argv"]) != 0)) { require dirname(__DIR__) . '/vendor/autoload.php'; -$a = new App(dirname(__DIR__)); +$a = Factory\DependencyFactory::setUp('worker', dirname(__DIR__)); // Check the database structure and possibly fixes it -Update::check(true); +Update::check($a->getBasePath(), true); // Quit when in maintenance if (!$a->getMode()->has(App\Mode::MAINTENANCEDISABLED)) { @@ -44,7 +46,7 @@ $spawn = array_key_exists('s', $options) || array_key_exists('spawn', $options); if ($spawn) { Worker::spawnWorker(); - killme(); + exit(); } $run_cron = !array_key_exists('n', $options) && !array_key_exists('no_cron', $options); diff --git a/boot.php b/boot.php index 7b4c72f19c..76672dc80c 100644 --- a/boot.php +++ b/boot.php @@ -19,23 +19,19 @@ use Friendica\App; use Friendica\BaseObject; -use Friendica\Core\Addon; -use Friendica\Core\Cache; use Friendica\Core\Config; -use Friendica\Core\L10n; use Friendica\Core\PConfig; use Friendica\Core\Protocol; use Friendica\Core\System; -use Friendica\Core\Update; -use Friendica\Core\Worker; use Friendica\Database\DBA; use Friendica\Model\Contact; -use Friendica\Model\Conversation; +use Friendica\Model\Term; +use Friendica\Util\BasePath; use Friendica\Util\DateTimeFormat; define('FRIENDICA_PLATFORM', 'Friendica'); -define('FRIENDICA_CODENAME', 'The Tazmans Flax-lily'); -define('FRIENDICA_VERSION', '2019.01'); +define('FRIENDICA_CODENAME', 'Dalmatian Bellflower'); +define('FRIENDICA_VERSION', '2019.03'); define('DFRN_PROTOCOL_VERSION', '2.23'); define('NEW_UPDATE_ROUTINE_VERSION', 1170); @@ -97,18 +93,12 @@ define('SSL_POLICY_FULL', 1); define('SSL_POLICY_SELFSIGN', 2); /* @}*/ -/** - * @name Register - * - * Registration policies - * @{ - */ -define('REGISTER_CLOSED', 0); -define('REGISTER_APPROVE', 1); -define('REGISTER_OPEN', 2); -/** - * @} -*/ +/** @deprecated since version 2019.03, please use \Friendica\Module\Register::CLOSED instead */ +define('REGISTER_CLOSED', \Friendica\Module\Register::CLOSED); +/** @deprecated since version 2019.03, please use \Friendica\Module\Register::APPROVE instead */ +define('REGISTER_APPROVE', \Friendica\Module\Register::APPROVE); +/** @deprecated since version 2019.03, please use \Friendica\Module\Register::OPEN instead */ +define('REGISTER_OPEN', \Friendica\Module\Register::OPEN); /** * @name CP @@ -182,23 +172,27 @@ define('NOTIFY_SYSTEM', 32768); /* @}*/ -/** - * @name Term - * - * Tag/term types - * @{ - */ -define('TERM_UNKNOWN', 0); -define('TERM_HASHTAG', 1); -define('TERM_MENTION', 2); -define('TERM_CATEGORY', 3); -define('TERM_PCATEGORY', 4); -define('TERM_FILE', 5); -define('TERM_SAVEDSEARCH', 6); -define('TERM_CONVERSATION', 7); +/** @deprecated since 2019.03, use Term::UNKNOWN instead */ +define('TERM_UNKNOWN', Term::UNKNOWN); +/** @deprecated since 2019.03, use Term::HASHTAG instead */ +define('TERM_HASHTAG', Term::HASHTAG); +/** @deprecated since 2019.03, use Term::MENTION instead */ +define('TERM_MENTION', Term::MENTION); +/** @deprecated since 2019.03, use Term::CATEGORY instead */ +define('TERM_CATEGORY', Term::CATEGORY); +/** @deprecated since 2019.03, use Term::PCATEGORY instead */ +define('TERM_PCATEGORY', Term::PCATEGORY); +/** @deprecated since 2019.03, use Term::FILE instead */ +define('TERM_FILE', Term::FILE); +/** @deprecated since 2019.03, use Term::SAVEDSEARCH instead */ +define('TERM_SAVEDSEARCH', Term::SAVEDSEARCH); +/** @deprecated since 2019.03, use Term::CONVERSATION instead */ +define('TERM_CONVERSATION', Term::CONVERSATION); -define('TERM_OBJ_POST', 1); -define('TERM_OBJ_PHOTO', 2); +/** @deprecated since 2019.03, use Term::OBJECT_TYPE_POST instead */ +define('TERM_OBJ_POST', Term::OBJECT_TYPE_POST); +/** @deprecated since 2019.03, use Term::OBJECT_TYPE_PHOTO instead */ +define('TERM_OBJ_PHOTO', Term::OBJECT_TYPE_PHOTO); /** * @name Namespaces @@ -653,18 +647,18 @@ function get_temppath() $temppath = Config::get("system", "temppath"); - if (($temppath != "") && App::isDirectoryUsable($temppath)) { + if (($temppath != "") && System::isDirectoryUsable($temppath)) { // We have a temp path and it is usable - return App::getRealPath($temppath); + return BasePath::getRealPath($temppath); } // We don't have a working preconfigured temp path, so we take the system path. $temppath = sys_get_temp_dir(); // Check if it is usable - if (($temppath != "") && App::isDirectoryUsable($temppath)) { + if (($temppath != "") && System::isDirectoryUsable($temppath)) { // Always store the real path, not the path through symlinks - $temppath = App::getRealPath($temppath); + $temppath = BasePath::getRealPath($temppath); // To avoid any interferences with other systems we create our own directory $new_temppath = $temppath . "/" . $a->getHostName(); @@ -673,7 +667,7 @@ function get_temppath() mkdir($new_temppath); } - if (App::isDirectoryUsable($new_temppath)) { + if (System::isDirectoryUsable($new_temppath)) { // The new path is usable, we are happy Config::set("system", "temppath", $new_temppath); return $new_temppath; @@ -755,8 +749,8 @@ function get_itemcachepath() } $itemcache = Config::get('system', 'itemcache'); - if (($itemcache != "") && App::isDirectoryUsable($itemcache)) { - return App::getRealPath($itemcache); + if (($itemcache != "") && System::isDirectoryUsable($itemcache)) { + return BasePath::getRealPath($itemcache); } $temppath = get_temppath(); @@ -767,7 +761,7 @@ function get_itemcachepath() mkdir($itemcache); } - if (App::isDirectoryUsable($itemcache)) { + if (System::isDirectoryUsable($itemcache)) { Config::set("system", "itemcache", $itemcache); return $itemcache; } @@ -783,7 +777,7 @@ function get_itemcachepath() function get_spoolpath() { $spoolpath = Config::get('system', 'spoolpath'); - if (($spoolpath != "") && App::isDirectoryUsable($spoolpath)) { + if (($spoolpath != "") && System::isDirectoryUsable($spoolpath)) { // We have a spool path and it is usable return $spoolpath; } @@ -798,7 +792,7 @@ function get_spoolpath() mkdir($spoolpath); } - if (App::isDirectoryUsable($spoolpath)) { + if (System::isDirectoryUsable($spoolpath)) { // The new path is usable, we are happy Config::set("system", "spoolpath", $spoolpath); return $spoolpath; diff --git a/composer.json b/composer.json index 6aa2774a69..765ec23a24 100644 --- a/composer.json +++ b/composer.json @@ -14,10 +14,17 @@ }, "require": { "php": ">=5.6.1", + "ext-ctype": "*", "ext-curl": "*", "ext-dom": "*", + "ext-fileinfo": "*", + "ext-gd": "*", + "ext-iconv": "*", "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", "ext-openssl": "*", + "ext-simplexml": "*", "ext-xml": "*", "asika/simple-console": "^1.0", "divineomega/password_exposed": "^2.4", @@ -27,19 +34,22 @@ "lightopenid/lightopenid": "dev-master", "michelf/php-markdown": "^1.7", "mobiledetect/mobiledetectlib": "2.8.*", + "monolog/monolog": "^1.24", "paragonie/random_compat": "^2.0", - "pear/Text_LanguageDetect": "1.*", + "pear/text_languagedetect": "1.*", + "psr/container": "^1.0", "seld/cli-prompt": "^1.0", "smarty/smarty": "^3.1", "fxp/composer-asset-plugin": "~1.3", "bower-asset/base64": "^1.0", - "bower-asset/Chart-js": "^2.7", + "bower-asset/chart-js": "^2.7", "bower-asset/perfect-scrollbar": "^0.6", "bower-asset/vue": "^2.5", "npm-asset/jquery": "^2.0", "npm-asset/jquery-colorbox": "^1.6", "npm-asset/jquery-datetimepicker": "^2.4.0", "npm-asset/jgrowl": "^1.4", + "npm-asset/moment": "^2.20.1", "npm-asset/fullcalendar": "^3.0.1", "npm-asset/cropperjs": "1.2.2", "npm-asset/imagesloaded": "4.1.4" @@ -53,7 +63,8 @@ "autoload": { "psr-4": { "Friendica\\": "src/", - "Friendica\\Test\\": "tests/" + "Friendica\\Test\\": "tests/", + "Friendica\\Addon\\": "addon/" }, "psr-0": { "": "library/" @@ -87,7 +98,7 @@ "phpunit/dbunit": "^2.0", "phpdocumentor/reflection-docblock": "^3.0.2", "phpunit/php-token-stream": "^1.4.2", - "mikey179/vfsStream": "^1.6", + "mikey179/vfsstream": "^1.6", "mockery/mockery": "^1.2", "johnkary/phpunit-speedtrap": "1.1" }, diff --git a/composer.lock b/composer.lock index 759ef65778..ff38c81050 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "51f7b3ab622038d7ef62ed03c06b48d0", + "content-hash": "8897c1f6912cc9b889534a8c59deead1", "packages": [ { "name": "asika/simple-console", @@ -809,6 +809,84 @@ ], "time": "2018-09-01T15:05:15+00:00" }, + { + "name": "monolog/monolog", + "version": "1.24.0", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/monolog.git", + "reference": "bfc9ebb28f97e7a24c45bdc3f0ff482e47bb0266" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/bfc9ebb28f97e7a24c45bdc3f0ff482e47bb0266", + "reference": "bfc9ebb28f97e7a24c45bdc3f0ff482e47bb0266", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "psr/log": "~1.0" + }, + "provide": { + "psr/log-implementation": "1.0.0" + }, + "require-dev": { + "aws/aws-sdk-php": "^2.4.9 || ^3.0", + "doctrine/couchdb": "~1.0@dev", + "graylog2/gelf-php": "~1.0", + "jakub-onderka/php-parallel-lint": "0.9", + "php-amqplib/php-amqplib": "~2.4", + "php-console/php-console": "^3.1.3", + "phpunit/phpunit": "~4.5", + "phpunit/phpunit-mock-objects": "2.3.0", + "ruflin/elastica": ">=0.90 <3.0", + "sentry/sentry": "^0.13", + "swiftmailer/swiftmailer": "^5.3|^6.0" + }, + "suggest": { + "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", + "doctrine/couchdb": "Allow sending log messages to a CouchDB server", + "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", + "ext-mongo": "Allow sending log messages to a MongoDB server", + "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", + "mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver", + "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", + "php-console/php-console": "Allow sending log messages to Google Chrome", + "rollbar/rollbar": "Allow sending log messages to Rollbar", + "ruflin/elastica": "Allow sending log messages to an Elastic Search server", + "sentry/sentry": "Allow sending log messages to a Sentry server" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Monolog\\": "src/Monolog" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "Sends your logs to files, sockets, inboxes, databases and various web services", + "homepage": "http://github.com/Seldaek/monolog", + "keywords": [ + "log", + "logging", + "psr-3" + ], + "time": "2018-11-05T09:00:11+00:00" + }, { "name": "npm-asset/cropperjs", "version": "1.2.2", @@ -948,32 +1026,18 @@ }, { "name": "npm-asset/fullcalendar", - "version": "3.9.0", + "version": "3.10.0", "dist": { "type": "tar", - "url": "https://registry.npmjs.org/fullcalendar/-/fullcalendar-3.9.0.tgz", + "url": "https://registry.npmjs.org/fullcalendar/-/fullcalendar-3.10.0.tgz", "reference": null, - "shasum": "b608a9989f3416f0b1d526c6bdfeeaf2ac79eda5" - }, - "require": { - "npm-asset/jquery": ">=2,<4.0", - "npm-asset/moment": ">=2.20.1,<3.0.0" + "shasum": "cc5e87d518fd6550e142816a31dd191664847919" }, "type": "npm-asset-library", "extra": { "npm-asset-bugs": { "url": "https://fullcalendar.io/wiki/Reporting-Bugs/" }, - "npm-asset-files": [ - "dist/*.js", - "dist/*.css", - "dist/*.d.ts", - "dist/locale/*.js", - "README.*", - "LICENSE.*", - "CHANGELOG.*", - "CONTRIBUTING.*" - ], "npm-asset-main": "dist/fullcalendar.js", "npm-asset-directories": [], "npm-asset-repository": { @@ -983,7 +1047,7 @@ "npm-asset-scripts": { "clean": "gulp clean", "dist": "gulp dist", - "lint": "gulp lint", + "lint": "gulp lint-and-example-repos", "test": "gulp test:single" } }, @@ -1005,7 +1069,7 @@ "full-sized", "jquery-plugin" ], - "time": "2018-03-05T03:30:23+00:00" + "time": "2019-01-11T02:39:12+00:00" }, { "name": "npm-asset/imagesloaded", @@ -1804,6 +1868,55 @@ ], "time": "2016-08-06T20:24:11+00:00" }, + { + "name": "psr/container", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "time": "2017-02-14T16:28:37+00:00" + }, { "name": "psr/http-message", "version": "1.0.1", @@ -1854,6 +1967,53 @@ ], "time": "2016-08-06T14:39:51+00:00" }, + { + "name": "psr/log", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd", + "reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2018-11-20T15:27:04+00:00" + }, { "name": "seld/cli-prompt", "version": "1.0.3", @@ -2525,6 +2685,7 @@ "testing", "xunit" ], + "abandoned": true, "time": "2016-12-02T14:39:14+00:00" }, { @@ -2915,6 +3076,7 @@ "mock", "xunit" ], + "abandoned": true, "time": "2017-06-30T09:13:00+00:00" }, { @@ -3018,7 +3180,7 @@ } ], "description": "Provides the functionality to compare PHP values for equality", - "homepage": "https://github.com/sebastianbergmann/comparator", + "homepage": "http://www.github.com/sebastianbergmann/comparator", "keywords": [ "comparator", "compare", @@ -3120,7 +3282,7 @@ } ], "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "https://github.com/sebastianbergmann/environment", + "homepage": "http://www.github.com/sebastianbergmann/environment", "keywords": [ "Xdebug", "environment", @@ -3188,7 +3350,7 @@ } ], "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "https://github.com/sebastianbergmann/exporter", + "homepage": "http://www.github.com/sebastianbergmann/exporter", "keywords": [ "export", "exporter" @@ -3240,7 +3402,7 @@ } ], "description": "Snapshotting of global state", - "homepage": "https://github.com/sebastianbergmann/global-state", + "homepage": "http://www.github.com/sebastianbergmann/global-state", "keywords": [ "global state" ], @@ -3342,7 +3504,7 @@ } ], "description": "Provides functionality to recursively process PHP variables", - "homepage": "https://github.com/sebastianbergmann/recursion-context", + "homepage": "http://www.github.com/sebastianbergmann/recursion-context", "time": "2016-11-19T07:33:16+00:00" }, { @@ -3607,10 +3769,17 @@ "prefer-lowest": false, "platform": { "php": ">=5.6.1", + "ext-ctype": "*", "ext-curl": "*", "ext-dom": "*", + "ext-fileinfo": "*", + "ext-gd": "*", + "ext-iconv": "*", "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", "ext-openssl": "*", + "ext-simplexml": "*", "ext-xml": "*" }, "platform-dev": [] diff --git a/config/dbstructure.config.php b/config/dbstructure.config.php index e90a35f38a..f03132adda 100644 --- a/config/dbstructure.config.php +++ b/config/dbstructure.config.php @@ -34,7 +34,7 @@ use Friendica\Database\DBA; if (!defined('DB_UPDATE_VERSION')) { - define('DB_UPDATE_VERSION', 1293); + define('DB_UPDATE_VERSION', 1304); } return [ @@ -99,6 +99,8 @@ return [ "allow_gid" => ["type" => "mediumtext", "comment" => "Access Control - list of allowed groups"], "deny_cid" => ["type" => "mediumtext", "comment" => "Access Control - list of denied contact.id"], "deny_gid" => ["type" => "mediumtext", "comment" => "Access Control - list of denied groups"], + "backend-class" => ["type" => "tinytext", "comment" => "Storage backend class"], + "backend-ref" => ["type" => "text", "comment" => "Storage backend data reference"], ], "indexes" => [ "PRIMARY" => ["id"], @@ -707,6 +709,8 @@ return [ "iid" => ["type" => "int unsigned", "not null" => "1", "primary" => "1", "relation" => ["item" => "id"], "comment" => "Item id"], "postopts" => ["type" => "text", "comment" => "External post connectors add their network name to this comma-separated string to identify that they should be delivered to these networks during delivery"], "inform" => ["type" => "mediumtext", "comment" => "Additional receivers of the linked item"], + "queue_count" => ["type" => "mediumint", "not null" => "1", "default" => "0", "comment" => "Initial number of delivery recipients, used as item.delivery_queue_count"], + "queue_done" => ["type" => "mediumint", "not null" => "1", "default" => "0", "comment" => "Number of successful deliveries, used as item.delivery_queue_done"], ], "indexes" => [ "PRIMARY" => ["iid"], @@ -955,6 +959,9 @@ return [ "allow_gid" => ["type" => "mediumtext", "comment" => "Access Control - list of allowed groups"], "deny_cid" => ["type" => "mediumtext", "comment" => "Access Control - list of denied contact.id"], "deny_gid" => ["type" => "mediumtext", "comment" => "Access Control - list of denied groups"], + "backend-class" => ["type" => "tinytext", "comment" => "Storage backend class"], + "backend-ref" => ["type" => "text", "comment" => "Storage backend data reference"], + "updated" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""] ], "indexes" => [ "PRIMARY" => ["id"], @@ -1359,7 +1366,7 @@ return [ "comment" => "Background tasks queue entries", "fields" => [ "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "Auto incremented worker task id"], - "parameter" => ["type" => "mediumblob", "comment" => "Task command"], + "parameter" => ["type" => "mediumtext", "comment" => "Task command"], "priority" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "Task priority"], "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Creation date"], "pid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => "Process id of the worker"], @@ -1370,13 +1377,23 @@ return [ ], "indexes" => [ "PRIMARY" => ["id"], - "pid" => ["pid"], - "parameter" => ["parameter(64)"], - "priority_created_next_try" => ["priority", "created", "next_try"], - "done_priority_executed_next_try" => ["done", "priority", "executed", "next_try"], - "done_executed_next_try" => ["done", "executed", "next_try"], + "done_parameter" => ["done", "parameter(64)"], + "done_executed" => ["done", "executed"], + "done_priority_created" => ["done", "priority", "created"], "done_priority_next_try" => ["done", "priority", "next_try"], - "done_next_try" => ["done", "next_try"] + "done_pid_next_try" => ["done", "pid", "next_try"], + "done_pid_priority_created" => ["done", "pid", "priority", "created"] + ] + ], + "storage" => [ + "comment" => "Data stored by Database storage backend", + "fields" => [ + "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "Auto incremented image data id"], + "data" => ["type" => "longblob", "not null" => "1", "comment" => "file data"] + ], + "indexes" => [ + "PRIMARY" => ["id"] ] ] ]; + diff --git a/config/defaults.config.php b/config/defaults.config.php index 90596a8fee..a6f90f319e 100644 --- a/config/defaults.config.php +++ b/config/defaults.config.php @@ -135,6 +135,15 @@ return [ // Disables the check if a mail address is in a valid format and can be resolved via DNS. 'disable_email_validation' => false, + // disable_implicit_mentions (Boolean) since 2019.03 + // Implicit mentions are mentions in the body of replies that are redundant in a thread-enabled system like Friendica. + // This config key disables the gathering of implicit mentions in incoming and outgoing posts. + // Also disables the default automatic removal of implicit mentions from the body of incoming posts. + // Also disables the default automatic addition of implicit mentions in the body of outgoing posts. + // Disabling implicit mentions also affects the "explicit_mentions" additional feature by limiting it + // to the replied-to post author mention in the comment boxes. + 'disable_implicit_mentions' => false, + // disable_url_validation (Boolean) // Disables the DNS lookup of an URL. 'disable_url_validation' => false, @@ -393,6 +402,14 @@ return [ // Number of worker tasks that are fetched in a single query. 'worker_fetch_limit' => 1, + // worker_jpm (Boolean) + // If enabled, it prints out the jobs per minute. + 'worker_jpm' => false, + + // worker_jpm_range (String) + // List of minutes for the jobs per minute (JPM) calculation + 'worker_jpm_range' => '1, 10, 60', + // worker_load_exponent (Integer) // Default 3, which allows only 25% of the maximum worker queues when server load reaches around 37% of maximum load. // For a linear response where 25% of worker queues are allowed at 75% of maximum load, set this to 1. @@ -421,4 +438,13 @@ return [ // Must be writable by the ejabberd process. if set then it will prevent the running of multiple processes. 'lockpath' => '', ], + 'debug' => [ + // ap_inbox_log (Boolean) + // Logs every call to /inbox as a JSON file in Friendica's temporary directory + 'ap_inbox_log' => false, + + // total_ap_delivery (Boolean) + // Deliver via AP to every possible receiver and we suppress the delivery to these contacts with other protocols + 'total_ap_delivery' => false, + ] ]; diff --git a/config/local-sample.config.php b/config/local-sample.config.php index 996c27a66d..9b977ff53f 100644 --- a/config/local-sample.config.php +++ b/config/local-sample.config.php @@ -34,7 +34,7 @@ return [ 'config' => [ 'admin_email' => '', 'sitename' => 'Friendica Social Network', - 'register_policy' => REGISTER_OPEN, + 'register_policy' => \Friendica\Module\Register::OPEN, 'register_text' => '', ], 'system' => [ diff --git a/config/settings.config.php b/config/settings.config.php index 494a0e15be..31e8dbe5b5 100644 --- a/config/settings.config.php +++ b/config/settings.config.php @@ -16,10 +16,11 @@ return [ 'info' => '', // register_policy (Constant) - // Your choices are REGISTER_OPEN, REGISTER_APPROVE, or REGISTER_CLOSED. - // Be certain to create your own personal account before setting REGISTER_CLOSED. - // REGISTER_APPROVE requires you set system.admin_email to the email address of an already registered person who can authorize and/or approve/deny the request. - 'register_policy' => REGISTER_CLOSED, + // Your choices are OPEN, APPROVE, or CLOSED. + // Be certain to create your own personal account before setting CLOSED. + // APPROVE requires you set system.admin_email to the email address of an + // already registered person who can authorize and/or approve/deny the request. + 'register_policy' => \Friendica\Module\Register::CLOSED, // register_text (String) // Will be displayed prominently on the registration page. @@ -43,6 +44,10 @@ return [ // Themes users can change to in their settings. 'allowed_themes' => 'quattro,vier,duepuntozero,smoothly', + // debugging (boolean) + // Enable/Disable Debugging (logging) + 'debugging' => false, + // default_timezone (String) // Choose a default timezone. See https://secure.php.net/manual/en/timezones.php // It only applies to timestamps for anonymous viewers. @@ -66,6 +71,16 @@ return [ // Two-letters ISO 639-1 code. 'language' => 'en', + // logfile (String) + // The logfile for storing logs. + // Can be a full path or a relative path to the Friendica home directory + 'logfile' => 'friendica.log', + + // loglevel (String) + // The loglevel for all logs. + // Has to be one of these values: emergency, alert, critical, error, warning, notice, info, debug + 'loglevel' => 'notice', + // max_image_length (Integer) // An alternate way of limiting picture upload sizes. // Specify the maximum pixel length that pictures are allowed to be (for non-square pictures, it will apply to the longest side). @@ -87,6 +102,10 @@ return [ // 0 to use internal default (100MB) 'optimize_max_tablesize' => -1, + // maxloadavg (Integer) + // Maximum system load before delivery and poll processes are deferred. + 'maxloadavg' => 20, + // rino_encrypt (Integer) // Server-to-server private message encryption (RINO). // Encryption will only be provided if this setting is set to a non zero value on both servers. diff --git a/database.sql b/database.sql index 5a3f84d179..10a428ffff 100644 --- a/database.sql +++ b/database.sql @@ -1,6 +1,6 @@ -- ------------------------------------------ --- Friendica 2019.01-rc (The Tazmans Flax-lily) --- DB_UPDATE_VERSION 1293 +-- Friendica 2019.03-dev (The Tazmans Flax-lily) +-- DB_UPDATE_VERSION 1300 -- ------------------------------------------ @@ -64,6 +64,8 @@ CREATE TABLE IF NOT EXISTS `attach` ( `allow_gid` mediumtext COMMENT 'Access Control - list of allowed groups', `deny_cid` mediumtext COMMENT 'Access Control - list of denied contact.id', `deny_gid` mediumtext COMMENT 'Access Control - list of denied groups', + `backend-class` tinytext COMMENT 'Storage backend class', + `backend-ref` text COMMENT 'Storage backend data reference', PRIMARY KEY(`id`) ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='file attachments'; @@ -641,6 +643,8 @@ CREATE TABLE IF NOT EXISTS `item-delivery-data` ( `iid` int unsigned NOT NULL COMMENT 'Item id', `postopts` text COMMENT 'External post connectors add their network name to this comma-separated string to identify that they should be delivered to these networks during delivery', `inform` mediumtext COMMENT 'Additional receivers of the linked item', + `queue_count` mediumint NOT NULL DEFAULT 0 COMMENT 'Initial number of delivery recipients, used as item.delivery_queue_count', + `queue_done` mediumint NOT NULL DEFAULT 0 COMMENT 'Number of successful deliveries, used as item.delivery_queue_done', PRIMARY KEY(`iid`) ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Delivery data for items'; @@ -873,6 +877,9 @@ CREATE TABLE IF NOT EXISTS `photo` ( `allow_gid` mediumtext COMMENT 'Access Control - list of allowed groups', `deny_cid` mediumtext COMMENT 'Access Control - list of denied contact.id', `deny_gid` mediumtext COMMENT 'Access Control - list of denied groups', + `backend-class` tinytext COMMENT 'Storage backend class', + `backend-ref` text COMMENT 'Storage backend data reference', + `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'edited timestamp', PRIMARY KEY(`id`), INDEX `contactid` (`contact-id`), INDEX `uid_contactid` (`uid`,`contact-id`), @@ -1254,7 +1261,7 @@ CREATE TABLE IF NOT EXISTS `worker-ipc` ( -- CREATE TABLE IF NOT EXISTS `workerqueue` ( `id` int unsigned NOT NULL auto_increment COMMENT 'Auto incremented worker task id', - `parameter` mediumblob COMMENT 'Task command', + `parameter` mediumtext COMMENT 'Task command', `priority` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'Task priority', `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Creation date', `pid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Process id of the worker', @@ -1272,4 +1279,13 @@ CREATE TABLE IF NOT EXISTS `workerqueue` ( INDEX `done_next_try` (`done`,`next_try`) ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Background tasks queue entries'; +-- +-- TABLE storage +-- +CREATE TABLE IF NOT EXISTS `storage` ( + `id` int unsigned NOT NULL auto_increment COMMENT 'Auto incremented image data id', + `data` longblob NOT NULL COMMENT 'file data', + PRIMARY KEY(`id`) +) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Data stored by Database storage backend'; + diff --git a/doc/AddonStorageBackend.md b/doc/AddonStorageBackend.md new file mode 100644 index 0000000000..d42c8bbbd7 --- /dev/null +++ b/doc/AddonStorageBackend.md @@ -0,0 +1,204 @@ +Friendica Storage Backend Addon development +=========================================== + +* [Home](help) + +Storage backends can be added via addons. +A storage backend is implemented as a class, and the plugin register the class to make it avaiable to the system. + +## The Storage Backend Class + +The class must live in `Friendica\Addon\youraddonname` namespace, where `youraddonname` the folder name of your addon. + +The class must implement `Friendica\Model\Storage\IStorage` interface. All method in the interface must be implemented: + +namespace Friendica\Model\Storage; + +```php +interface IStorage +{ + public static function get($ref); + public static function put($data, $ref = ""); + public static function delete($ref); + public static function getOptions(); + public static function saveOptions($data); +} +``` + +- `get($ref)` returns data pointed by `$ref` +- `put($data, $ref)` saves data in `$data` to position `$ref`, or a new position if `$ref` is empty. +- `delete($ref)` delete data pointed by `$ref` + +Each storage backend can have options the admin can set in admin page. + +- `getOptions()` returns an array with details about each option to build the interface. +- `saveOptions($data)` get `$data` from admin page, validate it and save it. + +The array returned by `getOptions()` is defined as: + + [ + 'option1name' => [ ..info.. ], + 'option2name' => [ ..info.. ], + ... + ] + +An empty array can be returned if backend doesn't have any options. + +The info array for each option is defined as: + + [ + 'type', + +define the field used in form, and the type of data. +one of 'checkbox', 'combobox', 'custom', 'datetime', 'input', 'intcheckbox', 'password', 'radio', 'richtext', 'select', 'select_raw', 'textarea', 'yesno' + + 'label', + +Translatable label of the field. This label will be shown in admin page + + value, + +Current value of the option + + 'help text', + +Translatable description for the field. Will be shown in admin page + + extra data + +Optional. Depends on which 'type' this option is: + +- 'select': array `[ value => label ]` of choices +- 'intcheckbox': value of input element +- 'select_raw': prebuild html string of `