Merge branch 'develop' into rewrite/gravity-constants
This commit is contained in:
commit
26e0469de7
181 changed files with 2408 additions and 2405 deletions
2
Vagrantfile
vendored
2
Vagrantfile
vendored
|
@ -1,5 +1,5 @@
|
|||
|
||||
server_ip = "192.168.22.10"
|
||||
server_ip = "192.168.56.10"
|
||||
server_memory = "2048" # MB
|
||||
server_timezone = "UTC"
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ if (php_sapi_name() !== 'cli') {
|
|||
}
|
||||
|
||||
use Dice\Dice;
|
||||
use Friendica\DI;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
require dirname(__DIR__) . '/vendor/autoload.php';
|
||||
|
@ -33,6 +34,8 @@ require dirname(__DIR__) . '/vendor/autoload.php';
|
|||
$dice = (new Dice())->addRules(include __DIR__ . '/../static/dependencies.config.php');
|
||||
$dice = $dice->addRule(LoggerInterface::class,['constructParams' => ['console']]);
|
||||
|
||||
/// @fixme Necessary until Hooks inside the Logger can get loaded without the DI-class
|
||||
DI::init($dice);
|
||||
\Friendica\Core\Logger\Handler\ErrorHandler::register($dice->create(\Psr\Log\LoggerInterface::class));
|
||||
|
||||
(new Friendica\Core\Console($dice, $argv))->execute();
|
||||
|
|
|
@ -45,13 +45,13 @@ apt-get install -qq apache2
|
|||
a2enmod rewrite actions ssl
|
||||
cp /vagrant/bin/dev/vagrant_vhost.sh /usr/local/bin/vhost
|
||||
chmod guo+x /usr/local/bin/vhost
|
||||
vhost -s 192.168.22.10.xip.io -d /var/www -p /etc/ssl/xip.io -c xip.io -a friendica.local
|
||||
vhost -s 192.168.56.10.xip.io -d /var/www -p /etc/ssl/xip.io -c xip.io -a friendica.local
|
||||
a2dissite 000-default
|
||||
service apache2 restart
|
||||
|
||||
#Install php
|
||||
echo ">>> Installing PHP7"
|
||||
apt-get install -qq php libapache2-mod-php php-cli php-mysql php-curl php-gd php-mbstring php-xml imagemagick php-imagick php-zip
|
||||
apt-get install -qq php libapache2-mod-php php-cli php-mysql php-curl php-gd php-mbstring php-xml imagemagick php-imagick php-zip php-gmp
|
||||
systemctl restart apache2
|
||||
|
||||
echo ">>> Installing PHP8"
|
||||
|
@ -59,7 +59,7 @@ apt-get install -qq -y lsb-release ca-certificates apt-transport-https software-
|
|||
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/sury-php.list
|
||||
wget -qO - https://packages.sury.org/php/apt.gpg | sudo apt-key add -
|
||||
apt update
|
||||
apt-get install -qq php8.0 php8.0-cli php8.0-mysql php8.0-curl php8.0-gd php8.0-mbstring php8.0-xml php8.0-imagick php8.0-zip
|
||||
apt-get install -qq php8.0 php8.0-cli php8.0-mysql php8.0-curl php8.0-gd php8.0-mbstring php8.0-xml php8.0-imagick php8.0-zip php8.0-gmp
|
||||
systemctl restart apache2
|
||||
|
||||
#Install mysql
|
||||
|
|
133
boot.php
133
boot.php
|
@ -27,156 +27,37 @@
|
|||
* easily as email does today.
|
||||
*/
|
||||
|
||||
use Friendica\Model\Contact;
|
||||
|
||||
define('FRIENDICA_PLATFORM', 'Friendica');
|
||||
define('FRIENDICA_CODENAME', 'Giant Rhubarb');
|
||||
define('FRIENDICA_VERSION', '2022.12-dev');
|
||||
define('DFRN_PROTOCOL_VERSION', '2.23');
|
||||
define('NEW_TABLE_STRUCTURE_VERSION', 1288);
|
||||
|
||||
/**
|
||||
* Constant with a HTML line break.
|
||||
*
|
||||
* Contains a HTML line break (br) element and a real carriage return with line
|
||||
* feed for the source.
|
||||
* This can be used in HTML and JavaScript where needed a line break.
|
||||
*/
|
||||
define('EOL', "<br />\r\n");
|
||||
|
||||
/**
|
||||
* @name CP
|
||||
*
|
||||
* Type of the community page
|
||||
* @{
|
||||
*/
|
||||
define('CP_NO_INTERNAL_COMMUNITY', -2);
|
||||
define('CP_NO_COMMUNITY_PAGE', -1);
|
||||
define('CP_USERS_ON_SERVER', 0);
|
||||
define('CP_GLOBAL_COMMUNITY', 1);
|
||||
define('CP_USERS_AND_GLOBAL', 2);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @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);
|
||||
define('PRIORITIES', [PRIORITY_CRITICAL, PRIORITY_HIGH, PRIORITY_MEDIUM, PRIORITY_LOW, PRIORITY_NEGLIGIBLE]);
|
||||
/* @}*/
|
||||
|
||||
// Normally this constant is defined - but not if "pcntl" isn't installed
|
||||
if (!defined('SIGTERM')) {
|
||||
define('SIGTERM', 15);
|
||||
}
|
||||
|
||||
/**
|
||||
* Depending on the PHP version this constant does exist - or not.
|
||||
* See here: http://php.net/manual/en/curl.constants.php#117928
|
||||
*/
|
||||
if (!defined('CURLE_OPERATION_TIMEDOUT')) {
|
||||
define('CURLE_OPERATION_TIMEDOUT', CURLE_OPERATION_TIMEOUTED);
|
||||
}
|
||||
|
||||
if (!function_exists('exif_imagetype')) {
|
||||
function exif_imagetype($file)
|
||||
{
|
||||
$size = getimagesize($file);
|
||||
return $size[2];
|
||||
}
|
||||
}
|
||||
use Friendica\Core\Session;
|
||||
|
||||
/**
|
||||
* Returns the user id of locally logged in user or false.
|
||||
*
|
||||
* @return int|bool user id or false
|
||||
* @deprecated since version 2022.12, use Core\Session::getLocalUser() instead
|
||||
*/
|
||||
function local_user()
|
||||
{
|
||||
if (!empty($_SESSION['authenticated']) && !empty($_SESSION['uid'])) {
|
||||
return intval($_SESSION['uid']);
|
||||
}
|
||||
|
||||
return false;
|
||||
return Session::getLocalUser();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the public contact id of logged in user or false.
|
||||
*
|
||||
* @return int|bool public contact id or false
|
||||
* @deprecated since version 2022.12, use Core\Session:: getPublicContact() instead
|
||||
*/
|
||||
function public_contact()
|
||||
{
|
||||
static $public_contact_id = false;
|
||||
|
||||
if (!$public_contact_id && !empty($_SESSION['authenticated'])) {
|
||||
if (!empty($_SESSION['my_address'])) {
|
||||
// Local user
|
||||
$public_contact_id = intval(Contact::getIdForURL($_SESSION['my_address'], 0, false));
|
||||
} elseif (!empty($_SESSION['visitor_home'])) {
|
||||
// Remote user
|
||||
$public_contact_id = intval(Contact::getIdForURL($_SESSION['visitor_home'], 0, false));
|
||||
}
|
||||
} elseif (empty($_SESSION['authenticated'])) {
|
||||
$public_contact_id = false;
|
||||
}
|
||||
|
||||
return $public_contact_id;
|
||||
return Session::getPublicContact();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns public contact id of authenticated site visitor or false
|
||||
*
|
||||
* @return int|bool visitor_id or false
|
||||
* @deprecated since version 2022.12, use Core\Session:: getRemoteUser() instead
|
||||
*/
|
||||
function remote_user()
|
||||
{
|
||||
if (empty($_SESSION['authenticated'])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!empty($_SESSION['visitor_id'])) {
|
||||
return intval($_SESSION['visitor_id']);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show an error message to user.
|
||||
*
|
||||
* This function save text in session, to be shown to the user at next page load
|
||||
*
|
||||
* @param string $s - Text of notice
|
||||
*
|
||||
* @return void
|
||||
* @deprecated since version 2022.09, use \Friendica\Navigation\SystemMessages instead
|
||||
*/
|
||||
function notice(string $s)
|
||||
{
|
||||
\Friendica\DI::sysmsg()->addNotice($s);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show an info message to user.
|
||||
*
|
||||
* This function save text in session, to be shown to the user at next page load
|
||||
*
|
||||
* @param string $s - Text of notice
|
||||
*
|
||||
* @return void
|
||||
* @deprecated since version 2022.09, use \Friendica\Navigation\SystemMessages instead
|
||||
*/
|
||||
function info(string $s)
|
||||
{
|
||||
\Friendica\DI::sysmsg()->addInfo($s);
|
||||
return Session::getRemoteUser();
|
||||
}
|
||||
|
|
|
@ -41,7 +41,6 @@
|
|||
"michelf/php-markdown": "^1.7",
|
||||
"minishlink/web-push": "^6.0",
|
||||
"mobiledetect/mobiledetectlib": "^2.8",
|
||||
"monolog/monolog": "^1.25",
|
||||
"nikic/fast-route": "^1.3",
|
||||
"paragonie/hidden-string": "^1.0",
|
||||
"patrickschur/language-detection": "^5.0.0",
|
||||
|
@ -50,6 +49,7 @@
|
|||
"pragmarx/google2fa": "^5.0",
|
||||
"pragmarx/recovery": "^0.2",
|
||||
"psr/container": "^1.0",
|
||||
"psr/log": "^1.1",
|
||||
"seld/cli-prompt": "^1.0",
|
||||
"smarty/smarty": "^4",
|
||||
"ua-parser/uap-php": "^3.9",
|
||||
|
|
84
composer.lock
generated
84
composer.lock
generated
|
@ -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": "f5922f03b367e68a5930df6ed80c5c2f",
|
||||
"content-hash": "c851fbba46ed090d0fbaf68e9b3b94df",
|
||||
"packages": [
|
||||
{
|
||||
"name": "asika/simple-console",
|
||||
|
@ -1543,88 +1543,6 @@
|
|||
],
|
||||
"time": "2022-02-17T19:24:25+00:00"
|
||||
},
|
||||
{
|
||||
"name": "monolog/monolog",
|
||||
"version": "1.27.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Seldaek/monolog.git",
|
||||
"reference": "904713c5929655dc9b97288b69cfeedad610c9a1"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/904713c5929655dc9b97288b69cfeedad610c9a1",
|
||||
"reference": "904713c5929655dc9b97288b69cfeedad610c9a1",
|
||||
"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",
|
||||
"php-amqplib/php-amqplib": "~2.4",
|
||||
"php-console/php-console": "^3.1.3",
|
||||
"phpstan/phpstan": "^0.12.59",
|
||||
"phpunit/phpunit": "~4.5",
|
||||
"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",
|
||||
"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"
|
||||
],
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/Seldaek",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/monolog/monolog",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2022-06-09T08:53:42+00:00"
|
||||
},
|
||||
{
|
||||
"name": "nikic/fast-route",
|
||||
"version": "v1.3.0",
|
||||
|
|
26
database.sql
26
database.sql
|
@ -1,6 +1,6 @@
|
|||
-- ------------------------------------------
|
||||
-- Friendica 2022.09-rc (Giant Rhubarb)
|
||||
-- DB_UPDATE_VERSION 1484
|
||||
-- Friendica 2022.12-dev (Giant Rhubarb)
|
||||
-- DB_UPDATE_VERSION 1486
|
||||
-- ------------------------------------------
|
||||
|
||||
|
||||
|
@ -1186,6 +1186,7 @@ CREATE TABLE IF NOT EXISTS `post-content` (
|
|||
`content-warning` varchar(255) NOT NULL DEFAULT '' COMMENT '',
|
||||
`body` mediumtext COMMENT 'item body content',
|
||||
`raw-body` mediumtext COMMENT 'Body without embedded media links',
|
||||
`quote-uri-id` int unsigned COMMENT 'Id of the item-uri table that contains the quoted uri',
|
||||
`location` varchar(255) NOT NULL DEFAULT '' COMMENT 'text location where this item originated',
|
||||
`coord` varchar(255) NOT NULL DEFAULT '' COMMENT 'longitude/latitude pair representing location where this item originated',
|
||||
`language` text COMMENT 'Language information about this post',
|
||||
|
@ -1202,7 +1203,9 @@ CREATE TABLE IF NOT EXISTS `post-content` (
|
|||
INDEX `plink` (`plink`(191)),
|
||||
INDEX `resource-id` (`resource-id`),
|
||||
FULLTEXT INDEX `title-content-warning-body` (`title`,`content-warning`,`body`),
|
||||
FOREIGN KEY (`uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE
|
||||
INDEX `quote-uri-id` (`quote-uri-id`),
|
||||
FOREIGN KEY (`uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE,
|
||||
FOREIGN KEY (`quote-uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE
|
||||
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Content for all posts';
|
||||
|
||||
--
|
||||
|
@ -1289,6 +1292,7 @@ CREATE TABLE IF NOT EXISTS `post-media` (
|
|||
`id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
|
||||
`uri-id` int unsigned NOT NULL COMMENT 'Id of the item-uri table entry that contains the item uri',
|
||||
`url` varbinary(1024) NOT NULL COMMENT 'Media URL',
|
||||
`media-uri-id` int unsigned COMMENT 'Id of the item-uri table entry that contains the activities uri-id',
|
||||
`type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'Media type',
|
||||
`mimetype` varchar(60) COMMENT '',
|
||||
`height` smallint unsigned COMMENT 'Height of the media',
|
||||
|
@ -1308,7 +1312,9 @@ CREATE TABLE IF NOT EXISTS `post-media` (
|
|||
PRIMARY KEY(`id`),
|
||||
UNIQUE INDEX `uri-id-url` (`uri-id`,`url`(512)),
|
||||
INDEX `uri-id-id` (`uri-id`,`id`),
|
||||
FOREIGN KEY (`uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE
|
||||
INDEX `media-uri-id` (`media-uri-id`),
|
||||
FOREIGN KEY (`uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE,
|
||||
FOREIGN KEY (`media-uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE
|
||||
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Attached media';
|
||||
|
||||
--
|
||||
|
@ -1807,6 +1813,8 @@ CREATE VIEW `post-user-view` AS SELECT
|
|||
`post-user`.`thr-parent-id` AS `thr-parent-id`,
|
||||
`conversation-item-uri`.`uri` AS `conversation`,
|
||||
`post-thread-user`.`conversation-id` AS `conversation-id`,
|
||||
`quote-item-uri`.`uri` AS `quote-uri`,
|
||||
`post-content`.`quote-uri-id` AS `quote-uri-id`,
|
||||
`item-uri`.`guid` AS `guid`,
|
||||
`post-user`.`wall` AS `wall`,
|
||||
`post-user`.`gravity` AS `gravity`,
|
||||
|
@ -1962,6 +1970,7 @@ CREATE VIEW `post-user-view` AS SELECT
|
|||
LEFT JOIN `event` ON `event`.`id` = `post-user`.`event-id`
|
||||
LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post-user`.`uri-id`
|
||||
LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post-user`.`uri-id`
|
||||
LEFT JOIN `item-uri` AS `quote-item-uri` ON `quote-item-uri`.`id` = `post-content`.`quote-uri-id`
|
||||
LEFT JOIN `post-delivery-data` ON `post-delivery-data`.`uri-id` = `post-user`.`uri-id` AND `post-user`.`origin`
|
||||
LEFT JOIN `post-question` ON `post-question`.`uri-id` = `post-user`.`uri-id`
|
||||
LEFT JOIN `permissionset` ON `permissionset`.`id` = `post-user`.`psid`
|
||||
|
@ -1985,6 +1994,8 @@ CREATE VIEW `post-thread-user-view` AS SELECT
|
|||
`post-user`.`thr-parent-id` AS `thr-parent-id`,
|
||||
`conversation-item-uri`.`uri` AS `conversation`,
|
||||
`post-thread-user`.`conversation-id` AS `conversation-id`,
|
||||
`quote-item-uri`.`uri` AS `quote-uri`,
|
||||
`post-content`.`quote-uri-id` AS `quote-uri-id`,
|
||||
`item-uri`.`guid` AS `guid`,
|
||||
`post-thread-user`.`wall` AS `wall`,
|
||||
`post-user`.`gravity` AS `gravity`,
|
||||
|
@ -2138,6 +2149,7 @@ CREATE VIEW `post-thread-user-view` AS SELECT
|
|||
LEFT JOIN `event` ON `event`.`id` = `post-user`.`event-id`
|
||||
LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post-thread-user`.`uri-id`
|
||||
LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post-thread-user`.`uri-id`
|
||||
LEFT JOIN `item-uri` AS `quote-item-uri` ON `quote-item-uri`.`id` = `post-content`.`quote-uri-id`
|
||||
LEFT JOIN `post-delivery-data` ON `post-delivery-data`.`uri-id` = `post-thread-user`.`uri-id` AND `post-thread-user`.`origin`
|
||||
LEFT JOIN `post-question` ON `post-question`.`uri-id` = `post-thread-user`.`uri-id`
|
||||
LEFT JOIN `permissionset` ON `permissionset`.`id` = `post-thread-user`.`psid`
|
||||
|
@ -2157,6 +2169,8 @@ CREATE VIEW `post-view` AS SELECT
|
|||
`post`.`thr-parent-id` AS `thr-parent-id`,
|
||||
`conversation-item-uri`.`uri` AS `conversation`,
|
||||
`post-thread`.`conversation-id` AS `conversation-id`,
|
||||
`quote-item-uri`.`uri` AS `quote-uri`,
|
||||
`post-content`.`quote-uri-id` AS `quote-uri-id`,
|
||||
`item-uri`.`guid` AS `guid`,
|
||||
`post`.`gravity` AS `gravity`,
|
||||
`external-item-uri`.`uri` AS `extid`,
|
||||
|
@ -2279,6 +2293,7 @@ CREATE VIEW `post-view` AS SELECT
|
|||
LEFT JOIN `verb` ON `verb`.`id` = `post`.`vid`
|
||||
LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post`.`uri-id`
|
||||
LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post`.`uri-id`
|
||||
LEFT JOIN `item-uri` AS `quote-item-uri` ON `quote-item-uri`.`id` = `post-content`.`quote-uri-id`
|
||||
LEFT JOIN `post-question` ON `post-question`.`uri-id` = `post`.`uri-id`
|
||||
LEFT JOIN `post` AS `parent-post` ON `parent-post`.`uri-id` = `post`.`parent-uri-id`
|
||||
LEFT JOIN `contact` AS `parent-post-author` ON `parent-post-author`.`id` = `parent-post`.`author-id`;
|
||||
|
@ -2296,6 +2311,8 @@ CREATE VIEW `post-thread-view` AS SELECT
|
|||
`post`.`thr-parent-id` AS `thr-parent-id`,
|
||||
`conversation-item-uri`.`uri` AS `conversation`,
|
||||
`post-thread`.`conversation-id` AS `conversation-id`,
|
||||
`quote-item-uri`.`uri` AS `quote-uri`,
|
||||
`post-content`.`quote-uri-id` AS `quote-uri-id`,
|
||||
`item-uri`.`guid` AS `guid`,
|
||||
`post`.`gravity` AS `gravity`,
|
||||
`external-item-uri`.`uri` AS `extid`,
|
||||
|
@ -2418,6 +2435,7 @@ CREATE VIEW `post-thread-view` AS SELECT
|
|||
LEFT JOIN `verb` ON `verb`.`id` = `post`.`vid`
|
||||
LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post-thread`.`uri-id`
|
||||
LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post-thread`.`uri-id`
|
||||
LEFT JOIN `item-uri` AS `quote-item-uri` ON `quote-item-uri`.`id` = `post-content`.`quote-uri-id`
|
||||
LEFT JOIN `post-question` ON `post-question`.`uri-id` = `post-thread`.`uri-id`
|
||||
LEFT JOIN `post` AS `parent-post` ON `parent-post`.`uri-id` = `post`.`parent-uri-id`
|
||||
LEFT JOIN `contact` AS `parent-post-author` ON `parent-post-author`.`id` = `parent-post`.`author-id`;
|
||||
|
|
|
@ -919,6 +919,10 @@ Here is a complete list of all hook callbacks with file locations (as of 24-Sep-
|
|||
Hook::callAll('block', $hook_data);
|
||||
Hook::callAll('unblock', $hook_data);
|
||||
|
||||
### src/Core/Logger/Factory.php
|
||||
|
||||
Hook::callAll('logger_instance', $data);
|
||||
|
||||
### src/Core/StorageManager
|
||||
|
||||
Hook::callAll('storage_instance', $data);
|
||||
|
|
|
@ -34,7 +34,7 @@ Due to the large variety of operating systems and PHP platforms in existence we
|
|||
* The POSIX module of PHP needs to be activated (e.g. [RHEL, CentOS](http://www.bigsoft.co.uk/blog/index.php/2014/12/08/posix-php-commands-not-working-under-centos-7) have disabled it)
|
||||
* Some form of email server or email gateway such that PHP mail() works.
|
||||
If you cannot set up your own email server, you can use the [phpmailer](https://github.com/friendica/friendica-addons/tree/develop/phpmailer) addon and use a remote SMTP server.
|
||||
* MySQL 5.6+ or an equivalent alternative for MySQL (MariaDB, Percona Server etc.)
|
||||
* MySQL with support of InnoDB and Barracuda (we suggest a MariaDB server as all development is done using these, but alternatives like MySQL or Percona Server etc. might work as well)
|
||||
* ability to schedule jobs with cron (Linux/Mac) or Scheduled Tasks (Windows)
|
||||
* installation into a top-level domain or sub-domain (without a directory/path component in the URL) is RECOMMENDED. Directory paths will not be as convenient to use and have not been thoroughly tested. This is REQUIRED if you wish to communicate with the Diaspora network.
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ Getting started
|
|||
No need to setup up a webserver, database etc. before actually starting.
|
||||
Vagrant creates a virtual machine for you that you can just run inside VirtualBox and start to work directly on Friendica.
|
||||
|
||||
It brings an Debian Bullseye with PHP 7.4 and MariaDB 10.5.11.
|
||||
It brings an Debian Bullseye with PHP 8.0 and MariaDB 10.5.11.
|
||||
|
||||
What you need to do:
|
||||
|
||||
|
@ -24,7 +24,7 @@ This will start the virtual machine.
|
|||
Be patient: When it runs for the first time, it downloads a Debian Server image and installs Friendica.
|
||||
4. Run `vagrant ssh` to log into the virtual machine to log in to the VM in case you need to debug something on the server.
|
||||
5. Open you test installation in a browser.
|
||||
Go to friendica.local (or 192.168.22.10).
|
||||
Go to friendica.local (or 192.168.56.10).
|
||||
friendica.local is using a self-signed TLS certificate, so you will need to add an exception to trust the certificate the first time you are visiting the page.
|
||||
The mysql database is called "friendica", the mysql user and password both are "friendica".
|
||||
6. Work on Friendica's code in your git clone on your machine (not in the VM).
|
||||
|
@ -66,4 +66,4 @@ On the next Vagrant up, the version problem should be fixed.
|
|||
|
||||
If `friendica.local` is not resolved, you may need to add an entry to the `/etc/hosts` file (or similar configuration depending on the OS you are using).
|
||||
|
||||
For further documentation of vagrant, please see [the vagrant*docs*](https://docs.vagrantup.com/v2/).
|
||||
For further documentation of vagrant, please see [the vagrant*docs*](https://docs.vagrantup.com/v2/).
|
||||
|
|
|
@ -13,6 +13,7 @@ Fields
|
|||
| content-warning | | varchar(255) | NO | | | |
|
||||
| body | item body content | mediumtext | YES | | NULL | |
|
||||
| raw-body | Body without embedded media links | mediumtext | YES | | NULL | |
|
||||
| quote-uri-id | Id of the item-uri table that contains the quoted uri | int unsigned | YES | | NULL | |
|
||||
| location | text location where this item originated | varchar(255) | NO | | | |
|
||||
| coord | longitude/latitude pair representing location where this item originated | varchar(255) | NO | | | |
|
||||
| language | Language information about this post | text | YES | | NULL | |
|
||||
|
@ -35,6 +36,7 @@ Indexes
|
|||
| plink | plink(191) |
|
||||
| resource-id | resource-id |
|
||||
| title-content-warning-body | FULLTEXT, title, content-warning, body |
|
||||
| quote-uri-id | quote-uri-id |
|
||||
|
||||
Foreign Keys
|
||||
------------
|
||||
|
@ -42,5 +44,6 @@ Foreign Keys
|
|||
| Field | Target Table | Target Field |
|
||||
|-------|--------------|--------------|
|
||||
| uri-id | [item-uri](help/database/db_item-uri) | id |
|
||||
| quote-uri-id | [item-uri](help/database/db_item-uri) | id |
|
||||
|
||||
Return to [database documentation](help/database)
|
||||
|
|
|
@ -6,36 +6,38 @@ Attached media
|
|||
Fields
|
||||
------
|
||||
|
||||
| Field | Description | Type | Null | Key | Default | Extra |
|
||||
| --------------- | --------------------------------------------------------- | ----------------- | ---- | --- | ------- | -------------- |
|
||||
| id | sequential ID | int unsigned | NO | PRI | NULL | auto_increment |
|
||||
| uri-id | Id of the item-uri table entry that contains the item uri | int unsigned | NO | | NULL | |
|
||||
| url | Media URL | varbinary(1024) | NO | | NULL | |
|
||||
| type | Media type | tinyint unsigned | NO | | 0 | |
|
||||
| mimetype | | varchar(60) | YES | | NULL | |
|
||||
| height | Height of the media | smallint unsigned | YES | | NULL | |
|
||||
| width | Width of the media | smallint unsigned | YES | | NULL | |
|
||||
| size | Media size | bigint unsigned | YES | | NULL | |
|
||||
| preview | Preview URL | varbinary(512) | YES | | NULL | |
|
||||
| preview-height | Height of the preview picture | smallint unsigned | YES | | NULL | |
|
||||
| preview-width | Width of the preview picture | smallint unsigned | YES | | NULL | |
|
||||
| description | | text | YES | | NULL | |
|
||||
| name | Name of the media | varchar(255) | YES | | NULL | |
|
||||
| author-url | URL of the author of the media | varbinary(383) | YES | | NULL | |
|
||||
| author-name | Name of the author of the media | varchar(255) | YES | | NULL | |
|
||||
| author-image | Image of the author of the media | varbinary(383) | YES | | NULL | |
|
||||
| publisher-url | URL of the publisher of the media | varbinary(383) | YES | | NULL | |
|
||||
| publisher-name | Name of the publisher of the media | varchar(255) | YES | | NULL | |
|
||||
| publisher-image | Image of the publisher of the media | varbinary(383) | YES | | NULL | |
|
||||
| Field | Description | Type | Null | Key | Default | Extra |
|
||||
| --------------- | ------------------------------------------------------------------ | ----------------- | ---- | --- | ------- | -------------- |
|
||||
| id | sequential ID | int unsigned | NO | PRI | NULL | auto_increment |
|
||||
| uri-id | Id of the item-uri table entry that contains the item uri | int unsigned | NO | | NULL | |
|
||||
| url | Media URL | varbinary(1024) | NO | | NULL | |
|
||||
| media-uri-id | Id of the item-uri table entry that contains the activities uri-id | int unsigned | YES | | NULL | |
|
||||
| type | Media type | tinyint unsigned | NO | | 0 | |
|
||||
| mimetype | | varchar(60) | YES | | NULL | |
|
||||
| height | Height of the media | smallint unsigned | YES | | NULL | |
|
||||
| width | Width of the media | smallint unsigned | YES | | NULL | |
|
||||
| size | Media size | bigint unsigned | YES | | NULL | |
|
||||
| preview | Preview URL | varbinary(512) | YES | | NULL | |
|
||||
| preview-height | Height of the preview picture | smallint unsigned | YES | | NULL | |
|
||||
| preview-width | Width of the preview picture | smallint unsigned | YES | | NULL | |
|
||||
| description | | text | YES | | NULL | |
|
||||
| name | Name of the media | varchar(255) | YES | | NULL | |
|
||||
| author-url | URL of the author of the media | varbinary(383) | YES | | NULL | |
|
||||
| author-name | Name of the author of the media | varchar(255) | YES | | NULL | |
|
||||
| author-image | Image of the author of the media | varbinary(383) | YES | | NULL | |
|
||||
| publisher-url | URL of the publisher of the media | varbinary(383) | YES | | NULL | |
|
||||
| publisher-name | Name of the publisher of the media | varchar(255) | YES | | NULL | |
|
||||
| publisher-image | Image of the publisher of the media | varbinary(383) | YES | | NULL | |
|
||||
|
||||
Indexes
|
||||
------------
|
||||
|
||||
| Name | Fields |
|
||||
| ---------- | ------------------------ |
|
||||
| PRIMARY | id |
|
||||
| uri-id-url | UNIQUE, uri-id, url(512) |
|
||||
| uri-id-id | uri-id, id |
|
||||
| Name | Fields |
|
||||
| ------------ | ------------------------ |
|
||||
| PRIMARY | id |
|
||||
| uri-id-url | UNIQUE, uri-id, url(512) |
|
||||
| uri-id-id | uri-id, id |
|
||||
| media-uri-id | media-uri-id |
|
||||
|
||||
Foreign Keys
|
||||
------------
|
||||
|
@ -43,5 +45,6 @@ Foreign Keys
|
|||
| Field | Target Table | Target Field |
|
||||
|-------|--------------|--------------|
|
||||
| uri-id | [item-uri](help/database/db_item-uri) | id |
|
||||
| media-uri-id | [item-uri](help/database/db_item-uri) | id |
|
||||
|
||||
Return to [database documentation](help/database)
|
||||
|
|
|
@ -405,6 +405,10 @@ Eine komplette Liste aller Hook-Callbacks mit den zugehörigen Dateien (am 01-Ap
|
|||
Hook::callAll('block', $hook_data);
|
||||
Hook::callAll('unblock', $hook_data);
|
||||
|
||||
### src/Core/Logger/Factory.php
|
||||
|
||||
Hook::callAll('logger_instance', $data);
|
||||
|
||||
### src/Core/StorageManager
|
||||
|
||||
Hook::callAll('storage_instance', $data);
|
||||
|
|
|
@ -31,7 +31,7 @@ Requirements
|
|||
* Das POSIX Modul muss aktiviert sein ([CentOS, RHEL](http://www.bigsoft.co.uk/blog/index.php/2014/12/08/posix-php-commands-not-working-under-centos-7http://www.bigsoft.co.uk/blog/index.php/2014/12/08/posix-php-commands-not-working-under-centos-7) haben dies z.B. deaktiviert)
|
||||
* Einen E-Mail Server, so dass PHP `mail()` funktioniert.
|
||||
Wenn kein eigener E-Mail Server zur Verfügung steht, kann alternativ das [phpmailer](https://github.com/friendica/friendica-addons/tree/develop/phpmailer) Addon mit einem externen SMTP Account verwendet werden.
|
||||
* Mysql 5.6+ (oder eine äquivalente Alternative: MariaDB, Percona Server etc.)
|
||||
* Mysql Server mit Unterstützung vom InnoDB und Barracuda (wir empfehlen MariaDB da die Entwicklung mit solchen Server erfolgt, aber Alternativen wie MySQL, Percona Server etc. sollten auch funktionieren)
|
||||
* die Möglichkeit, wiederkehrende Aufgaben mit cron (Linux/Mac) oder "Scheduled Tasks" einzustellen (Windows) [Beachte: andere Optionen sind in Abschnitt 7 dieser Dokumentation zu finden]
|
||||
* Installation in einer Top-Level-Domain oder Subdomain (ohne eine Verzeichnis/Pfad-Komponente in der URL) wird bevorzugt. Verzeichnispfade sind für diesen Zweck nicht so günstig und wurden auch nicht ausführlich getestet.
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ function cal_content(App $a)
|
|||
$is_owner = local_user() == $owner['uid'];
|
||||
|
||||
if ($owner['hidewall'] && !$is_owner && !$remote_contact) {
|
||||
notice(DI::l10n()->t('Access to this profile has been restricted.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Access to this profile has been restricted.'));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -262,7 +262,7 @@ function cal_content(App $a)
|
|||
|
||||
if ($mode == 'export') {
|
||||
if (!$owner_uid) {
|
||||
notice(DI::l10n()->t('User not found'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('User not found'));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -271,9 +271,9 @@ function cal_content(App $a)
|
|||
|
||||
if (!$evexport["success"]) {
|
||||
if ($evexport["content"]) {
|
||||
notice(DI::l10n()->t('This calendar format is not supported'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('This calendar format is not supported'));
|
||||
} else {
|
||||
notice(DI::l10n()->t('No exportable data found'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('No exportable data found'));
|
||||
}
|
||||
|
||||
// If it the own calendar return to the events page
|
||||
|
|
|
@ -35,14 +35,14 @@ function editpost_content(App $a)
|
|||
$o = '';
|
||||
|
||||
if (!local_user()) {
|
||||
notice(DI::l10n()->t('Permission denied.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||
return;
|
||||
}
|
||||
|
||||
$post_id = ((DI::args()->getArgc() > 1) ? intval(DI::args()->getArgv()[1]) : 0);
|
||||
|
||||
if (!$post_id) {
|
||||
notice(DI::l10n()->t('Item not found'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Item not found'));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ function editpost_content(App $a)
|
|||
$item = Post::selectFirstForUser(local_user(), $fields, ['id' => $post_id, 'uid' => local_user()]);
|
||||
|
||||
if (!DBA::isResult($item)) {
|
||||
notice(DI::l10n()->t('Item not found'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Item not found'));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@ function events_post(App $a)
|
|||
$onerror_path = 'events/' . $action . '?' . http_build_query($params, '', '&', PHP_QUERY_RFC3986);
|
||||
|
||||
if (strcmp($finish, $start) < 0 && !$nofinish) {
|
||||
notice(DI::l10n()->t('Event can not end before it has started.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Event can not end before it has started.'));
|
||||
if (intval($_REQUEST['preview'])) {
|
||||
System::httpExit(DI::l10n()->t('Event can not end before it has started.'));
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ function events_post(App $a)
|
|||
}
|
||||
|
||||
if (!$summary || ($start === DBA::NULL_DATETIME)) {
|
||||
notice(DI::l10n()->t('Event title and start time are required.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Event title and start time are required.'));
|
||||
if (intval($_REQUEST['preview'])) {
|
||||
System::httpExit(DI::l10n()->t('Event title and start time are required.'));
|
||||
}
|
||||
|
@ -206,7 +206,7 @@ function events_post(App $a)
|
|||
}
|
||||
|
||||
if (!$cid && $uri_id) {
|
||||
Worker::add(PRIORITY_HIGH, "Notifier", Delivery::POST, (int)$uri_id, (int)$uid);
|
||||
Worker::add(Worker::PRIORITY_HIGH, "Notifier", Delivery::POST, (int)$uri_id, (int)$uid);
|
||||
}
|
||||
|
||||
DI::baseUrl()->redirect('events');
|
||||
|
@ -215,7 +215,7 @@ function events_post(App $a)
|
|||
function events_content(App $a)
|
||||
{
|
||||
if (!local_user()) {
|
||||
notice(DI::l10n()->t('Permission denied.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||
return Login::form();
|
||||
}
|
||||
|
||||
|
@ -532,7 +532,7 @@ function events_content(App $a)
|
|||
}
|
||||
|
||||
if (Post::exists(['id' => $ev[0]['itemid']])) {
|
||||
notice(DI::l10n()->t('Failed to remove event'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Failed to remove event'));
|
||||
}
|
||||
|
||||
DI::baseUrl()->redirect('events');
|
||||
|
|
|
@ -53,7 +53,7 @@ function follow_content(App $a)
|
|||
$return_path = 'contact';
|
||||
|
||||
if (!local_user()) {
|
||||
notice(DI::l10n()->t('Permission denied.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||
DI::baseUrl()->redirect($return_path);
|
||||
// NOTREACHED
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ function follow_content(App $a)
|
|||
|
||||
if (DBA::isResult($user_contact)) {
|
||||
if ($user_contact['pending']) {
|
||||
notice(DI::l10n()->t('You already added this contact.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('You already added this contact.'));
|
||||
$submit = '';
|
||||
}
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ function follow_content(App $a)
|
|||
// Possibly it is a remote item and not an account
|
||||
follow_remote_item($url);
|
||||
|
||||
notice(DI::l10n()->t("The network type couldn't be detected. Contact can't be added."));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t("The network type couldn't be detected. Contact can't be added."));
|
||||
$submit = '';
|
||||
$contact = ['url' => $url, 'network' => Protocol::PHANTOM, 'name' => $url, 'keywords' => ''];
|
||||
}
|
||||
|
@ -105,12 +105,12 @@ function follow_content(App $a)
|
|||
$protocol = Contact::getProtocol($contact['url'], $contact['network']);
|
||||
|
||||
if (($protocol == Protocol::DIASPORA) && !DI::config()->get('system', 'diaspora_enabled')) {
|
||||
notice(DI::l10n()->t("Diaspora support isn't enabled. Contact can't be added."));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t("Diaspora support isn't enabled. Contact can't be added."));
|
||||
$submit = '';
|
||||
}
|
||||
|
||||
if (($protocol == Protocol::OSTATUS) && DI::config()->get('system', 'ostatus_disabled')) {
|
||||
notice(DI::l10n()->t("OStatus support is disabled. Contact can't be added."));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t("OStatus support is disabled. Contact can't be added."));
|
||||
$submit = '';
|
||||
}
|
||||
|
||||
|
@ -127,7 +127,7 @@ function follow_content(App $a)
|
|||
|
||||
$owner = User::getOwnerDataById($uid);
|
||||
if (empty($owner)) {
|
||||
notice(DI::l10n()->t('Permission denied.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||
DI::baseUrl()->redirect($return_path);
|
||||
// NOTREACHED
|
||||
}
|
||||
|
@ -181,14 +181,14 @@ function follow_process(App $a, string $url)
|
|||
follow_remote_item($url);
|
||||
|
||||
if ($result['message']) {
|
||||
notice($result['message']);
|
||||
DI::sysmsg()->addNotice($result['message']);
|
||||
}
|
||||
DI::baseUrl()->redirect($return_path);
|
||||
} elseif ($result['cid']) {
|
||||
DI::baseUrl()->redirect('contact/' . $result['cid']);
|
||||
}
|
||||
|
||||
notice(DI::l10n()->t('The contact could not be added.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('The contact could not be added.'));
|
||||
|
||||
DI::baseUrl()->redirect($return_path);
|
||||
}
|
||||
|
|
15
mod/item.php
15
mod/item.php
|
@ -36,6 +36,7 @@ use Friendica\Core\Logger;
|
|||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Attach;
|
||||
|
@ -128,7 +129,7 @@ function item_post(App $a) {
|
|||
}
|
||||
|
||||
if (!DBA::isResult($toplevel_item)) {
|
||||
notice(DI::l10n()->t('Unable to locate original post.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Unable to locate original post.'));
|
||||
if ($return_path) {
|
||||
DI::baseUrl()->redirect($return_path);
|
||||
}
|
||||
|
@ -178,7 +179,7 @@ function item_post(App $a) {
|
|||
// Now check that valid personal details have been provided
|
||||
if (!Security::canWriteToUserWall($profile_uid) && !$allow_comment) {
|
||||
Logger::warning('Permission denied.', ['local' => local_user(), 'profile_uid' => $profile_uid, 'toplevel_item_id' => $toplevel_item_id, 'network' => $toplevel_item['network']]);
|
||||
notice(DI::l10n()->t('Permission denied.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||
if ($return_path) {
|
||||
DI::baseUrl()->redirect($return_path);
|
||||
}
|
||||
|
@ -334,7 +335,7 @@ function item_post(App $a) {
|
|||
System::jsonExit(['preview' => '']);
|
||||
}
|
||||
|
||||
notice(DI::l10n()->t('Empty post discarded.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Empty post discarded.'));
|
||||
if ($return_path) {
|
||||
DI::baseUrl()->redirect($return_path);
|
||||
}
|
||||
|
@ -632,7 +633,7 @@ function item_post(App $a) {
|
|||
unset($datarray['self']);
|
||||
unset($datarray['api_source']);
|
||||
|
||||
Post\Delayed::add($datarray['uri'], $datarray, PRIORITY_HIGH, Post\Delayed::PREPARED_NO_HOOK, $scheduled_at);
|
||||
Post\Delayed::add($datarray['uri'], $datarray, Worker::PRIORITY_HIGH, Post\Delayed::PREPARED_NO_HOOK, $scheduled_at);
|
||||
item_post_return(DI::baseUrl(), $api_source, $return_path);
|
||||
}
|
||||
}
|
||||
|
@ -681,7 +682,7 @@ function item_post(App $a) {
|
|||
$post_id = Item::insert($datarray);
|
||||
|
||||
if (!$post_id) {
|
||||
notice(DI::l10n()->t('Item wasn\'t stored.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Item wasn\'t stored.'));
|
||||
if ($return_path) {
|
||||
DI::baseUrl()->redirect($return_path);
|
||||
}
|
||||
|
@ -837,7 +838,7 @@ function drop_item(int $id, string $return = ''): string
|
|||
$item = Post::selectFirstForUser(local_user(), ['id', 'uid', 'guid', 'contact-id', 'deleted', 'gravity', 'parent'], ['id' => $id]);
|
||||
|
||||
if (!DBA::isResult($item)) {
|
||||
notice(DI::l10n()->t('Item not found.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Item not found.'));
|
||||
DI::baseUrl()->redirect('network');
|
||||
//NOTREACHED
|
||||
}
|
||||
|
@ -861,7 +862,7 @@ function drop_item(int $id, string $return = ''): string
|
|||
//NOTREACHED
|
||||
} else {
|
||||
Logger::warning('Permission denied.', ['local' => local_user(), 'uid' => $item['uid'], 'cid' => $contact_id]);
|
||||
notice(DI::l10n()->t('Permission denied.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||
DI::baseUrl()->redirect('display/' . $item['guid']);
|
||||
//NOTREACHED
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ function lostpass_post(App $a)
|
|||
$condition = ['(`email` = ? OR `nickname` = ?) AND `verified` = 1 AND `blocked` = 0', $loginame, $loginame];
|
||||
$user = DBA::selectFirst('user', ['uid', 'username', 'nickname', 'email', 'language'], $condition);
|
||||
if (!DBA::isResult($user)) {
|
||||
notice(DI::l10n()->t('No valid account found.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('No valid account found.'));
|
||||
DI::baseUrl()->redirect();
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ function lostpass_post(App $a)
|
|||
];
|
||||
$result = DBA::update('user', $fields, ['uid' => $user['uid']]);
|
||||
if ($result) {
|
||||
info(DI::l10n()->t('Password reset request issued. Check your email.'));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->t('Password reset request issued. Check your email.'));
|
||||
}
|
||||
|
||||
$sitename = DI::config()->get('config', 'sitename');
|
||||
|
@ -97,7 +97,7 @@ function lostpass_content(App $a)
|
|||
|
||||
$user = DBA::selectFirst('user', ['uid', 'username', 'nickname', 'email', 'pwdreset_time', 'language'], ['pwdreset' => hash('sha256', $pwdreset_token)]);
|
||||
if (!DBA::isResult($user)) {
|
||||
notice(DI::l10n()->t("Request could not be verified. \x28You may have previously submitted it.\x29 Password reset failed."));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t("Request could not be verified. \x28You may have previously submitted it.\x29 Password reset failed."));
|
||||
|
||||
return lostpass_form();
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ function lostpass_content(App $a)
|
|||
];
|
||||
DBA::update('user', $fields, ['uid' => $user['uid']]);
|
||||
|
||||
notice(DI::l10n()->t('Request has expired, please make a new one.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Request has expired, please make a new one.'));
|
||||
|
||||
return lostpass_form();
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ function lostpass_generate_password($user)
|
|||
'$newpass' => $new_password,
|
||||
]);
|
||||
|
||||
info(DI::l10n()->t("Your password has been reset."));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->t("Your password has been reset."));
|
||||
|
||||
$sitename = DI::config()->get('config', 'sitename');
|
||||
$preamble = Strings::deindent(DI::l10n()->t('
|
||||
|
|
|
@ -59,7 +59,7 @@ function match_content(App $a)
|
|||
return '';
|
||||
}
|
||||
if (!$profile['pub_keywords'] && (!$profile['prv_keywords'])) {
|
||||
notice(DI::l10n()->t('No keywords to match. Please add keywords to your profile.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('No keywords to match. Please add keywords to your profile.'));
|
||||
return '';
|
||||
}
|
||||
|
||||
|
@ -90,7 +90,7 @@ function match_content(App $a)
|
|||
}
|
||||
|
||||
if (empty($entries)) {
|
||||
info(DI::l10n()->t('No matches'));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->t('No matches'));
|
||||
}
|
||||
|
||||
$tpl = Renderer::getMarkupTemplate('viewcontact_template.tpl');
|
||||
|
|
|
@ -66,7 +66,7 @@ function message_init(App $a)
|
|||
function message_post(App $a)
|
||||
{
|
||||
if (!local_user()) {
|
||||
notice(DI::l10n()->t('Permission denied.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -80,20 +80,20 @@ function message_post(App $a)
|
|||
|
||||
switch ($ret) {
|
||||
case -1:
|
||||
notice(DI::l10n()->t('No recipient selected.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('No recipient selected.'));
|
||||
$norecip = true;
|
||||
break;
|
||||
|
||||
case -2:
|
||||
notice(DI::l10n()->t('Unable to locate contact information.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Unable to locate contact information.'));
|
||||
break;
|
||||
|
||||
case -3:
|
||||
notice(DI::l10n()->t('Message could not be sent.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Message could not be sent.'));
|
||||
break;
|
||||
|
||||
case -4:
|
||||
notice(DI::l10n()->t('Message collection failure.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Message collection failure.'));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -111,7 +111,7 @@ function message_content(App $a)
|
|||
Nav::setSelected('messages');
|
||||
|
||||
if (!local_user()) {
|
||||
notice(DI::l10n()->t('Permission denied.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||
return Login::form();
|
||||
}
|
||||
|
||||
|
@ -146,12 +146,12 @@ function message_content(App $a)
|
|||
if ($cmd === 'drop') {
|
||||
$message = DBA::selectFirst('mail', ['convid'], ['id' => DI::args()->getArgv()[2], 'uid' => local_user()]);
|
||||
if(!DBA::isResult($message)){
|
||||
notice(DI::l10n()->t('Conversation not found.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Conversation not found.'));
|
||||
DI::baseUrl()->redirect('message');
|
||||
}
|
||||
|
||||
if (!DBA::delete('mail', ['id' => DI::args()->getArgv()[2], 'uid' => local_user()])) {
|
||||
notice(DI::l10n()->t('Message was not deleted.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Message was not deleted.'));
|
||||
}
|
||||
|
||||
$conversation = DBA::selectFirst('mail', ['id'], ['convid' => $message['convid'], 'uid' => local_user()]);
|
||||
|
@ -166,7 +166,7 @@ function message_content(App $a)
|
|||
$parent = $parentmail['parent-uri'];
|
||||
|
||||
if (!DBA::delete('mail', ['parent-uri' => $parent, 'uid' => local_user()])) {
|
||||
notice(DI::l10n()->t('Conversation was not removed.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Conversation was not removed.'));
|
||||
}
|
||||
}
|
||||
DI::baseUrl()->redirect('message');
|
||||
|
@ -222,7 +222,7 @@ function message_content(App $a)
|
|||
$r = get_messages(local_user(), $pager->getStart(), $pager->getItemsPerPage());
|
||||
|
||||
if (!DBA::isResult($r)) {
|
||||
notice(DI::l10n()->t('No messages.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('No messages.'));
|
||||
return $o;
|
||||
}
|
||||
|
||||
|
@ -278,7 +278,7 @@ function message_content(App $a)
|
|||
}
|
||||
|
||||
if (!DBA::isResult($messages)) {
|
||||
notice(DI::l10n()->t('Message not available.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Message not available.'));
|
||||
return $o;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ function notes_init(App $a)
|
|||
function notes_content(App $a, bool $update = false)
|
||||
{
|
||||
if (!local_user()) {
|
||||
notice(DI::l10n()->t('Permission denied.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ use Friendica\Protocol\ActivityPub;
|
|||
function ostatus_subscribe_content(App $a): string
|
||||
{
|
||||
if (!local_user()) {
|
||||
notice(DI::l10n()->t('Permission denied.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||
DI::baseUrl()->redirect('ostatus_subscribe');
|
||||
// NOTREACHED
|
||||
}
|
||||
|
|
|
@ -157,14 +157,14 @@ function photos_post(App $a)
|
|||
}
|
||||
|
||||
if (!$can_post) {
|
||||
notice(DI::l10n()->t('Permission denied.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||
System::exit();
|
||||
}
|
||||
|
||||
$owner_record = User::getOwnerDataById($page_owner_uid);
|
||||
|
||||
if (!$owner_record) {
|
||||
notice(DI::l10n()->t('Contact information unavailable'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Contact information unavailable'));
|
||||
DI::logger()->info('photos_post: unable to locate contact record for page owner. uid=' . $page_owner_uid);
|
||||
System::exit();
|
||||
}
|
||||
|
@ -193,7 +193,7 @@ function photos_post(App $a)
|
|||
$album = hex2bin(DI::args()->getArgv()[3]);
|
||||
|
||||
if (!DBA::exists('photo', ['album' => $album, 'uid' => $page_owner_uid, 'photo-type' => Photo::DEFAULT])) {
|
||||
notice(DI::l10n()->t('Album not found.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Album not found.'));
|
||||
DI::baseUrl()->redirect('photos/' . $user['nickname'] . '/album');
|
||||
return; // NOTREACHED
|
||||
}
|
||||
|
@ -247,9 +247,9 @@ function photos_post(App $a)
|
|||
|
||||
// Update the photo albums cache
|
||||
Photo::clearAlbumCache($page_owner_uid);
|
||||
notice(DI::l10n()->t('Album successfully deleted'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Album successfully deleted'));
|
||||
} else {
|
||||
notice(DI::l10n()->t('Album was empty.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Album was empty.'));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -281,7 +281,7 @@ function photos_post(App $a)
|
|||
// Update the photo albums cache
|
||||
Photo::clearAlbumCache($page_owner_uid);
|
||||
} else {
|
||||
notice(DI::l10n()->t('Failed to delete the photo.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Failed to delete the photo.'));
|
||||
DI::baseUrl()->redirect('photos/' . DI::args()->getArgv()[1] . '/image/' . DI::args()->getArgv()[3]);
|
||||
}
|
||||
|
||||
|
@ -629,21 +629,21 @@ function photos_post(App $a)
|
|||
if ($error !== UPLOAD_ERR_OK) {
|
||||
switch ($error) {
|
||||
case UPLOAD_ERR_INI_SIZE:
|
||||
notice(DI::l10n()->t('Image exceeds size limit of %s', ini_get('upload_max_filesize')));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Image exceeds size limit of %s', ini_get('upload_max_filesize')));
|
||||
break;
|
||||
case UPLOAD_ERR_FORM_SIZE:
|
||||
notice(DI::l10n()->t('Image exceeds size limit of %s', Strings::formatBytes($_REQUEST['MAX_FILE_SIZE'] ?? 0)));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Image exceeds size limit of %s', Strings::formatBytes($_REQUEST['MAX_FILE_SIZE'] ?? 0)));
|
||||
break;
|
||||
case UPLOAD_ERR_PARTIAL:
|
||||
notice(DI::l10n()->t('Image upload didn\'t complete, please try again'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Image upload didn\'t complete, please try again'));
|
||||
break;
|
||||
case UPLOAD_ERR_NO_FILE:
|
||||
notice(DI::l10n()->t('Image file is missing'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Image file is missing'));
|
||||
break;
|
||||
case UPLOAD_ERR_NO_TMP_DIR:
|
||||
case UPLOAD_ERR_CANT_WRITE:
|
||||
case UPLOAD_ERR_EXTENSION:
|
||||
notice(DI::l10n()->t('Server can\'t accept new file upload at this time, please contact your administrator'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Server can\'t accept new file upload at this time, please contact your administrator'));
|
||||
break;
|
||||
}
|
||||
@unlink($src);
|
||||
|
@ -659,7 +659,7 @@ function photos_post(App $a)
|
|||
$maximagesize = DI::config()->get('system', 'maximagesize');
|
||||
|
||||
if ($maximagesize && ($filesize > $maximagesize)) {
|
||||
notice(DI::l10n()->t('Image exceeds size limit of %s', Strings::formatBytes($maximagesize)));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Image exceeds size limit of %s', Strings::formatBytes($maximagesize)));
|
||||
@unlink($src);
|
||||
$foo = 0;
|
||||
Hook::callAll('photo_post_end', $foo);
|
||||
|
@ -667,7 +667,7 @@ function photos_post(App $a)
|
|||
}
|
||||
|
||||
if (!$filesize) {
|
||||
notice(DI::l10n()->t('Image file is empty.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Image file is empty.'));
|
||||
@unlink($src);
|
||||
$foo = 0;
|
||||
Hook::callAll('photo_post_end', $foo);
|
||||
|
@ -682,7 +682,7 @@ function photos_post(App $a)
|
|||
|
||||
if (!$image->isValid()) {
|
||||
Logger::notice('unable to process image');
|
||||
notice(DI::l10n()->t('Unable to process image.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Unable to process image.'));
|
||||
@unlink($src);
|
||||
$foo = 0;
|
||||
Hook::callAll('photo_post_end',$foo);
|
||||
|
@ -708,7 +708,7 @@ function photos_post(App $a)
|
|||
|
||||
if (!$r) {
|
||||
Logger::warning('image store failed');
|
||||
notice(DI::l10n()->t('Image upload failed.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Image upload failed.'));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -795,12 +795,12 @@ function photos_content(App $a)
|
|||
}
|
||||
|
||||
if (DI::config()->get('system', 'block_public') && !Session::isAuthenticated()) {
|
||||
notice(DI::l10n()->t('Public access denied.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Public access denied.'));
|
||||
return;
|
||||
}
|
||||
|
||||
if (empty($user)) {
|
||||
notice(DI::l10n()->t('No photos selected'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('No photos selected'));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -869,7 +869,7 @@ function photos_content(App $a)
|
|||
}
|
||||
|
||||
if ($user['hidewall'] && (local_user() != $owner_uid) && !$remote_contact) {
|
||||
notice(DI::l10n()->t('Access to this item is restricted.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Access to this item is restricted.'));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -884,7 +884,7 @@ function photos_content(App $a)
|
|||
// Display upload form
|
||||
if ($datatype === 'upload') {
|
||||
if (!$can_post) {
|
||||
notice(DI::l10n()->t('Permission denied.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1084,9 +1084,9 @@ function photos_content(App $a)
|
|||
|
||||
if (!DBA::isResult($ph)) {
|
||||
if (DBA::exists('photo', ['resource-id' => $datum, 'uid' => $owner_uid])) {
|
||||
notice(DI::l10n()->t('Permission denied. Access to this item may be restricted.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied. Access to this item may be restricted.'));
|
||||
} else {
|
||||
notice(DI::l10n()->t('Photo not available'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Photo not available'));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ use Friendica\Model\Contact;
|
|||
function repair_ostatus_content(App $a) {
|
||||
|
||||
if (!local_user()) {
|
||||
notice(DI::l10n()->t('Permission denied.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||
DI::baseUrl()->redirect('ostatus_repair');
|
||||
// NOTREACHED
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ use Friendica\Protocol\Email;
|
|||
function settings_init(App $a)
|
||||
{
|
||||
if (!local_user()) {
|
||||
notice(DI::l10n()->t('Permission denied.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ function settings_init(App $a)
|
|||
function settings_post(App $a)
|
||||
{
|
||||
if (!$a->isLoggedIn()) {
|
||||
notice(DI::l10n()->t('Permission denied.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ function settings_post(App $a)
|
|||
$mbox = Email::connect($mb, $mail_user, $dcrpass);
|
||||
unset($dcrpass);
|
||||
if (!$mbox) {
|
||||
notice(DI::l10n()->t('Failed to connect with email account using the settings provided.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Failed to connect with email account using the settings provided.'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -148,12 +148,12 @@ function settings_content(App $a)
|
|||
Nav::setSelected('settings');
|
||||
|
||||
if (!local_user()) {
|
||||
//notice(DI::l10n()->t('Permission denied.'));
|
||||
//DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||
return Login::form();
|
||||
}
|
||||
|
||||
if (!empty($_SESSION['submanage'])) {
|
||||
notice(DI::l10n()->t('Permission denied.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||
return '';
|
||||
}
|
||||
|
||||
|
|
|
@ -166,6 +166,6 @@ EOT;
|
|||
|
||||
$post = Post::selectFirst(['uri-id', 'uid'], ['id' => $post_id]);
|
||||
|
||||
Worker::add(PRIORITY_HIGH, "Notifier", Delivery::POST, $post['uri-id'], $post['uid']);
|
||||
Worker::add(Worker::PRIORITY_HIGH, "Notifier", Delivery::POST, $post['uri-id'], $post['uid']);
|
||||
System::exit();
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ use Friendica\DI;
|
|||
function uimport_post(App $a)
|
||||
{
|
||||
if ((DI::config()->get('config', 'register_policy') != \Friendica\Module\Register::OPEN) && !$a->isSiteAdmin()) {
|
||||
notice(DI::l10n()->t('Permission denied.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ function uimport_post(App $a)
|
|||
function uimport_content(App $a)
|
||||
{
|
||||
if ((DI::config()->get('config', 'register_policy') != \Friendica\Module\Register::OPEN) && !$a->isSiteAdmin()) {
|
||||
notice(DI::l10n()->t('User imports on closed servers can only be done by an administrator.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('User imports on closed servers can only be done by an administrator.'));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ function uimport_content(App $a)
|
|||
$total = DBA::count('user', ["`register_date` > UTC_TIMESTAMP - INTERVAL 1 DAY"]);
|
||||
if ($total >= $max_dailies) {
|
||||
Logger::notice('max daily registrations exceeded.');
|
||||
notice(DI::l10n()->t('This site has exceeded the number of allowed daily account registrations. Please try again tomorrow.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('This site has exceeded the number of allowed daily account registrations. Please try again tomorrow.'));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ use Friendica\Util\Strings;
|
|||
function unfollow_post(App $a)
|
||||
{
|
||||
if (!local_user()) {
|
||||
notice(DI::l10n()->t('Permission denied.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||
DI::baseUrl()->redirect('login');
|
||||
// NOTREACHED
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ function unfollow_content(App $a)
|
|||
$base_return_path = 'contact';
|
||||
|
||||
if (!local_user()) {
|
||||
notice(DI::l10n()->t('Permission denied.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||
DI::baseUrl()->redirect('login');
|
||||
// NOTREACHED
|
||||
}
|
||||
|
@ -62,13 +62,13 @@ function unfollow_content(App $a)
|
|||
$contact = DBA::selectFirst('contact', ['url', 'id', 'uid', 'network', 'addr', 'name'], $condition);
|
||||
|
||||
if (!DBA::isResult($contact)) {
|
||||
notice(DI::l10n()->t("You aren't following this contact."));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t("You aren't following this contact."));
|
||||
DI::baseUrl()->redirect($base_return_path);
|
||||
// NOTREACHED
|
||||
}
|
||||
|
||||
if (!Protocol::supportsFollow($contact['network'])) {
|
||||
notice(DI::l10n()->t('Unfollowing is currently not supported by your network.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Unfollowing is currently not supported by your network.'));
|
||||
DI::baseUrl()->redirect($base_return_path . '/' . $contact['id']);
|
||||
// NOTREACHED
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ function unfollow_content(App $a)
|
|||
$self = DBA::selectFirst('contact', ['url'], ['uid' => $uid, 'self' => true]);
|
||||
|
||||
if (!DBA::isResult($self)) {
|
||||
notice(DI::l10n()->t('Permission denied.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||
DI::baseUrl()->redirect($base_return_path);
|
||||
// NOTREACHED
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ function unfollow_process(string $url)
|
|||
$contact = DBA::selectFirst('contact', [], $condition);
|
||||
|
||||
if (!DBA::isResult($contact)) {
|
||||
notice(DI::l10n()->t("You aren't following this contact."));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t("You aren't following this contact."));
|
||||
DI::baseUrl()->redirect($base_return_path);
|
||||
// NOTREACHED
|
||||
}
|
||||
|
@ -146,6 +146,6 @@ function unfollow_process(string $url)
|
|||
$notice_message = DI::l10n()->t('Unable to unfollow this contact, please contact your administrator');
|
||||
}
|
||||
|
||||
notice($notice_message);
|
||||
DI::sysmsg()->addNotice($notice_message);
|
||||
DI::baseUrl()->redirect($return_path);
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ function wall_attach_post(App $a) {
|
|||
if ($r_json) {
|
||||
System::jsonExit(['error' => DI::l10n()->t('Permission denied.')]);
|
||||
}
|
||||
notice(DI::l10n()->t('Permission denied.') . EOL );
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||
System::exit();
|
||||
}
|
||||
|
||||
|
@ -90,12 +90,12 @@ function wall_attach_post(App $a) {
|
|||
*/
|
||||
|
||||
if ($filesize <= 0) {
|
||||
$msg = DI::l10n()->t('Sorry, maybe your upload is bigger than the PHP configuration allows') . EOL .(DI::l10n()->t('Or - did you try to upload an empty file?'));
|
||||
$msg = DI::l10n()->t('Sorry, maybe your upload is bigger than the PHP configuration allows') . '<br />' . (DI::l10n()->t('Or - did you try to upload an empty file?'));
|
||||
@unlink($src);
|
||||
if ($r_json) {
|
||||
System::jsonExit(['error' => $msg]);
|
||||
} else {
|
||||
notice($msg);
|
||||
DI::sysmsg()->addNotice($msg);
|
||||
}
|
||||
System::exit();
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ function wall_attach_post(App $a) {
|
|||
if ($r_json) {
|
||||
System::jsonExit(['error' => $msg]);
|
||||
} else {
|
||||
echo $msg . EOL;
|
||||
echo $msg . '<br />';
|
||||
}
|
||||
System::exit();
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ function wall_attach_post(App $a) {
|
|||
if ($r_json) {
|
||||
System::jsonExit(['error' => $msg]);
|
||||
} else {
|
||||
echo $msg . EOL;
|
||||
echo $msg . '<br />';
|
||||
}
|
||||
System::exit();
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ function wall_upload_post(App $a, $desktopmode = true)
|
|||
if ($r_json) {
|
||||
System::jsonExit(['error' => DI::l10n()->t('Permission denied.')]);
|
||||
}
|
||||
notice(DI::l10n()->t('Permission denied.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||
System::exit();
|
||||
}
|
||||
|
||||
|
@ -147,7 +147,7 @@ function wall_upload_post(App $a, $desktopmode = true)
|
|||
if ($r_json) {
|
||||
System::jsonExit(['error' => DI::l10n()->t('Invalid request.')]);
|
||||
}
|
||||
notice(DI::l10n()->t('Invalid request.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Invalid request.'));
|
||||
System::exit();
|
||||
}
|
||||
|
||||
|
@ -165,7 +165,7 @@ function wall_upload_post(App $a, $desktopmode = true)
|
|||
if ($r_json) {
|
||||
System::jsonExit(['error' => $msg]);
|
||||
} else {
|
||||
echo $msg. EOL;
|
||||
echo $msg . '<br />';
|
||||
}
|
||||
System::exit();
|
||||
}
|
||||
|
@ -203,7 +203,7 @@ function wall_upload_post(App $a, $desktopmode = true)
|
|||
if ($r_json) {
|
||||
System::jsonExit(['error' => $msg]);
|
||||
} else {
|
||||
echo $msg. EOL;
|
||||
echo $msg . '<br />';
|
||||
}
|
||||
System::exit();
|
||||
}
|
||||
|
@ -227,7 +227,7 @@ function wall_upload_post(App $a, $desktopmode = true)
|
|||
if ($r_json) {
|
||||
System::jsonExit(['error' => $msg]);
|
||||
} else {
|
||||
echo $msg. EOL;
|
||||
echo $msg . '<br />';
|
||||
}
|
||||
System::exit();
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ function wallmessage_post(App $a) {
|
|||
|
||||
$replyto = Profile::getMyURL();
|
||||
if (!$replyto) {
|
||||
notice(DI::l10n()->t('Permission denied.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -53,13 +53,13 @@ function wallmessage_post(App $a) {
|
|||
}
|
||||
|
||||
if (!$user['unkmail']) {
|
||||
notice(DI::l10n()->t('Permission denied.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||
return;
|
||||
}
|
||||
|
||||
$total = DBA::count('mail', ["`uid` = ? AND `created` > ? AND `unknown`", $user['uid'], DateTimeFormat::utc('now - 1 day')]);
|
||||
if ($total > $user['cntunkmail']) {
|
||||
notice(DI::l10n()->t('Number of daily wall messages for %s exceeded. Message failed.', $user['username']));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Number of daily wall messages for %s exceeded. Message failed.', $user['username']));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -67,16 +67,16 @@ function wallmessage_post(App $a) {
|
|||
|
||||
switch ($ret) {
|
||||
case -1:
|
||||
notice(DI::l10n()->t('No recipient selected.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('No recipient selected.'));
|
||||
break;
|
||||
case -2:
|
||||
notice(DI::l10n()->t('Unable to check your home location.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Unable to check your home location.'));
|
||||
break;
|
||||
case -3:
|
||||
notice(DI::l10n()->t('Message could not be sent.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Message could not be sent.'));
|
||||
break;
|
||||
case -4:
|
||||
notice(DI::l10n()->t('Message collection failure.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Message collection failure.'));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -87,33 +87,33 @@ function wallmessage_post(App $a) {
|
|||
function wallmessage_content(App $a) {
|
||||
|
||||
if (!Profile::getMyURL()) {
|
||||
notice(DI::l10n()->t('Permission denied.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||
return;
|
||||
}
|
||||
|
||||
$recipient = ((DI::args()->getArgc() > 1) ? DI::args()->getArgv()[1] : '');
|
||||
|
||||
if (!$recipient) {
|
||||
notice(DI::l10n()->t('No recipient.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('No recipient.'));
|
||||
return;
|
||||
}
|
||||
|
||||
$user = User::getByNickname($recipient);
|
||||
|
||||
if (empty($user)) {
|
||||
notice(DI::l10n()->t('No recipient.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('No recipient.'));
|
||||
Logger::notice('wallmessage: no recipient');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$user['unkmail']) {
|
||||
notice(DI::l10n()->t('Permission denied.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||
return;
|
||||
}
|
||||
|
||||
$total = DBA::count('mail', ["`uid` = ? AND `created` > ? AND `unknown`", $user['uid'], DateTimeFormat::utc('now - 1 day')]);
|
||||
if ($total > $user['cntunkmail']) {
|
||||
notice(DI::l10n()->t('Number of daily wall messages for %s exceeded. Message failed.', $user['username']));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Number of daily wall messages for %s exceeded. Message failed.', $user['username']));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ return [
|
|||
// ****************************************************************
|
||||
|
||||
'config' => [
|
||||
'hostname' => 'friendica.local',
|
||||
'hostname' => '192.168.56.10',
|
||||
'admin_email' => 'admin@friendica.local',
|
||||
'sitename' => 'Friendica Social Network',
|
||||
'register_policy' => \Friendica\Module\Register::OPEN,
|
||||
|
|
|
@ -58,6 +58,10 @@ use Psr\Log\LoggerInterface;
|
|||
*/
|
||||
class App
|
||||
{
|
||||
const PLATFORM = 'Friendica';
|
||||
const CODENAME = 'Giant Rhubarb';
|
||||
const VERSION = '2022.12-dev';
|
||||
|
||||
// Allow themes to control internal parameters
|
||||
// by changing App values in theme.php
|
||||
private $theme_info = [
|
||||
|
@ -347,6 +351,11 @@ class App
|
|||
{
|
||||
set_time_limit(0);
|
||||
|
||||
// Normally this constant is defined - but not if "pcntl" isn't installed
|
||||
if (!defined('SIGTERM')) {
|
||||
define('SIGTERM', 15);
|
||||
}
|
||||
|
||||
// Ensure that all "strtotime" operations do run timezone independent
|
||||
date_default_timezone_set('UTC');
|
||||
|
||||
|
|
|
@ -202,7 +202,7 @@ class Page implements ArrayAccess
|
|||
*/
|
||||
public function registerStylesheet(string $path, string $media = 'screen')
|
||||
{
|
||||
$path = Network::appendQueryParam($path, ['v' => FRIENDICA_VERSION]);
|
||||
$path = Network::appendQueryParam($path, ['v' => App::VERSION]);
|
||||
|
||||
if (mb_strpos($path, $this->basePath . DIRECTORY_SEPARATOR) === 0) {
|
||||
$path = mb_substr($path, mb_strlen($this->basePath . DIRECTORY_SEPARATOR));
|
||||
|
@ -277,7 +277,7 @@ class Page implements ArrayAccess
|
|||
*/
|
||||
$this->page['htmlhead'] = Renderer::replaceMacros($tpl, [
|
||||
'$local_user' => local_user(),
|
||||
'$generator' => 'Friendica' . ' ' . FRIENDICA_VERSION,
|
||||
'$generator' => 'Friendica' . ' ' . App::VERSION,
|
||||
'$delitem' => $l10n->t('Delete this item?'),
|
||||
'$blockAuthor' => $l10n->t('Block this author? They won\'t be able to follow you nor see your public posts, and you won\'t be able to see their posts and their notifications.'),
|
||||
'$update_interval' => $interval,
|
||||
|
@ -395,7 +395,7 @@ class Page implements ArrayAccess
|
|||
*/
|
||||
public function registerFooterScript($path)
|
||||
{
|
||||
$path = Network::appendQueryParam($path, ['v' => FRIENDICA_VERSION]);
|
||||
$path = Network::appendQueryParam($path, ['v' => App::VERSION]);
|
||||
|
||||
$url = str_replace($this->basePath . DIRECTORY_SEPARATOR, '', $path);
|
||||
|
||||
|
@ -543,7 +543,7 @@ class Page implements ArrayAccess
|
|||
|
||||
$page = $this->page;
|
||||
|
||||
header("X-Friendica-Version: " . FRIENDICA_VERSION);
|
||||
header("X-Friendica-Version: " . App::VERSION);
|
||||
header("Content-type: text/html; charset=utf-8");
|
||||
|
||||
if ($config->get('system', 'hsts') && ($baseURL->getSSLPolicy() == BaseURL::SSL_POLICY_FULL)) {
|
||||
|
|
|
@ -389,7 +389,7 @@ abstract class BaseModule implements ICanHandleRequests
|
|||
|
||||
public static function getFormSecurityStandardErrorMessage(): string
|
||||
{
|
||||
return DI::l10n()->t("The form security token was not correct. This probably happened because the form has been opened for too long \x28>3 hours\x29 before submitting it.") . EOL;
|
||||
return DI::l10n()->t("The form security token was not correct. This probably happened because the form has been opened for too long \x28>3 hours\x29 before submitting it.");
|
||||
}
|
||||
|
||||
public static function checkFormSecurityTokenRedirectOnError(string $err_redirect, string $typename = '', string $formname = 'form_security_token')
|
||||
|
@ -397,7 +397,7 @@ abstract class BaseModule implements ICanHandleRequests
|
|||
if (!self::checkFormSecurityToken($typename, $formname)) {
|
||||
Logger::notice('checkFormSecurityToken failed: user ' . DI::app()->getLoggedInUserNickname() . ' - form element ' . $typename);
|
||||
Logger::debug('checkFormSecurityToken failed', ['request' => $_REQUEST]);
|
||||
notice(self::getFormSecurityStandardErrorMessage());
|
||||
DI::sysmsg()->addNotice(self::getFormSecurityStandardErrorMessage());
|
||||
DI::baseUrl()->redirect($err_redirect);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -197,7 +197,7 @@ HELP;
|
|||
$this->out('Schedule relocation messages to remote Friendica and Diaspora hosts');
|
||||
$users = $this->database->selectToArray('user', ['uid'], ['account_removed' => false, 'account_expired' => false]);
|
||||
foreach ($users as $user) {
|
||||
Worker::add(PRIORITY_HIGH, 'Notifier', Delivery::RELOCATION, $user['uid']);
|
||||
Worker::add(Worker::PRIORITY_HIGH, 'Notifier', Delivery::RELOCATION, $user['uid']);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -261,7 +261,7 @@ class Conversation
|
|||
break;
|
||||
}
|
||||
|
||||
$expanded .= "\t" . '<p class="wall-item-' . $verb . '-expanded" id="' . $verb . 'list-' . $id . '" style="display: none;" >' . $explikers . EOL . '</p>';
|
||||
$expanded .= "\t" . '<p class="wall-item-' . $verb . '-expanded" id="' . $verb . 'list-' . $id . '" style="display: none;" >' . $explikers . '</p>';
|
||||
}
|
||||
|
||||
$o .= Renderer::replaceMacros(Renderer::getMarkupTemplate('voting_fakelink.tpl'), [
|
||||
|
@ -328,7 +328,7 @@ class Conversation
|
|||
$created_at = '';
|
||||
}
|
||||
|
||||
$tpl = Renderer::getMarkupTemplate("jot.tpl");
|
||||
$tpl = Renderer::getMarkupTemplate('jot.tpl');
|
||||
|
||||
$o .= Renderer::replaceMacros($tpl, [
|
||||
'$new_post' => $this->l10n->t('New Post'),
|
||||
|
@ -393,7 +393,8 @@ class Conversation
|
|||
'$message' => $this->l10n->t('Message'),
|
||||
'$browser' => $this->l10n->t('Browser'),
|
||||
|
||||
'$compose_link_title' => $this->l10n->t('Open Compose page'),
|
||||
'$compose_link_title' => $this->l10n->t('Open Compose page'),
|
||||
'$always_open_compose' => $this->pConfig->get(local_user(), 'frio', 'always_open_compose', false),
|
||||
]);
|
||||
|
||||
|
||||
|
|
|
@ -574,9 +574,10 @@ class Item
|
|||
*
|
||||
* @param string $url
|
||||
* @param integer $uid
|
||||
* @param bool $add_media
|
||||
* @return string
|
||||
*/
|
||||
public function createSharedPostByUrl(string $url, int $uid = 0): string
|
||||
public function createSharedPostByUrl(string $url, int $uid = 0, bool $add_media = false): string
|
||||
{
|
||||
if (!empty($uid)) {
|
||||
$id = ModelItem::searchByLink($url, $uid);
|
||||
|
@ -599,7 +600,7 @@ class Item
|
|||
return '';
|
||||
}
|
||||
|
||||
return $this->createSharedBlockByArray($shared_item);
|
||||
return $this->createSharedBlockByArray($shared_item, $add_media);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -607,9 +608,10 @@ class Item
|
|||
*
|
||||
* @param integer $UriId
|
||||
* @param integer $uid
|
||||
* @param bool $add_media
|
||||
* @return string
|
||||
*/
|
||||
public function createSharedPostByUriId(int $UriId, int $uid = 0): string
|
||||
public function createSharedPostByUriId(int $UriId, int $uid = 0, bool $add_media = false): string
|
||||
{
|
||||
$fields = ['uri-id', 'uri', 'body', 'title', 'author-name', 'author-link', 'author-avatar', 'guid', 'created', 'plink', 'network'];
|
||||
$shared_item = Post::selectFirst($fields, ['uri-id' => $UriId, 'uid' => [$uid, 0], 'private' => [ModelItem::PUBLIC, ModelItem::UNLISTED]]);
|
||||
|
@ -618,7 +620,7 @@ class Item
|
|||
return '';
|
||||
}
|
||||
|
||||
return $this->createSharedBlockByArray($shared_item);
|
||||
return $this->createSharedBlockByArray($shared_item, $add_media);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -626,9 +628,10 @@ class Item
|
|||
*
|
||||
* @param string $guid
|
||||
* @param integer $uid
|
||||
* @param bool $add_media
|
||||
* @return string
|
||||
*/
|
||||
public function createSharedPostByGuid(string $guid, int $uid = 0, string $host = ''): string
|
||||
public function createSharedPostByGuid(string $guid, int $uid = 0, string $host = '', bool $add_media = false): string
|
||||
{
|
||||
$fields = ['uri-id', 'uri', 'body', 'title', 'author-name', 'author-link', 'author-avatar', 'guid', 'created', 'plink', 'network'];
|
||||
$shared_item = Post::selectFirst($fields, ['guid' => $guid, 'uid' => [$uid, 0], 'private' => [ModelItem::PUBLIC, ModelItem::UNLISTED]]);
|
||||
|
@ -645,16 +648,17 @@ class Item
|
|||
return '';
|
||||
}
|
||||
|
||||
return $this->createSharedBlockByArray($shared_item);
|
||||
return $this->createSharedBlockByArray($shared_item, $add_media);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a share block for the given item array
|
||||
*
|
||||
* @param array $item
|
||||
* @param bool $add_media
|
||||
* @return string
|
||||
*/
|
||||
public function createSharedBlockByArray(array $item): string
|
||||
public function createSharedBlockByArray(array $item, bool $add_media = false): string
|
||||
{
|
||||
if ($item['network'] == Protocol::FEED) {
|
||||
return PageInfo::getFooterFromUrl($item['plink']);
|
||||
|
@ -662,6 +666,8 @@ class Item
|
|||
$item['guid'] = '';
|
||||
$item['uri'] = '';
|
||||
$item['body'] = Post\Media::addAttachmentsToBody($item['uri-id'], $item['body']);
|
||||
} elseif ($add_media) {
|
||||
$item['body'] = Post\Media::addAttachmentsToBody($item['uri-id'], $item['body']);
|
||||
}
|
||||
|
||||
$shared_content = BBCode::getShareOpeningTag($item['author-name'], $item['author-link'], $item['author-avatar'], $item['plink'], $item['created'], $item['guid'], $item['uri']);
|
||||
|
@ -674,7 +680,7 @@ class Item
|
|||
|
||||
// If it is a reshared post then reformat it to avoid display problems with two share elements
|
||||
if (Diaspora::isReshare($item['body'], false)) {
|
||||
if (!empty($shared['guid']) && ($encaspulated_share = self::createSharedPostByGuid($shared['guid']))) {
|
||||
if (!empty($shared['guid']) && ($encaspulated_share = self::createSharedPostByGuid($shared['guid'], 0, '', $add_media))) {
|
||||
$item['body'] = preg_replace("/\[share.*?\](.*)\[\/share\]/ism", $encaspulated_share, $item['body']);
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ use Friendica\DI;
|
|||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Module\Conversation\Community;
|
||||
|
||||
class Nav
|
||||
{
|
||||
|
@ -251,8 +252,8 @@ class Nav
|
|||
}
|
||||
}
|
||||
|
||||
if ((local_user() || DI::config()->get('system', 'community_page_style') != CP_NO_COMMUNITY_PAGE) &&
|
||||
!(DI::config()->get('system', 'community_page_style') == CP_NO_INTERNAL_COMMUNITY)) {
|
||||
if ((local_user() || DI::config()->get('system', 'community_page_style') != Community::DISABLED_VISITOR) &&
|
||||
!(DI::config()->get('system', 'community_page_style') == Community::DISABLED)) {
|
||||
$nav['community'] = ['community', DI::l10n()->t('Community'), '', DI::l10n()->t('Conversations on this and other servers')];
|
||||
}
|
||||
|
||||
|
|
|
@ -1069,6 +1069,38 @@ class BBCode
|
|||
return $attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace the share block with a link
|
||||
*
|
||||
* @param string $body
|
||||
* @return string
|
||||
*/
|
||||
public static function replaceSharedData(string $body): string
|
||||
{
|
||||
return BBCode::convertShare(
|
||||
$body,
|
||||
function (array $attributes) {
|
||||
return '♲ ' . $attributes['link'];
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the share block
|
||||
*
|
||||
* @param string $body
|
||||
* @return string
|
||||
*/
|
||||
public static function removeSharedData(string $body): string
|
||||
{
|
||||
return BBCode::convertShare(
|
||||
$body,
|
||||
function (array $attributes) {
|
||||
return '';
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function converts a [share] block to text according to a provided callback function whose signature is:
|
||||
*
|
||||
|
@ -1118,7 +1150,7 @@ class BBCode
|
|||
);
|
||||
|
||||
DI::profiler()->stopRecording();
|
||||
return $return;
|
||||
return trim($return);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -23,6 +23,7 @@ namespace Friendica\Core;
|
|||
|
||||
use Dice\Dice;
|
||||
use Friendica;
|
||||
use Friendica\App;
|
||||
|
||||
/**
|
||||
* Description of Console
|
||||
|
@ -133,7 +134,7 @@ HELP;
|
|||
$command = null;
|
||||
|
||||
if ($this->getOption('version')) {
|
||||
$this->out('Friendica Console version ' . FRIENDICA_VERSION);
|
||||
$this->out('Friendica Console version ' . App::VERSION);
|
||||
|
||||
return 0;
|
||||
} elseif ((count($this->options) === 0 || $this->getOption($this->customHelpOptions) === true || $this->getOption($this->customHelpOptions) === 1) && count($this->args) === 0
|
||||
|
|
|
@ -197,7 +197,7 @@ class Installer
|
|||
$result = DBStructure::install();
|
||||
|
||||
if ($result) {
|
||||
$txt = DI::l10n()->t('You may need to import the file "database.sql" manually using phpmyadmin or mysql.') . EOL;
|
||||
$txt = DI::l10n()->t('You may need to import the file "database.sql" manually using phpmyadmin or mysql.') . '<br />';
|
||||
$txt .= DI::l10n()->t('Please see the file "doc/INSTALL.md".');
|
||||
|
||||
$this->addCheck($txt, false, true, htmlentities($result, ENT_COMPAT, 'UTF-8'));
|
||||
|
@ -259,9 +259,9 @@ class Installer
|
|||
|
||||
$help = "";
|
||||
if (!$passed) {
|
||||
$help .= DI::l10n()->t('Could not find a command line version of PHP in the web server PATH.') . EOL;
|
||||
$help .= DI::l10n()->t("If you don't have a command line version of PHP installed on your server, you will not be able to run the background processing. See <a href='https://github.com/friendica/friendica/blob/stable/doc/Install.md#set-up-the-worker'>'Setup the worker'</a>") . EOL;
|
||||
$help .= EOL . EOL;
|
||||
$help .= DI::l10n()->t('Could not find a command line version of PHP in the web server PATH.') . '<br />';
|
||||
$help .= DI::l10n()->t("If you don't have a command line version of PHP installed on your server, you will not be able to run the background processing. See <a href='https://github.com/friendica/friendica/blob/stable/doc/Install.md#set-up-the-worker'>'Setup the worker'</a>") . '<br />';
|
||||
$help .= '<br /><br />';
|
||||
$tpl = Renderer::getMarkupTemplate('field_input.tpl');
|
||||
/// @todo Separate backend Installer class and presentation layer/view
|
||||
$help .= Renderer::replaceMacros($tpl, [
|
||||
|
@ -279,7 +279,7 @@ class Installer
|
|||
[$result] = explode("\n", $result);
|
||||
$help = "";
|
||||
if (!$passed2) {
|
||||
$help .= DI::l10n()->t("PHP executable is not the php cli binary \x28could be cgi-fgci version\x29") . EOL;
|
||||
$help .= DI::l10n()->t("PHP executable is not the php cli binary \x28could be cgi-fgci version\x29") . '<br />';
|
||||
$help .= DI::l10n()->t('Found PHP version: ') . "<tt>$result</tt>";
|
||||
}
|
||||
$this->addCheck(DI::l10n()->t('PHP cli binary'), $passed2, true, $help);
|
||||
|
@ -295,7 +295,7 @@ class Installer
|
|||
$passed3 = $result == $str;
|
||||
$help = "";
|
||||
if (!$passed3) {
|
||||
$help .= DI::l10n()->t('The command line version of PHP on your system does not have "register_argc_argv" enabled.') . EOL;
|
||||
$help .= DI::l10n()->t('The command line version of PHP on your system does not have "register_argc_argv" enabled.') . '<br />';
|
||||
$help .= DI::l10n()->t('This is required for message delivery to work.');
|
||||
} else {
|
||||
$this->phppath = $phppath;
|
||||
|
@ -333,7 +333,7 @@ class Installer
|
|||
|
||||
// Get private key
|
||||
if (!$res) {
|
||||
$help .= DI::l10n()->t('Error: the "openssl_pkey_new" function on this system is not able to generate encryption keys') . EOL;
|
||||
$help .= DI::l10n()->t('Error: the "openssl_pkey_new" function on this system is not able to generate encryption keys') . '<br />';
|
||||
$help .= DI::l10n()->t('If running under Windows, please see "http://www.php.net/manual/en/openssl.installation.php".');
|
||||
$status = false;
|
||||
}
|
||||
|
@ -511,10 +511,10 @@ class Installer
|
|||
(!file_exists('config/local.config.php') && !is_writable('.'))) {
|
||||
|
||||
$status = false;
|
||||
$help = DI::l10n()->t('The web installer needs to be able to create a file called "local.config.php" in the "config" folder of your web server and it is unable to do so.') . EOL;
|
||||
$help .= DI::l10n()->t('This is most often a permission setting, as the web server may not be able to write files in your folder - even if you can.') . EOL;
|
||||
$help .= DI::l10n()->t('At the end of this procedure, we will give you a text to save in a file named local.config.php in your Friendica "config" folder.') . EOL;
|
||||
$help .= DI::l10n()->t('You can alternatively skip this procedure and perform a manual installation. Please see the file "doc/INSTALL.md" for instructions.') . EOL;
|
||||
$help = DI::l10n()->t('The web installer needs to be able to create a file called "local.config.php" in the "config" folder of your web server and it is unable to do so.') . '<br />';
|
||||
$help .= DI::l10n()->t('This is most often a permission setting, as the web server may not be able to write files in your folder - even if you can.') . '<br />';
|
||||
$help .= DI::l10n()->t('At the end of this procedure, we will give you a text to save in a file named local.config.php in your Friendica "config" folder.') . '<br />';
|
||||
$help .= DI::l10n()->t('You can alternatively skip this procedure and perform a manual installation. Please see the file "doc/INSTALL.md" for instructions.') . '<br />';
|
||||
}
|
||||
|
||||
$this->addCheck(DI::l10n()->t('config/local.config.php is writable'), $status, false, $help);
|
||||
|
@ -537,10 +537,10 @@ class Installer
|
|||
if (!is_writable('view/smarty3')) {
|
||||
|
||||
$status = false;
|
||||
$help = DI::l10n()->t('Friendica uses the Smarty3 template engine to render its web views. Smarty3 compiles templates to PHP to speed up rendering.') . EOL;
|
||||
$help .= DI::l10n()->t('In order to store these compiled templates, the web server needs to have write access to the directory view/smarty3/ under the Friendica top level folder.') . EOL;
|
||||
$help .= DI::l10n()->t("Please ensure that the user that your web server runs as \x28e.g. www-data\x29 has write access to this folder.") . EOL;
|
||||
$help .= DI::l10n()->t("Note: as a security measure, you should give the web server write access to view/smarty3/ only--not the template files \x28.tpl\x29 that it contains.") . EOL;
|
||||
$help = DI::l10n()->t('Friendica uses the Smarty3 template engine to render its web views. Smarty3 compiles templates to PHP to speed up rendering.') . '<br />';
|
||||
$help .= DI::l10n()->t('In order to store these compiled templates, the web server needs to have write access to the directory view/smarty3/ under the Friendica top level folder.') . '<br />';
|
||||
$help .= DI::l10n()->t("Please ensure that the user that your web server runs as \x28e.g. www-data\x29 has write access to this folder.") . '<br />';
|
||||
$help .= DI::l10n()->t("Note: as a security measure, you should give the web server write access to view/smarty3/ only--not the template files \x28.tpl\x29 that it contains.") . '<br />';
|
||||
}
|
||||
|
||||
$this->addCheck(DI::l10n()->t('view/smarty3 is writable'), $status, true, $help);
|
||||
|
@ -571,7 +571,7 @@ class Installer
|
|||
|
||||
if ($fetchResult->getReturnCode() != 204) {
|
||||
$status = false;
|
||||
$help = DI::l10n()->t('Url rewrite in .htaccess seems not working. Make sure you copied .htaccess-dist to .htaccess.') . EOL;
|
||||
$help = DI::l10n()->t('Url rewrite in .htaccess seems not working. Make sure you copied .htaccess-dist to .htaccess.') . '<br />';
|
||||
$help .= DI::l10n()->t('In some circumstances (like running inside containers), you can skip this error.');
|
||||
$error_msg = [];
|
||||
$error_msg['head'] = DI::l10n()->t('Error message from Curl when fetching');
|
||||
|
|
|
@ -22,19 +22,16 @@
|
|||
namespace Friendica\Core\Logger\Factory;
|
||||
|
||||
use Friendica\Core\Config\Capability\IManageConfigValues;
|
||||
use Friendica\Core\Logger\Exception\LoggerException;
|
||||
use Friendica\Core;
|
||||
use Friendica\Core\Logger\Exception\LogLevelException;
|
||||
use Friendica\Database\Database;
|
||||
use Friendica\Network\HTTPException\InternalServerErrorException;
|
||||
use Friendica\Util\FileSystem;
|
||||
use Friendica\Core\Logger\Util\Introspection;
|
||||
use Friendica\Core\Logger\Type\Monolog\DevelopHandler;
|
||||
use Friendica\Core\Logger\Type\Monolog\IntrospectionProcessor;
|
||||
use Friendica\Core\Logger\Type\ProfilerLogger;
|
||||
use Friendica\Core\Logger\Type\StreamLogger;
|
||||
use Friendica\Core\Logger\Type\SyslogLogger;
|
||||
use Friendica\Util\Profiler;
|
||||
use Monolog;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Psr\Log\LogLevel;
|
||||
use Psr\Log\NullLogger;
|
||||
|
@ -60,9 +57,15 @@ class Logger
|
|||
/** @var string The log-channel (app, worker, ...) */
|
||||
private $channel;
|
||||
|
||||
public function __construct(string $channel)
|
||||
public function __construct(string $channel, bool $includeAddon = true)
|
||||
{
|
||||
$this->channel = $channel;
|
||||
|
||||
/// @fixme clean solution = Making Addon & Hook dynamic and load them inside the constructor, so there's no custom load logic necessary anymore
|
||||
if ($includeAddon) {
|
||||
Core\Addon::loadAddons();
|
||||
Core\Hook::loadHooks();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -88,35 +91,9 @@ class Logger
|
|||
$minLevel = $minLevel ?? $config->get('system', 'loglevel');
|
||||
$loglevel = self::mapLegacyConfigDebugLevel((string)$minLevel);
|
||||
|
||||
switch ($config->get('system', 'logger_config', 'stream')) {
|
||||
case 'monolog':
|
||||
$loggerTimeZone = new \DateTimeZone('UTC');
|
||||
Monolog\Logger::setTimezone($loggerTimeZone);
|
||||
|
||||
$logger = new Monolog\Logger($this->channel);
|
||||
$logger->pushProcessor(new Monolog\Processor\PsrLogMessageProcessor());
|
||||
$logger->pushProcessor(new Monolog\Processor\ProcessIdProcessor());
|
||||
$logger->pushProcessor(new Monolog\Processor\UidProcessor());
|
||||
$logger->pushProcessor(new IntrospectionProcessor($introspection, LogLevel::DEBUG));
|
||||
|
||||
$stream = $config->get('system', 'logfile');
|
||||
|
||||
// just add a stream in case it's either writable or not file
|
||||
if (!is_file($stream) || is_writable($stream)) {
|
||||
try {
|
||||
static::addStreamHandler($logger, $stream, $loglevel);
|
||||
} catch (\Throwable $e) {
|
||||
// No Logger ..
|
||||
try {
|
||||
$logger = new SyslogLogger($this->channel, $introspection, $loglevel);
|
||||
} catch (\Throwable $e) {
|
||||
// No logger ...
|
||||
$logger = new NullLogger();
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
$name = $config->get('system', 'logger_config', 'stream');
|
||||
|
||||
switch ($name) {
|
||||
case 'syslog':
|
||||
try {
|
||||
$logger = new SyslogLogger($this->channel, $introspection, $loglevel, $config->get('system', 'syslog_flags', SyslogLogger::DEFAULT_FLAGS), $config->get('system', 'syslog_facility', SyslogLogger::DEFAULT_FACILITY));
|
||||
|
@ -132,29 +109,48 @@ class Logger
|
|||
|
||||
case 'stream':
|
||||
default:
|
||||
$stream = $config->get('system', 'logfile');
|
||||
// just add a stream in case it's either writable or not file
|
||||
if (!is_file($stream) || is_writable($stream)) {
|
||||
try {
|
||||
$logger = new StreamLogger($this->channel, $stream, $introspection, $fileSystem, $loglevel);
|
||||
} catch (LogLevelException $exception) {
|
||||
// If there's a wrong config value for loglevel, try again with standard
|
||||
$logger = $this->create($database, $config, $profiler, $fileSystem, LogLevel::NOTICE);
|
||||
$logger->warning('Invalid loglevel set in config.', ['loglevel' => $loglevel]);
|
||||
} catch (\Throwable $t) {
|
||||
// No logger ...
|
||||
$logger = new NullLogger();
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
$logger = new SyslogLogger($this->channel, $introspection, $loglevel);
|
||||
} catch (LogLevelException $exception) {
|
||||
// If there's a wrong config value for loglevel, try again with standard
|
||||
$logger = $this->create($database, $config, $profiler, $fileSystem, LogLevel::NOTICE);
|
||||
$logger->warning('Invalid loglevel set in config.', ['loglevel' => $loglevel]);
|
||||
} catch (\Throwable $e) {
|
||||
// No logger ...
|
||||
$logger = new NullLogger();
|
||||
$data = [
|
||||
'name' => $name,
|
||||
'channel' => $this->channel,
|
||||
'introspection' => $introspection,
|
||||
'loglevel' => $loglevel,
|
||||
'logger' => null,
|
||||
];
|
||||
try {
|
||||
Core\Hook::callAll('logger_instance', $data);
|
||||
} catch (InternalServerErrorException $exception) {
|
||||
$data['logger'] = null;
|
||||
}
|
||||
|
||||
if (($data['logger'] ?? null) instanceof LoggerInterface) {
|
||||
$logger = $data['logger'];
|
||||
}
|
||||
|
||||
if (empty($logger)) {
|
||||
$stream = $config->get('system', 'logfile');
|
||||
// just add a stream in case it's either writable or not file
|
||||
if (!is_file($stream) || is_writable($stream)) {
|
||||
try {
|
||||
$logger = new StreamLogger($this->channel, $stream, $introspection, $fileSystem, $loglevel);
|
||||
} catch (LogLevelException $exception) {
|
||||
// If there's a wrong config value for loglevel, try again with standard
|
||||
$logger = $this->create($database, $config, $profiler, $fileSystem, LogLevel::NOTICE);
|
||||
$logger->warning('Invalid loglevel set in config.', ['loglevel' => $loglevel]);
|
||||
} catch (\Throwable $t) {
|
||||
// No logger ...
|
||||
$logger = new NullLogger();
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
$logger = new SyslogLogger($this->channel, $introspection, $loglevel);
|
||||
} catch (LogLevelException $exception) {
|
||||
// If there's a wrong config value for loglevel, try again with standard
|
||||
$logger = $this->create($database, $config, $profiler, $fileSystem, LogLevel::NOTICE);
|
||||
$logger->warning('Invalid loglevel set in config.', ['loglevel' => $loglevel]);
|
||||
} catch (\Throwable $e) {
|
||||
// No logger ...
|
||||
$logger = new NullLogger();
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -197,27 +193,11 @@ class Logger
|
|||
return new NullLogger();
|
||||
}
|
||||
|
||||
$loggerTimeZone = new \DateTimeZone('UTC');
|
||||
Monolog\Logger::setTimezone($loggerTimeZone);
|
||||
|
||||
$introspection = new Introspection(self::$ignoreClassList);
|
||||
|
||||
switch ($config->get('system', 'logger_config', 'stream')) {
|
||||
$name = $config->get('system', 'logger_config', 'stream');
|
||||
|
||||
case 'monolog':
|
||||
$loggerTimeZone = new \DateTimeZone('UTC');
|
||||
Monolog\Logger::setTimezone($loggerTimeZone);
|
||||
|
||||
$logger = new Monolog\Logger(self::DEV_CHANNEL);
|
||||
$logger->pushProcessor(new Monolog\Processor\PsrLogMessageProcessor());
|
||||
$logger->pushProcessor(new Monolog\Processor\ProcessIdProcessor());
|
||||
$logger->pushProcessor(new Monolog\Processor\UidProcessor());
|
||||
$logger->pushProcessor(new IntrospectionProcessor($introspection, LogLevel::DEBUG));
|
||||
|
||||
$logger->pushHandler(new DevelopHandler($developerIp));
|
||||
|
||||
static::addStreamHandler($logger, $stream, LogLevel::DEBUG);
|
||||
break;
|
||||
switch ($name) {
|
||||
|
||||
case 'syslog':
|
||||
$logger = new SyslogLogger(self::DEV_CHANNEL, $introspection, LogLevel::DEBUG);
|
||||
|
@ -225,6 +205,23 @@ class Logger
|
|||
|
||||
case 'stream':
|
||||
default:
|
||||
$data = [
|
||||
'name' => $name,
|
||||
'channel' => self::DEV_CHANNEL,
|
||||
'introspection' => $introspection,
|
||||
'loglevel' => LogLevel::DEBUG,
|
||||
'logger' => null,
|
||||
];
|
||||
try {
|
||||
Core\Hook::callAll('logger_instance', $data);
|
||||
} catch (InternalServerErrorException $exception) {
|
||||
$data['logger'] = null;
|
||||
}
|
||||
|
||||
if (($data['logger'] ?? null) instanceof LoggerInterface) {
|
||||
return $data['logger'];
|
||||
}
|
||||
|
||||
$logger = new StreamLogger(self::DEV_CHANNEL, $stream, $introspection, $fileSystem, LogLevel::DEBUG);
|
||||
break;
|
||||
}
|
||||
|
@ -273,38 +270,4 @@ class Logger
|
|||
return $level;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adding a handler to a given logger instance
|
||||
*
|
||||
* @param LoggerInterface $logger The logger instance
|
||||
* @param mixed $stream The stream which handles the logger output
|
||||
* @param string $level The level, for which this handler at least should handle logging
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws LoggerException
|
||||
*/
|
||||
public static function addStreamHandler(LoggerInterface $logger, $stream, string $level = LogLevel::NOTICE)
|
||||
{
|
||||
if ($logger instanceof Monolog\Logger) {
|
||||
$loglevel = Monolog\Logger::toMonologLevel($level);
|
||||
|
||||
// fallback to notice if an invalid loglevel is set
|
||||
if (!is_int($loglevel)) {
|
||||
$loglevel = LogLevel::NOTICE;
|
||||
}
|
||||
|
||||
try {
|
||||
$fileHandler = new Monolog\Handler\StreamHandler($stream, $loglevel);
|
||||
|
||||
$formatter = new Monolog\Formatter\LineFormatter("%datetime% %channel% [%level_name%]: %message% %context% %extra%\n");
|
||||
$fileHandler->setFormatter($formatter);
|
||||
|
||||
$logger->pushHandler($fileHandler);
|
||||
} catch (\Exception $exception) {
|
||||
throw new LoggerException('Cannot create Monolog Logger.', $exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,76 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2022, the Friendica project
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Friendica\Core\Logger\Type\Monolog;
|
||||
|
||||
use Friendica\App\Request;
|
||||
use Monolog\Handler;
|
||||
use Monolog\Logger;
|
||||
|
||||
/**
|
||||
* Simple handler for Friendica developers to use for deeper logging
|
||||
*
|
||||
* If you want to debug only interactions from your IP or the IP of a remote server for federation debug,
|
||||
* you'll use Logger::develop() for the duration of your work, and you clean it up when you're done before submitting your PR.
|
||||
*/
|
||||
class DevelopHandler extends Handler\AbstractHandler
|
||||
{
|
||||
/**
|
||||
* @var string The IP of the developer who wants to debug
|
||||
*/
|
||||
private $developerIp;
|
||||
|
||||
/**
|
||||
* @var string The IP of the current request
|
||||
*/
|
||||
private $remoteAddress;
|
||||
|
||||
/**
|
||||
* @param Request $request The current http request
|
||||
* @param string $developerIp The IP of the developer who wants to debug
|
||||
* @param int $level The minimum logging level at which this handler will be triggered
|
||||
* @param bool $bubble Whether the messages that are handled can bubble up the stack or not
|
||||
*/
|
||||
public function __construct(Request $request, $developerIp, int $level = Logger::DEBUG, bool $bubble = true)
|
||||
{
|
||||
parent::__construct($level, $bubble);
|
||||
|
||||
$this->developerIp = $developerIp;
|
||||
$this->remoteAddress = $request->getRemoteAddress();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function handle(array $record): bool
|
||||
{
|
||||
if (!$this->isHandling($record)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/// Just in case the remote IP is the same as the developer IP log the output
|
||||
if (!is_null($this->developerIp) && $this->remoteAddress != $this->developerIp) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return false === $this->bubble;
|
||||
}
|
||||
}
|
|
@ -1,62 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2022, the Friendica project
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Friendica\Core\Logger\Type\Monolog;
|
||||
|
||||
use Friendica\Core\Logger\Util\Introspection;
|
||||
use Monolog\Logger;
|
||||
use Monolog\Processor\ProcessorInterface;
|
||||
|
||||
/**
|
||||
* Injects line/file//function where the log message came from
|
||||
*/
|
||||
class IntrospectionProcessor implements ProcessorInterface
|
||||
{
|
||||
private $level;
|
||||
|
||||
private $introspection;
|
||||
|
||||
/**
|
||||
* @param Introspection $introspection Holds the Introspection of the current call
|
||||
* @param string|int $level The minimum logging level at which this Processor will be triggered
|
||||
*/
|
||||
public function __construct(Introspection $introspection, $level = Logger::DEBUG)
|
||||
{
|
||||
$this->level = Logger::toMonologLevel($level);
|
||||
$introspection->addClasses(['Monolog\\']);
|
||||
$this->introspection = $introspection;
|
||||
}
|
||||
|
||||
public function __invoke(array $record): array
|
||||
{
|
||||
// return if the level is not high enough
|
||||
if ($record['level'] < $this->level) {
|
||||
return $record;
|
||||
}
|
||||
// we should have the call source now
|
||||
$record['extra'] = array_merge(
|
||||
$record['extra'],
|
||||
$this->introspection->getRecord()
|
||||
);
|
||||
|
||||
return $record;
|
||||
}
|
||||
}
|
|
@ -5,7 +5,6 @@ This namespace contains the different implementations of a Logger.
|
|||
### Configuration guideline
|
||||
|
||||
The following settings are possible for `logger_config`:
|
||||
- `monolog`: A Logging framework with lots of additions (see [Monolog](https://github.com/Seldaek/monolog/)). There are just Friendica additions inside the Monolog directory
|
||||
- [`stream`](StreamLogger.php): A small logger for files or streams
|
||||
- [`syslog`](SyslogLogger.php): Prints the logging output into the syslog
|
||||
|
||||
|
|
|
@ -192,7 +192,7 @@ class Search
|
|||
}
|
||||
|
||||
// Add found profiles from the global directory to the local directory
|
||||
Worker::add(PRIORITY_LOW, 'SearchDirectory', $search);
|
||||
Worker::add(Worker::PRIORITY_LOW, 'SearchDirectory', $search);
|
||||
|
||||
return $resultList;
|
||||
}
|
||||
|
|
|
@ -69,6 +69,68 @@ class Session
|
|||
DI::session()->clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the user id of locally logged in user or false.
|
||||
*
|
||||
* @return int|bool user id or false
|
||||
*/
|
||||
public static function getLocalUser()
|
||||
{
|
||||
$session = DI::session();
|
||||
|
||||
if (!empty($session->get('authenticated')) && !empty($session->get('uid'))) {
|
||||
return intval($session->get('uid'));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the public contact id of logged in user or false.
|
||||
*
|
||||
* @return int|bool public contact id or false
|
||||
*/
|
||||
public static function getPublicContact()
|
||||
{
|
||||
static $public_contact_id = false;
|
||||
|
||||
$session = DI::session();
|
||||
|
||||
if (!$public_contact_id && !empty($session->get('authenticated'))) {
|
||||
if (!empty($session->get('my_address'))) {
|
||||
// Local user
|
||||
$public_contact_id = intval(Contact::getIdForURL($session->get('my_address'), 0, false));
|
||||
} elseif (!empty($session->get('visitor_home'))) {
|
||||
// Remote user
|
||||
$public_contact_id = intval(Contact::getIdForURL($session->get('visitor_home'), 0, false));
|
||||
}
|
||||
} elseif (empty($session->get('authenticated'))) {
|
||||
$public_contact_id = false;
|
||||
}
|
||||
|
||||
return $public_contact_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns public contact id of authenticated site visitor or false
|
||||
*
|
||||
* @return int|bool visitor_id or false
|
||||
*/
|
||||
public static function getRemoteUser()
|
||||
{
|
||||
$session = DI::session();
|
||||
|
||||
if (empty($session->get('authenticated'))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!empty($session->get('visitor_id'))) {
|
||||
return intval($session->get('visitor_id'));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the user contact ID of a visitor for the given user ID they are visiting
|
||||
*
|
||||
|
|
|
@ -442,10 +442,13 @@ class System
|
|||
*/
|
||||
public static function getLoadAvg(): array
|
||||
{
|
||||
$content = @file_get_contents('/proc/loadavg');
|
||||
if (empty($content)) {
|
||||
$content = shell_exec('cat /proc/loadavg');
|
||||
if (is_readable('/proc/loadavg')) {
|
||||
$content = @file_get_contents('/proc/loadavg');
|
||||
if (empty($content)) {
|
||||
$content = shell_exec('cat /proc/loadavg');
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($content) || !preg_match("#([.\d]+)\s([.\d]+)\s([.\d]+)\s(\d+)/(\d+)#", $content, $matches)) {
|
||||
$load_arr = sys_getloadavg();
|
||||
if (empty($load_arr)) {
|
||||
|
|
|
@ -35,6 +35,8 @@ class Update
|
|||
const SUCCESS = 0;
|
||||
const FAILED = 1;
|
||||
|
||||
const NEW_TABLE_STRUCTURE_VERSION = 1288;
|
||||
|
||||
/**
|
||||
* Function to check if the Database structure needs an update.
|
||||
*
|
||||
|
@ -63,7 +65,7 @@ class Update
|
|||
}
|
||||
|
||||
// We don't support upgrading from very old versions anymore
|
||||
if ($build < NEW_TABLE_STRUCTURE_VERSION) {
|
||||
if ($build < self::NEW_TABLE_STRUCTURE_VERSION) {
|
||||
$error = DI::l10n()->t('Updates from version %s are not supported. Please update at least to version 2021.01 and wait until the postupdate finished version 1383.', $build);
|
||||
if (DI::mode()->getExecutor() == Mode::INDEX) {
|
||||
die($error);
|
||||
|
@ -73,8 +75,8 @@ class Update
|
|||
}
|
||||
|
||||
// The postupdate has to completed version 1288 for the new post views to take over
|
||||
$postupdate = DI::config()->get('system', 'post_update_version', NEW_TABLE_STRUCTURE_VERSION);
|
||||
if ($postupdate < NEW_TABLE_STRUCTURE_VERSION) {
|
||||
$postupdate = DI::config()->get('system', 'post_update_version', self::NEW_TABLE_STRUCTURE_VERSION);
|
||||
if ($postupdate < self::NEW_TABLE_STRUCTURE_VERSION) {
|
||||
$error = DI::l10n()->t('Updates from postupdate version %s are not supported. Please update at least to version 2021.01 and wait until the postupdate finished version 1383.', $postupdate);
|
||||
if (DI::mode()->getExecutor() == Mode::INDEX) {
|
||||
die($error);
|
||||
|
@ -92,7 +94,7 @@ class Update
|
|||
*/
|
||||
self::run($basePath);
|
||||
} else {
|
||||
Worker::add(PRIORITY_CRITICAL, 'DBUpdate');
|
||||
Worker::add(Worker::PRIORITY_CRITICAL, 'DBUpdate');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -123,13 +123,13 @@ class UserImport
|
|||
|
||||
$account = json_decode(file_get_contents($file['tmp_name']), true);
|
||||
if ($account === null) {
|
||||
notice(DI::l10n()->t("Error decoding account file"));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t("Error decoding account file"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (empty($account['version'])) {
|
||||
notice(DI::l10n()->t("Error! No version data in file! This is not a Friendica account file?"));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t("Error! No version data in file! This is not a Friendica account file?"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -137,7 +137,7 @@ class UserImport
|
|||
// check if username matches deleted account
|
||||
if (DBA::exists('user', ['nickname' => $account['user']['nickname']])
|
||||
|| DBA::exists('userd', ['username' => $account['user']['nickname']])) {
|
||||
notice(DI::l10n()->t("User '%s' already exists on this server!", $account['user']['nickname']));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t("User '%s' already exists on this server!", $account['user']['nickname']));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -173,7 +173,7 @@ class UserImport
|
|||
$r = self::dbImportAssoc('user', $account['user']);
|
||||
if ($r === false) {
|
||||
Logger::warning("uimport:insert user : ERROR : " . DBA::errorMessage());
|
||||
notice(DI::l10n()->t("User creation error"));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t("User creation error"));
|
||||
return;
|
||||
}
|
||||
$newuid = self::lastInsertId();
|
||||
|
@ -218,7 +218,7 @@ class UserImport
|
|||
}
|
||||
}
|
||||
if ($errorcount > 0) {
|
||||
notice(DI::l10n()->tt("%d contact not imported", "%d contacts not imported", $errorcount));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->tt("%d contact not imported", "%d contacts not imported", $errorcount));
|
||||
}
|
||||
|
||||
foreach ($account['group'] as &$group) {
|
||||
|
@ -271,7 +271,7 @@ class UserImport
|
|||
|
||||
if ($r === false) {
|
||||
Logger::warning("uimport:insert profile: ERROR : " . DBA::errorMessage());
|
||||
notice(DI::l10n()->t("User profile creation error"));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t("User profile creation error"));
|
||||
DBA::delete('user', ['uid' => $newuid]);
|
||||
DBA::delete('profile_field', ['uid' => $newuid]);
|
||||
return;
|
||||
|
@ -322,9 +322,9 @@ class UserImport
|
|||
}
|
||||
|
||||
// send relocate messages
|
||||
Worker::add(PRIORITY_HIGH, 'Notifier', Delivery::RELOCATION, $newuid);
|
||||
Worker::add(Worker::PRIORITY_HIGH, 'Notifier', Delivery::RELOCATION, $newuid);
|
||||
|
||||
info(DI::l10n()->t("Done. You can now login with your username and password"));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->t("Done. You can now login with your username and password"));
|
||||
DI::baseUrl()->redirect('login');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,12 +31,20 @@ use Friendica\Util\DateTimeFormat;
|
|||
*/
|
||||
class Worker
|
||||
{
|
||||
const PRIORITY_UNDEFINED = PRIORITY_UNDEFINED;
|
||||
const PRIORITY_CRITICAL = PRIORITY_CRITICAL;
|
||||
const PRIORITY_HIGH = PRIORITY_HIGH;
|
||||
const PRIORITY_MEDIUM = PRIORITY_MEDIUM;
|
||||
const PRIORITY_LOW = PRIORITY_LOW;
|
||||
const PRIORITY_NEGLIGIBLE = PRIORITY_NEGLIGIBLE;
|
||||
/**
|
||||
* @name Priority
|
||||
*
|
||||
* Process priority for the worker
|
||||
* @{
|
||||
*/
|
||||
const PRIORITY_UNDEFINED = 0;
|
||||
const PRIORITY_CRITICAL = 10;
|
||||
const PRIORITY_HIGH = 20;
|
||||
const PRIORITY_MEDIUM = 30;
|
||||
const PRIORITY_LOW = 40;
|
||||
const PRIORITY_NEGLIGIBLE = 50;
|
||||
const PRIORITIES = [self::PRIORITY_CRITICAL, self::PRIORITY_HIGH, self::PRIORITY_MEDIUM, self::PRIORITY_LOW, self::PRIORITY_NEGLIGIBLE];
|
||||
/* @}*/
|
||||
|
||||
const STATE_STARTUP = 1; // Worker is in startup. This takes most time.
|
||||
const STATE_LONG_LOOP = 2; // Worker is processing the whole - long - loop.
|
||||
|
@ -807,7 +815,7 @@ class Worker
|
|||
$top_priority = self::highestPriority();
|
||||
$high_running = self::processWithPriorityActive($top_priority);
|
||||
|
||||
if (!$high_running && ($top_priority > PRIORITY_UNDEFINED) && ($top_priority < PRIORITY_NEGLIGIBLE)) {
|
||||
if (!$high_running && ($top_priority > self::PRIORITY_UNDEFINED) && ($top_priority < self::PRIORITY_NEGLIGIBLE)) {
|
||||
Logger::info('Jobs with a higher priority are waiting but none is executed. Open a fastlane.', ['priority' => $top_priority]);
|
||||
$queues = $active + 1;
|
||||
}
|
||||
|
@ -939,7 +947,7 @@ class Worker
|
|||
private static function nextPriority()
|
||||
{
|
||||
$waiting = [];
|
||||
$priorities = [PRIORITY_CRITICAL, PRIORITY_HIGH, PRIORITY_MEDIUM, PRIORITY_LOW, PRIORITY_NEGLIGIBLE];
|
||||
$priorities = [self::PRIORITY_CRITICAL, self::PRIORITY_HIGH, self::PRIORITY_MEDIUM, self::PRIORITY_LOW, self::PRIORITY_NEGLIGIBLE];
|
||||
foreach ($priorities as $priority) {
|
||||
$stamp = (float)microtime(true);
|
||||
if (DBA::exists('workerqueue', ["`priority` = ? AND `pid` = 0 AND NOT `done` AND `next_try` < ?", $priority, DateTimeFormat::utcNow()])) {
|
||||
|
@ -948,8 +956,8 @@ class Worker
|
|||
self::$db_duration += (microtime(true) - $stamp);
|
||||
}
|
||||
|
||||
if (!empty($waiting[PRIORITY_CRITICAL])) {
|
||||
return PRIORITY_CRITICAL;
|
||||
if (!empty($waiting[self::PRIORITY_CRITICAL])) {
|
||||
return self::PRIORITY_CRITICAL;
|
||||
}
|
||||
|
||||
$running = [];
|
||||
|
@ -1206,8 +1214,8 @@ class Worker
|
|||
* @param (integer|array) priority or parameter array, strings are deprecated and are ignored
|
||||
*
|
||||
* next args are passed as $cmd command line
|
||||
* or: Worker::add(PRIORITY_HIGH, 'Notifier', Delivery::DELETION, $drop_id);
|
||||
* or: Worker::add(array('priority' => PRIORITY_HIGH, 'dont_fork' => true), 'Delivery', $post_id);
|
||||
* or: Worker::add(Worker::PRIORITY_HIGH, 'Notifier', Delivery::DELETION, $drop_id);
|
||||
* or: Worker::add(array('priority' => Worker::PRIORITY_HIGH, 'dont_fork' => true), 'Delivery', $post_id);
|
||||
*
|
||||
* @return int '0' if worker queue entry already existed or there had been an error, otherwise the ID of the worker task
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
|
@ -1230,7 +1238,7 @@ class Worker
|
|||
return 1;
|
||||
}
|
||||
|
||||
$priority = PRIORITY_MEDIUM;
|
||||
$priority = self::PRIORITY_MEDIUM;
|
||||
// Don't fork from frontend tasks by default
|
||||
$dont_fork = DI::config()->get('system', 'worker_dont_fork', false) || !DI::mode()->isBackend();
|
||||
$created = DateTimeFormat::utcNow();
|
||||
|
@ -1266,9 +1274,9 @@ class Worker
|
|||
$found = DBA::exists('workerqueue', ['command' => $command, 'parameter' => $parameters, 'done' => false]);
|
||||
$added = 0;
|
||||
|
||||
if (!is_int($priority) || !in_array($priority, PRIORITIES)) {
|
||||
if (!is_int($priority) || !in_array($priority, self::PRIORITIES)) {
|
||||
Logger::warning('Invalid priority', ['priority' => $priority, 'command' => $command, 'callstack' => System::callstack(20)]);
|
||||
$priority = PRIORITY_MEDIUM;
|
||||
$priority = self::PRIORITY_MEDIUM;
|
||||
}
|
||||
|
||||
// Quit if there was a database error - a precaution for the update process to 3.5.3
|
||||
|
@ -1383,12 +1391,12 @@ class Worker
|
|||
$delay = (($new_retrial + 2) ** 4) + (rand(1, 30) * ($new_retrial));
|
||||
$next = DateTimeFormat::utc('now + ' . $delay . ' seconds');
|
||||
|
||||
if (($priority < PRIORITY_MEDIUM) && ($new_retrial > 3)) {
|
||||
$priority = PRIORITY_MEDIUM;
|
||||
} elseif (($priority < PRIORITY_LOW) && ($new_retrial > 6)) {
|
||||
$priority = PRIORITY_LOW;
|
||||
} elseif (($priority < PRIORITY_NEGLIGIBLE) && ($new_retrial > 8)) {
|
||||
$priority = PRIORITY_NEGLIGIBLE;
|
||||
if (($priority < self::PRIORITY_MEDIUM) && ($new_retrial > 3)) {
|
||||
$priority = self::PRIORITY_MEDIUM;
|
||||
} elseif (($priority < self::PRIORITY_LOW) && ($new_retrial > 6)) {
|
||||
$priority = self::PRIORITY_LOW;
|
||||
} elseif (($priority < self::PRIORITY_NEGLIGIBLE) && ($new_retrial > 8)) {
|
||||
$priority = self::PRIORITY_NEGLIGIBLE;
|
||||
}
|
||||
|
||||
Logger::info('Deferred task', ['id' => $id, 'retrial' => $new_retrial, 'created' => $queue['created'], 'next_execution' => $next, 'old_prio' => $queue['priority'], 'new_prio' => $priority]);
|
||||
|
|
|
@ -47,10 +47,10 @@ class Cron
|
|||
Logger::info('Add cron entries');
|
||||
|
||||
// Check for spooled items
|
||||
Worker::add(['priority' => PRIORITY_HIGH, 'force_priority' => true], 'SpoolPost');
|
||||
Worker::add(['priority' => Worker::PRIORITY_HIGH, 'force_priority' => true], 'SpoolPost');
|
||||
|
||||
// Run the cron job that calls all other jobs
|
||||
Worker::add(['priority' => PRIORITY_MEDIUM, 'force_priority' => true], 'Cron');
|
||||
Worker::add(['priority' => Worker::PRIORITY_MEDIUM, 'force_priority' => true], 'Cron');
|
||||
|
||||
// Cleaning dead processes
|
||||
self::killStaleWorkers();
|
||||
|
@ -112,12 +112,12 @@ class Cron
|
|||
// To avoid a blocking situation we reschedule the process at the beginning of the queue.
|
||||
// Additionally we are lowering the priority. (But not PRIORITY_CRITICAL)
|
||||
$new_priority = $entry['priority'];
|
||||
if ($entry['priority'] == PRIORITY_HIGH) {
|
||||
$new_priority = PRIORITY_MEDIUM;
|
||||
} elseif ($entry['priority'] == PRIORITY_MEDIUM) {
|
||||
$new_priority = PRIORITY_LOW;
|
||||
} elseif ($entry['priority'] != PRIORITY_CRITICAL) {
|
||||
$new_priority = PRIORITY_NEGLIGIBLE;
|
||||
if ($entry['priority'] == Worker::PRIORITY_HIGH) {
|
||||
$new_priority = Worker::PRIORITY_MEDIUM;
|
||||
} elseif ($entry['priority'] == Worker::PRIORITY_MEDIUM) {
|
||||
$new_priority = Worker::PRIORITY_LOW;
|
||||
} elseif ($entry['priority'] != Worker::PRIORITY_CRITICAL) {
|
||||
$new_priority = Worker::PRIORITY_NEGLIGIBLE;
|
||||
}
|
||||
DBA::update('workerqueue', ['executed' => DBA::NULL_DATETIME, 'created' => DateTimeFormat::utcNow(), 'priority' => $new_priority, 'pid' => 0], ['id' => $entry["id"]]
|
||||
);
|
||||
|
@ -166,13 +166,13 @@ class Cron
|
|||
Logger::info('Directly deliver inbox', ['inbox' => $delivery['inbox'], 'result' => $result['success']]);
|
||||
continue;
|
||||
} elseif ($delivery['failed'] < 3) {
|
||||
$priority = PRIORITY_HIGH;
|
||||
$priority = Worker::PRIORITY_HIGH;
|
||||
} elseif ($delivery['failed'] < 6) {
|
||||
$priority = PRIORITY_MEDIUM;
|
||||
$priority = Worker::PRIORITY_MEDIUM;
|
||||
} elseif ($delivery['failed'] < 8) {
|
||||
$priority = PRIORITY_LOW;
|
||||
$priority = Worker::PRIORITY_LOW;
|
||||
} else {
|
||||
$priority = PRIORITY_NEGLIGIBLE;
|
||||
$priority = Worker::PRIORITY_NEGLIGIBLE;
|
||||
}
|
||||
|
||||
if ($delivery['failed'] >= DI::config()->get('system', 'worker_defer_limit')) {
|
||||
|
|
|
@ -150,7 +150,7 @@ class DBStructure
|
|||
echo DI::l10n()->t("\nError %d occurred during database update:\n%s\n",
|
||||
DBA::errorNo(), DBA::errorMessage());
|
||||
|
||||
return DI::l10n()->t('Errors encountered performing database changes: ') . $message . EOL;
|
||||
return DI::l10n()->t('Errors encountered performing database changes: ') . $message . '<br />';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -36,6 +36,7 @@ use PDO;
|
|||
use PDOException;
|
||||
use PDOStatement;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Psr\Log\NullLogger;
|
||||
|
||||
/**
|
||||
* This class is for the low level database stuff that does driver specific things.
|
||||
|
@ -80,15 +81,17 @@ class Database
|
|||
/** @var ViewDefinition */
|
||||
protected $viewDefinition;
|
||||
|
||||
public function __construct(Cache $configCache, Profiler $profiler, DbaDefinition $dbaDefinition, ViewDefinition $viewDefinition, LoggerInterface $logger)
|
||||
public function __construct(Cache $configCache, Profiler $profiler, DbaDefinition $dbaDefinition, ViewDefinition $viewDefinition)
|
||||
{
|
||||
// We are storing these values for being able to perform a reconnect
|
||||
$this->configCache = $configCache;
|
||||
$this->profiler = $profiler;
|
||||
$this->logger = $logger;
|
||||
$this->dbaDefinition = $dbaDefinition;
|
||||
$this->viewDefinition = $viewDefinition;
|
||||
|
||||
// Temporary NullLogger until we can fetch the logger class from the config
|
||||
$this->logger = new NullLogger();
|
||||
|
||||
$this->connect();
|
||||
}
|
||||
|
||||
|
|
|
@ -319,7 +319,7 @@ class Contact
|
|||
|
||||
// Update the contact in the background if needed
|
||||
if (Probe::isProbable($contact['network']) && ($contact['next-update'] < DateTimeFormat::utcNow())) {
|
||||
Worker::add(['priority' => PRIORITY_LOW, 'dont_fork' => true], 'UpdateContact', $contact['id']);
|
||||
Worker::add(['priority' => Worker::PRIORITY_LOW, 'dont_fork' => true], 'UpdateContact', $contact['id']);
|
||||
}
|
||||
|
||||
// Remove the internal fields
|
||||
|
@ -884,7 +884,7 @@ class Contact
|
|||
}
|
||||
|
||||
// Delete it in the background
|
||||
Worker::add(PRIORITY_MEDIUM, 'Contact\Remove', $id);
|
||||
Worker::add(Worker::PRIORITY_MEDIUM, 'Contact\Remove', $id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -908,7 +908,7 @@ class Contact
|
|||
if (in_array($contact['rel'], [self::SHARING, self::FRIEND])) {
|
||||
$cdata = self::getPublicAndUserContactID($contact['id'], $contact['uid']);
|
||||
if (!empty($cdata['public'])) {
|
||||
Worker::add(PRIORITY_HIGH, 'Contact\Unfollow', $cdata['public'], $contact['uid']);
|
||||
Worker::add(Worker::PRIORITY_HIGH, 'Contact\Unfollow', $cdata['public'], $contact['uid']);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -938,7 +938,7 @@ class Contact
|
|||
if (in_array($contact['rel'], [self::FOLLOWER, self::FRIEND])) {
|
||||
$cdata = self::getPublicAndUserContactID($contact['id'], $contact['uid']);
|
||||
if (!empty($cdata['public'])) {
|
||||
Worker::add(PRIORITY_HIGH, 'Contact\RevokeFollow', $cdata['public'], $contact['uid']);
|
||||
Worker::add(Worker::PRIORITY_HIGH, 'Contact\RevokeFollow', $cdata['public'], $contact['uid']);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -966,11 +966,11 @@ class Contact
|
|||
$cdata = self::getPublicAndUserContactID($contact['id'], $contact['uid']);
|
||||
|
||||
if (in_array($contact['rel'], [self::SHARING, self::FRIEND]) && !empty($cdata['public'])) {
|
||||
Worker::add(PRIORITY_HIGH, 'Contact\Unfollow', $cdata['public'], $contact['uid']);
|
||||
Worker::add(Worker::PRIORITY_HIGH, 'Contact\Unfollow', $cdata['public'], $contact['uid']);
|
||||
}
|
||||
|
||||
if (in_array($contact['rel'], [self::FOLLOWER, self::FRIEND]) && !empty($cdata['public'])) {
|
||||
Worker::add(PRIORITY_HIGH, 'Contact\RevokeFollow', $cdata['public'], $contact['uid']);
|
||||
Worker::add(Worker::PRIORITY_HIGH, 'Contact\RevokeFollow', $cdata['public'], $contact['uid']);
|
||||
}
|
||||
|
||||
self::remove($contact['id']);
|
||||
|
@ -1248,7 +1248,7 @@ class Contact
|
|||
$contact_id = $contact['id'];
|
||||
|
||||
if (Probe::isProbable($contact['network']) && ($contact['next-update'] < DateTimeFormat::utcNow())) {
|
||||
Worker::add(['priority' => PRIORITY_LOW, 'dont_fork' => true], 'UpdateContact', $contact['id']);
|
||||
Worker::add(['priority' => Worker::PRIORITY_LOW, 'dont_fork' => true], 'UpdateContact', $contact['id']);
|
||||
}
|
||||
|
||||
if (empty($update) && (!empty($contact['uri-id']) || is_bool($update))) {
|
||||
|
@ -2365,7 +2365,7 @@ class Contact
|
|||
return;
|
||||
}
|
||||
Logger::warning('account-user exists for a different contact id', ['account_user' => $account_user, 'id' => $id, 'uid' => $uid, 'uri-id' => $uri_id, 'url' => $url]);
|
||||
Worker::add(PRIORITY_HIGH, 'MergeContact', $account_user['id'], $id, $uid);
|
||||
Worker::add(Worker::PRIORITY_HIGH, 'MergeContact', $account_user['id'], $id, $uid);
|
||||
} elseif (DBA::insert('account-user', ['id' => $id, 'uri-id' => $uri_id, 'uid' => $uid], Database::INSERT_IGNORE)) {
|
||||
Logger::notice('account-user was added', ['id' => $id, 'uid' => $uid, 'uri-id' => $uri_id, 'url' => $url]);
|
||||
} else {
|
||||
|
@ -2406,7 +2406,7 @@ class Contact
|
|||
continue;
|
||||
}
|
||||
|
||||
Worker::add(PRIORITY_HIGH, 'MergeContact', $first, $duplicate['id'], $uid);
|
||||
Worker::add(Worker::PRIORITY_HIGH, 'MergeContact', $first, $duplicate['id'], $uid);
|
||||
}
|
||||
DBA::close($duplicates);
|
||||
Logger::info('Duplicates handled', ['uid' => $uid, 'nurl' => $nurl, 'callstack' => System::callstack(20)]);
|
||||
|
@ -2608,7 +2608,7 @@ class Contact
|
|||
if ($ret['network'] == Protocol::ACTIVITYPUB) {
|
||||
$apcontact = APContact::getByURL($ret['url'], false);
|
||||
if (!empty($apcontact['featured'])) {
|
||||
Worker::add(PRIORITY_LOW, 'FetchFeaturedPosts', $ret['url']);
|
||||
Worker::add(Worker::PRIORITY_LOW, 'FetchFeaturedPosts', $ret['url']);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2649,7 +2649,7 @@ class Contact
|
|||
self::updateContact($id, $uid, $uriid, $contact['url'], ['failed' => false, 'local-data' => $has_local_data, 'last-update' => $updated, 'next-update' => $success_next_update, 'success_update' => $updated]);
|
||||
|
||||
if (Contact\Relation::isDiscoverable($ret['url'])) {
|
||||
Worker::add(PRIORITY_LOW, 'ContactDiscovery', $ret['url']);
|
||||
Worker::add(Worker::PRIORITY_LOW, 'ContactDiscovery', $ret['url']);
|
||||
}
|
||||
|
||||
// Update the public contact
|
||||
|
@ -2693,7 +2693,7 @@ class Contact
|
|||
self::updateContact($id, $uid, $ret['uri-id'], $ret['url'], $ret);
|
||||
|
||||
if (Contact\Relation::isDiscoverable($ret['url'])) {
|
||||
Worker::add(PRIORITY_LOW, 'ContactDiscovery', $ret['url']);
|
||||
Worker::add(Worker::PRIORITY_LOW, 'ContactDiscovery', $ret['url']);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -2853,30 +2853,30 @@ class Contact
|
|||
|
||||
// do we have enough information?
|
||||
if (empty($protocol) || ($protocol == Protocol::PHANTOM) || (empty($ret['url']) && empty($ret['addr']))) {
|
||||
$result['message'] .= DI::l10n()->t('The profile address specified does not provide adequate information.') . EOL;
|
||||
$result['message'] .= DI::l10n()->t('The profile address specified does not provide adequate information.') . '<br />';
|
||||
if (empty($ret['poll'])) {
|
||||
$result['message'] .= DI::l10n()->t('No compatible communication protocols or feeds were discovered.') . EOL;
|
||||
$result['message'] .= DI::l10n()->t('No compatible communication protocols or feeds were discovered.') . '<br />';
|
||||
}
|
||||
if (empty($ret['name'])) {
|
||||
$result['message'] .= DI::l10n()->t('An author or name was not found.') . EOL;
|
||||
$result['message'] .= DI::l10n()->t('An author or name was not found.') . '<br />';
|
||||
}
|
||||
if (empty($ret['url'])) {
|
||||
$result['message'] .= DI::l10n()->t('No browser URL could be matched to this address.') . EOL;
|
||||
$result['message'] .= DI::l10n()->t('No browser URL could be matched to this address.') . '<br />';
|
||||
}
|
||||
if (strpos($ret['url'], '@') !== false) {
|
||||
$result['message'] .= DI::l10n()->t('Unable to match @-style Identity Address with a known protocol or email contact.') . EOL;
|
||||
$result['message'] .= DI::l10n()->t('Use mailto: in front of address to force email check.') . EOL;
|
||||
$result['message'] .= DI::l10n()->t('Unable to match @-style Identity Address with a known protocol or email contact.') . '<br />';
|
||||
$result['message'] .= DI::l10n()->t('Use mailto: in front of address to force email check.') . '<br />';
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
if ($protocol === Protocol::OSTATUS && DI::config()->get('system', 'ostatus_disabled')) {
|
||||
$result['message'] .= DI::l10n()->t('The profile address specified belongs to a network which has been disabled on this site.') . EOL;
|
||||
$result['message'] .= DI::l10n()->t('The profile address specified belongs to a network which has been disabled on this site.') . '<br />';
|
||||
$ret['notify'] = '';
|
||||
}
|
||||
|
||||
if (!$ret['notify']) {
|
||||
$result['message'] .= DI::l10n()->t('Limited profile. This person will be unable to receive direct/personal notifications from you.') . EOL;
|
||||
$result['message'] .= DI::l10n()->t('Limited profile. This person will be unable to receive direct/personal notifications from you.') . '<br />';
|
||||
}
|
||||
|
||||
$writeable = ((($protocol === Protocol::OSTATUS) && ($ret['notify'])) ? 1 : 0);
|
||||
|
@ -2935,7 +2935,7 @@ class Contact
|
|||
|
||||
$contact = DBA::selectFirst('contact', [], ['url' => $ret['url'], 'network' => $ret['network'], 'uid' => $uid]);
|
||||
if (!DBA::isResult($contact)) {
|
||||
$result['message'] .= DI::l10n()->t('Unable to retrieve contact information.') . EOL;
|
||||
$result['message'] .= DI::l10n()->t('Unable to retrieve contact information.') . '<br />';
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
@ -2949,13 +2949,13 @@ class Contact
|
|||
|
||||
// pull feed and consume it, which should subscribe to the hub.
|
||||
if ($contact['network'] == Protocol::OSTATUS) {
|
||||
Worker::add(PRIORITY_HIGH, 'OnePoll', $contact_id, 'force');
|
||||
Worker::add(Worker::PRIORITY_HIGH, 'OnePoll', $contact_id, 'force');
|
||||
}
|
||||
|
||||
if ($probed) {
|
||||
self::updateFromProbeArray($contact_id, $ret);
|
||||
} else {
|
||||
Worker::add(PRIORITY_HIGH, 'UpdateContact', $contact_id);
|
||||
Worker::add(Worker::PRIORITY_HIGH, 'UpdateContact', $contact_id);
|
||||
}
|
||||
|
||||
$result['success'] = Protocol::follow($uid, $contact, $protocol);
|
||||
|
@ -3407,10 +3407,10 @@ class Contact
|
|||
}
|
||||
$contact = self::getByURL($url, false, ['id', 'network', 'next-update']);
|
||||
if (empty($contact['id']) && Network::isValidHttpUrl($url)) {
|
||||
Worker::add(PRIORITY_LOW, 'AddContact', 0, $url);
|
||||
Worker::add(Worker::PRIORITY_LOW, 'AddContact', 0, $url);
|
||||
++$added;
|
||||
} elseif (!empty($contact['network']) && Probe::isProbable($contact['network']) && ($contact['next-update'] < DateTimeFormat::utcNow())) {
|
||||
Worker::add(['priority' => PRIORITY_LOW, 'dont_fork' => true], 'UpdateContact', $contact['id']);
|
||||
Worker::add(['priority' => Worker::PRIORITY_LOW, 'dont_fork' => true], 'UpdateContact', $contact['id']);
|
||||
++$updated;
|
||||
} else {
|
||||
++$unchanged;
|
||||
|
|
|
@ -59,7 +59,7 @@ class FContact
|
|||
$update = empty($person['guid']) || empty($person['uri-id']) || ($person['created'] <= DBA::NULL_DATETIME);
|
||||
if (GServer::getNextUpdateDate(true, $person['created'], $person['updated'], false) < DateTimeFormat::utcNow()) {
|
||||
Logger::debug('Start background update', ['handle' => $handle]);
|
||||
Worker::add(['priority' => PRIORITY_LOW, 'dont_fork' => true], 'UpdateFContact', $handle);
|
||||
Worker::add(['priority' => Worker::PRIORITY_LOW, 'dont_fork' => true], 'UpdateFContact', $handle);
|
||||
}
|
||||
}
|
||||
} elseif (is_null($update)) {
|
||||
|
|
|
@ -102,7 +102,7 @@ class GServer
|
|||
return;
|
||||
}
|
||||
|
||||
Worker::add(PRIORITY_LOW, 'UpdateGServer', $url, $only_nodeinfo);
|
||||
Worker::add(Worker::PRIORITY_LOW, 'UpdateGServer', $url, $only_nodeinfo);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2108,10 +2108,10 @@ class GServer
|
|||
|
||||
while ($gserver = DBA::fetch($gservers)) {
|
||||
Logger::info('Update peer list', ['server' => $gserver['url'], 'id' => $gserver['id']]);
|
||||
Worker::add(PRIORITY_LOW, 'UpdateServerPeers', $gserver['url']);
|
||||
Worker::add(Worker::PRIORITY_LOW, 'UpdateServerPeers', $gserver['url']);
|
||||
|
||||
Logger::info('Update directory', ['server' => $gserver['url'], 'id' => $gserver['id']]);
|
||||
Worker::add(PRIORITY_LOW, 'UpdateServerDirectory', $gserver);
|
||||
Worker::add(Worker::PRIORITY_LOW, 'UpdateServerDirectory', $gserver);
|
||||
|
||||
$fields = ['last_poco_query' => DateTimeFormat::utcNow()];
|
||||
self::update($fields, ['nurl' => $gserver['nurl']]);
|
||||
|
|
|
@ -102,7 +102,7 @@ class Group
|
|||
$group = DBA::selectFirst('group', ['deleted'], ['id' => $gid]);
|
||||
if (DBA::isResult($group) && $group['deleted']) {
|
||||
DBA::update('group', ['deleted' => 0], ['id' => $gid]);
|
||||
notice(DI::l10n()->t('A deleted group with this name was revived. Existing item permissions <strong>may</strong> apply to this group and any future members. If this is not what you intended, please create another group with a different name.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('A deleted group with this name was revived. Existing item permissions <strong>may</strong> apply to this group and any future members. If this is not what you intended, please create another group with a different name.'));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ class Item
|
|||
'commented', 'created', 'edited', 'received', 'verb', 'object-type', 'postopts', 'plink',
|
||||
'wall', 'private', 'starred', 'origin', 'parent-origin', 'title', 'body', 'language',
|
||||
'content-warning', 'location', 'coord', 'app', 'rendered-hash', 'rendered-html', 'object',
|
||||
'allow_cid', 'allow_gid', 'deny_cid', 'deny_gid', 'mention', 'global',
|
||||
'quote-uri', 'quote-uri-id', 'allow_cid', 'allow_gid', 'deny_cid', 'deny_gid', 'mention', 'global',
|
||||
'author-id', 'author-link', 'author-name', 'author-avatar', 'author-network', 'author-updated', 'author-gsid', 'author-addr', 'author-uri-id',
|
||||
'owner-id', 'owner-link', 'owner-name', 'owner-avatar', 'owner-network', 'owner-contact-type', 'owner-updated',
|
||||
'causer-id', 'causer-link', 'causer-name', 'causer-avatar', 'causer-contact-type', 'causer-network',
|
||||
|
@ -115,7 +115,7 @@ class Item
|
|||
'allow_cid', 'allow_gid', 'deny_cid', 'deny_gid',
|
||||
'author-id', 'author-link', 'author-name', 'author-avatar', 'owner-id', 'owner-link', 'contact-uid',
|
||||
'signed_text', 'network', 'wall', 'contact-id', 'plink', 'origin',
|
||||
'thr-parent-id', 'parent-uri-id', 'postopts', 'pubmail',
|
||||
'thr-parent-id', 'parent-uri-id', 'quote-uri', 'quote-uri-id', 'postopts', 'pubmail',
|
||||
'event-created', 'event-edited', 'event-start', 'event-finish',
|
||||
'event-summary', 'event-desc', 'event-location', 'event-type',
|
||||
'event-nofinish', 'event-ignore', 'event-id'];
|
||||
|
@ -123,7 +123,7 @@ class Item
|
|||
// All fields in the item table
|
||||
const ITEM_FIELDLIST = ['id', 'uid', 'parent', 'uri', 'parent-uri', 'thr-parent',
|
||||
'guid', 'uri-id', 'parent-uri-id', 'thr-parent-id', 'conversation', 'vid',
|
||||
'contact-id', 'wall', 'gravity', 'extid', 'psid',
|
||||
'quote-uri', 'quote-uri-id', 'contact-id', 'wall', 'gravity', 'extid', 'psid',
|
||||
'created', 'edited', 'commented', 'received', 'changed', 'verb',
|
||||
'postopts', 'plink', 'resource-id', 'event-id', 'inform',
|
||||
'allow_cid', 'allow_gid', 'deny_cid', 'deny_gid', 'post-type', 'post-reason',
|
||||
|
@ -238,7 +238,7 @@ class Item
|
|||
|
||||
foreach ($notify_items as $notify_item) {
|
||||
$post = Post::selectFirst(['uri-id', 'uid'], ['id' => $notify_item]);
|
||||
Worker::add(PRIORITY_HIGH, 'Notifier', Delivery::POST, (int)$post['uri-id'], (int)$post['uid']);
|
||||
Worker::add(Worker::PRIORITY_HIGH, 'Notifier', Delivery::POST, (int)$post['uri-id'], (int)$post['uid']);
|
||||
}
|
||||
|
||||
return $rows;
|
||||
|
@ -252,7 +252,7 @@ class Item
|
|||
* @return void
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
public static function markForDeletion(array $condition, int $priority = PRIORITY_HIGH)
|
||||
public static function markForDeletion(array $condition, int $priority = Worker::PRIORITY_HIGH)
|
||||
{
|
||||
$items = Post::select(['id'], $condition);
|
||||
while ($item = Post::fetch($items)) {
|
||||
|
@ -283,7 +283,7 @@ class Item
|
|||
}
|
||||
|
||||
if ($item['uid'] == $uid) {
|
||||
self::markForDeletionById($item['id'], PRIORITY_HIGH);
|
||||
self::markForDeletionById($item['id'], Worker::PRIORITY_HIGH);
|
||||
} elseif ($item['uid'] != 0) {
|
||||
Logger::warning('Wrong ownership. Not deleting item', ['id' => $item['id']]);
|
||||
}
|
||||
|
@ -299,7 +299,7 @@ class Item
|
|||
* @return boolean success
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
public static function markForDeletionById(int $item_id, int $priority = PRIORITY_HIGH): bool
|
||||
public static function markForDeletionById(int $item_id, int $priority = Worker::PRIORITY_HIGH): bool
|
||||
{
|
||||
Logger::info('Mark item for deletion by id', ['id' => $item_id, 'callstack' => System::callstack()]);
|
||||
// locate item to be deleted
|
||||
|
@ -822,7 +822,7 @@ class Item
|
|||
{
|
||||
$orig_item = $item;
|
||||
|
||||
$priority = PRIORITY_HIGH;
|
||||
$priority = Worker::PRIORITY_HIGH;
|
||||
|
||||
// If it is a posting where users should get notifications, then define it as wall posting
|
||||
if ($notify) {
|
||||
|
@ -832,7 +832,7 @@ class Item
|
|||
$item['protocol'] = Conversation::PARCEL_DIRECT;
|
||||
$item['direction'] = Conversation::PUSH;
|
||||
|
||||
if (is_int($notify) && in_array($notify, PRIORITIES)) {
|
||||
if (is_int($notify) && in_array($notify, Worker::PRIORITIES)) {
|
||||
$priority = $notify;
|
||||
}
|
||||
} else {
|
||||
|
@ -1125,6 +1125,13 @@ class Item
|
|||
$item['raw-body'] = Post\Media::insertFromBody($item['uri-id'], $item['raw-body']);
|
||||
$item['raw-body'] = self::setHashtags($item['raw-body']);
|
||||
|
||||
$quote_id = self::getQuoteUriId($item['body']);
|
||||
|
||||
if (!empty($quote_id) && Post::exists(['uri-id' => $quote_id, 'network' => Protocol::FEDERATED])) {
|
||||
$item['quote-uri-id'] = $quote_id;
|
||||
$item['raw-body'] = BBCode::removeSharedData($item['raw-body']);
|
||||
}
|
||||
|
||||
if (!DBA::exists('contact', ['id' => $item['author-id'], 'network' => Protocol::DFRN])) {
|
||||
Post\Media::insertFromRelevantUrl($item['uri-id'], $item['raw-body']);
|
||||
}
|
||||
|
@ -2945,17 +2952,44 @@ class Item
|
|||
$body = $item['body'] ?? '';
|
||||
$shared = BBCode::fetchShareAttributes($body);
|
||||
if (!empty($shared['guid'])) {
|
||||
$shared_item = Post::selectFirst(['uri-id', 'plink', 'has-media'], ['guid' => $shared['guid']]);
|
||||
$shared_uri_id = $shared_item['uri-id'] ?? 0;
|
||||
$shared_links = [strtolower($shared_item['plink'] ?? '')];
|
||||
$shared_attachments = Post\Media::splitAttachments($shared_uri_id, $shared['guid'], [], $shared_item['has-media'] ?? false);
|
||||
$shared_item = Post::selectFirst(['uri-id', 'guid', 'plink', 'has-media'], ['guid' => $shared['guid'], 'uid' => [$item['uid'], 0]]);
|
||||
}
|
||||
|
||||
$fields = ['uri-id', 'uri', 'body', 'title', 'author-name', 'author-link', 'author-avatar', 'guid', 'created', 'plink', 'network', 'has-media'];
|
||||
|
||||
$shared_uri_id = 0;
|
||||
$shared_links = [];
|
||||
|
||||
if (empty($shared_item['uri-id']) && !empty($item['quote-uri-id'])) {
|
||||
$shared_item = Post::selectFirst($fields, ['uri-id' => $item['quote-uri-id']]);
|
||||
$quote_uri_id = $item['quote-uri-id'] ?? 0;
|
||||
$shared_links[] = strtolower($item['quote-uri']);
|
||||
} elseif (empty($shared_item['uri-id']) && empty($item['quote-uri-id'])) {
|
||||
$media = Post\Media::getByURIId($item['uri-id'], [Post\Media::ACTIVITY]);
|
||||
if (!empty($media)) {
|
||||
$shared_item = Post::selectFirst($fields, ['plink' => $media[0]['url'], 'uid' => [$item['uid'], 0]]);
|
||||
|
||||
if (empty($shared_item['uri-id'])) {
|
||||
$shared_item = Post::selectFirst($fields, ['uri' => $media[0]['url'], 'uid' => [$item['uid'], 0]]);
|
||||
$shared_links[] = strtolower($media[0]['url']);
|
||||
}
|
||||
|
||||
$quote_uri_id = $shared_item['uri-id'] ?? 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($quote_uri_id)) {
|
||||
$item['body'] .= "\n" . DI::contentItem()->createSharedBlockByArray($shared_item);
|
||||
}
|
||||
|
||||
if (!empty($shared_item['uri-id'])) {
|
||||
$shared_uri_id = $shared_item['uri-id'];
|
||||
$shared_links[] = strtolower($shared_item['plink']);
|
||||
$shared_attachments = Post\Media::splitAttachments($shared_uri_id, $shared_item['guid'], [], $shared_item['has-media']);
|
||||
$shared_links = array_merge($shared_links, array_column($shared_attachments['visual'], 'url'));
|
||||
$shared_links = array_merge($shared_links, array_column($shared_attachments['link'], 'url'));
|
||||
$shared_links = array_merge($shared_links, array_column($shared_attachments['additional'], 'url'));
|
||||
$item['body'] = self::replaceVisualAttachments($shared_attachments, $item['body']);
|
||||
} else {
|
||||
$shared_uri_id = 0;
|
||||
$shared_links = [];
|
||||
}
|
||||
|
||||
$attachments = Post\Media::splitAttachments($item['uri-id'], $item['guid'] ?? '', $shared_links, $item['has-media'] ?? false);
|
||||
|
@ -3277,7 +3311,7 @@ class Item
|
|||
}
|
||||
DI::profiler()->stopRecording();
|
||||
|
||||
if (isset($data['url']) && !in_array($data['url'], $ignore_links)) {
|
||||
if (isset($data['url']) && !in_array(strtolower($data['url']), $ignore_links)) {
|
||||
if (!empty($data['description']) || !empty($data['image']) || !empty($data['preview'])) {
|
||||
$parts = parse_url($data['url']);
|
||||
if (!empty($parts['scheme']) && !empty($parts['host'])) {
|
||||
|
@ -3611,9 +3645,10 @@ class Item
|
|||
* Improve the data in shared posts
|
||||
*
|
||||
* @param array $item
|
||||
* @param bool $add_media
|
||||
* @return string body
|
||||
*/
|
||||
public static function improveSharedDataInBody(array $item): string
|
||||
public static function improveSharedDataInBody(array $item, bool $add_media = false): string
|
||||
{
|
||||
$shared = BBCode::fetchShareAttributes($item['body']);
|
||||
if (empty($shared['guid']) && empty($shared['message_id'])) {
|
||||
|
@ -3623,7 +3658,7 @@ class Item
|
|||
$link = $shared['link'] ?: $shared['message_id'];
|
||||
|
||||
if (empty($shared_content)) {
|
||||
$shared_content = DI::contentItem()->createSharedPostByUrl($link, $item['uid'] ?? 0);
|
||||
$shared_content = DI::contentItem()->createSharedPostByUrl($link, $item['uid'] ?? 0, $add_media);
|
||||
}
|
||||
|
||||
if (empty($shared_content)) {
|
||||
|
@ -3635,4 +3670,19 @@ class Item
|
|||
Logger::debug('New shared data', ['uri-id' => $item['uri-id'], 'link' => $link, 'guid' => $item['guid']]);
|
||||
return $item['body'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch the uri-id of a quote
|
||||
*
|
||||
* @param string $body
|
||||
* @return integer
|
||||
*/
|
||||
private static function getQuoteUriId(string $body): int
|
||||
{
|
||||
$shared = BBCode::fetchShareAttributes($body);
|
||||
if (empty($shared['message_id'])) {
|
||||
return 0;
|
||||
}
|
||||
return ItemURI::getIdByURI($shared['message_id']);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -239,7 +239,7 @@ class Mail
|
|||
}
|
||||
|
||||
if ($post_id) {
|
||||
Worker::add(PRIORITY_HIGH, "Notifier", Delivery::MAIL, $post_id);
|
||||
Worker::add(Worker::PRIORITY_HIGH, "Notifier", Delivery::MAIL, $post_id);
|
||||
return intval($post_id);
|
||||
} else {
|
||||
return -3;
|
||||
|
|
|
@ -80,7 +80,7 @@ class Delayed
|
|||
|
||||
Logger::notice('Adding post for delayed publishing', ['uid' => $item['uid'], 'delayed' => $delayed, 'uri' => $uri]);
|
||||
|
||||
$wid = Worker::add(['priority' => PRIORITY_HIGH, 'delayed' => $delayed], 'DelayedPublish', $item, $notify, $taglist, $attachments, $preparation_mode, $uri);
|
||||
$wid = Worker::add(['priority' => Worker::PRIORITY_HIGH, 'delayed' => $delayed], 'DelayedPublish', $item, $notify, $taglist, $attachments, $preparation_mode, $uri);
|
||||
if (!$wid) {
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -23,10 +23,12 @@ namespace Friendica\Model\Post;
|
|||
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\Database;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Model\Photo;
|
||||
use Friendica\Model\Post;
|
||||
|
@ -56,6 +58,7 @@ class Media
|
|||
const HTML = 17;
|
||||
const XML = 18;
|
||||
const PLAIN = 19;
|
||||
const ACTIVITY = 20;
|
||||
const DOCUMENT = 128;
|
||||
|
||||
/**
|
||||
|
@ -215,6 +218,10 @@ class Media
|
|||
$media = self::addType($media);
|
||||
}
|
||||
|
||||
if (in_array($media['type'], [self::TEXT, self::APPLICATION, self::HTML, self::XML, self::PLAIN])) {
|
||||
$media = self::addActivity($media);
|
||||
}
|
||||
|
||||
if ($media['type'] == self::HTML) {
|
||||
$data = ParseUrl::getSiteinfoCached($media['url'], false);
|
||||
$media['preview'] = $data['images'][0]['src'] ?? null;
|
||||
|
@ -232,6 +239,65 @@ class Media
|
|||
return $media;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the activity type if the media entry is linked to an activity
|
||||
*
|
||||
* @param array $media
|
||||
* @return array
|
||||
*/
|
||||
private static function addActivity(array $media): array
|
||||
{
|
||||
$id = Item::fetchByLink($media['url']);
|
||||
if (empty($id)) {
|
||||
return $media;
|
||||
}
|
||||
|
||||
$item = Post::selectFirst([], ['id' => $id, 'network' => Protocol::FEDERATED]);
|
||||
if (empty($item['id'])) {
|
||||
Logger::debug('Not a federated activity', ['id' => $id, 'uri-id' => $media['uri-id'], 'url' => $media['url']]);
|
||||
return $media;
|
||||
}
|
||||
|
||||
if (!empty($item['plink']) && Strings::compareLink($item['plink'], $media['url']) &&
|
||||
parse_url($item['plink'], PHP_URL_HOST) != parse_url($item['uri'], PHP_URL_HOST)) {
|
||||
Logger::debug('Not a link to an activity', ['uri-id' => $media['uri-id'], 'url' => $media['url'], 'plink' => $item['plink'], 'uri' => $item['uri']]);
|
||||
return $media;
|
||||
}
|
||||
|
||||
if (in_array($item['network'], [Protocol::ACTIVITYPUB, Protocol::DFRN])) {
|
||||
$media['mimetype'] = 'application/activity+json';
|
||||
} elseif ($item['network'] == Protocol::DIASPORA) {
|
||||
$media['mimetype'] = 'application/xml';
|
||||
} else {
|
||||
$media['mimetype'] = '';
|
||||
}
|
||||
|
||||
$contact = Contact::getById($item['author-id'], ['avatar', 'gsid']);
|
||||
if (!empty($contact['gsid'])) {
|
||||
$gserver = DBA::selectFirst('gserver', ['url', 'site_name'], ['id' => $contact['gsid']]);
|
||||
}
|
||||
|
||||
$media['type'] = self::ACTIVITY;
|
||||
$media['media-uri-id'] = $item['uri-id'];
|
||||
$media['height'] = null;
|
||||
$media['width'] = null;
|
||||
$media['size'] = null;
|
||||
$media['preview'] = null;
|
||||
$media['preview-height'] = null;
|
||||
$media['preview-width'] = null;
|
||||
$media['description'] = $item['body'];
|
||||
$media['name'] = $item['title'];
|
||||
$media['author-url'] = $item['author-link'];
|
||||
$media['author-name'] = $item['author-name'];
|
||||
$media['author-image'] = $contact['avatar'] ?? $item['author-avatar'];
|
||||
$media['publisher-url'] = $gserver['url'] ?? null;
|
||||
$media['publisher-name'] = $gserver['site_name'] ?? null;
|
||||
$media['publisher-image'] = null;
|
||||
|
||||
Logger::debug('Activity detected', ['uri-id' => $media['uri-id'], 'url' => $media['url'], 'plink' => $item['plink'], 'uri' => $item['uri']]);
|
||||
return $media;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch media data from local resources
|
||||
* @param array $media
|
||||
|
|
|
@ -153,11 +153,11 @@ class Profile
|
|||
if ($owner['net-publish'] || $force) {
|
||||
// Update global directory in background
|
||||
if (Search::getGlobalDirectory()) {
|
||||
Worker::add(PRIORITY_LOW, 'Directory', $owner['url']);
|
||||
Worker::add(Worker::PRIORITY_LOW, 'Directory', $owner['url']);
|
||||
}
|
||||
}
|
||||
|
||||
Worker::add(PRIORITY_LOW, 'ProfileUpdate', $uid);
|
||||
Worker::add(Worker::PRIORITY_LOW, 'ProfileUpdate', $uid);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -865,7 +865,7 @@ class Profile
|
|||
|
||||
$a->setContactId($arr['visitor']['id']);
|
||||
|
||||
info(DI::l10n()->t('OpenWebAuth: %1$s welcomes %2$s', DI::baseUrl()->getHostname(), $visitor['name']));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->t('OpenWebAuth: %1$s welcomes %2$s', DI::baseUrl()->getHostname(), $visitor['name']));
|
||||
|
||||
Logger::info('OpenWebAuth: auth success from ' . $visitor['addr']);
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ class PushSubscriber
|
|||
* @return void
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
public static function publishFeed(int $uid, int $default_priority = PRIORITY_HIGH)
|
||||
public static function publishFeed(int $uid, int $default_priority = Worker::PRIORITY_HIGH)
|
||||
{
|
||||
$condition = ['push' => 0, 'uid' => $uid];
|
||||
DBA::update('push_subscriber', ['push' => 1, 'next_try' => DBA::NULL_DATETIME], $condition);
|
||||
|
@ -52,7 +52,7 @@ class PushSubscriber
|
|||
* @return void
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
public static function requeue(int $default_priority = PRIORITY_HIGH)
|
||||
public static function requeue(int $default_priority = Worker::PRIORITY_HIGH)
|
||||
{
|
||||
// We'll push to each subscriber that has push > 0,
|
||||
// i.e. there has been an update (set in notifier.php).
|
||||
|
@ -61,7 +61,7 @@ class PushSubscriber
|
|||
while ($subscriber = DBA::fetch($subscribers)) {
|
||||
// We always handle retries with low priority
|
||||
if ($subscriber['push'] > 1) {
|
||||
$priority = PRIORITY_LOW;
|
||||
$priority = Worker::PRIORITY_LOW;
|
||||
} else {
|
||||
$priority = $default_priority;
|
||||
}
|
||||
|
|
|
@ -152,7 +152,7 @@ class Subscription
|
|||
$subscriptions = DBA::select('subscription', [], ['uid' => $notification->uid, $type => true]);
|
||||
while ($subscription = DBA::fetch($subscriptions)) {
|
||||
Logger::info('Push notification', ['id' => $subscription['id'], 'uid' => $subscription['uid'], 'type' => $type]);
|
||||
Worker::add(PRIORITY_HIGH, 'PushSubscription', $subscription['id'], $notification->id);
|
||||
Worker::add(Worker::PRIORITY_HIGH, 'PushSubscription', $subscription['id'], $notification->id);
|
||||
}
|
||||
DBA::close($subscriptions);
|
||||
}
|
||||
|
|
|
@ -994,7 +994,7 @@ class User
|
|||
try {
|
||||
$authurl = $openid->authUrl();
|
||||
} catch (Exception $e) {
|
||||
throw new Exception(DI::l10n()->t('We encountered a problem while logging in with the OpenID you provided. Please check the correct spelling of the ID.') . EOL . EOL . DI::l10n()->t('The error message was:') . $e->getMessage(), 0, $e);
|
||||
throw new Exception(DI::l10n()->t('We encountered a problem while logging in with the OpenID you provided. Please check the correct spelling of the ID.') . '<br />' . DI::l10n()->t('The error message was:') . $e->getMessage(), 0, $e);
|
||||
}
|
||||
System::externalRedirect($authurl);
|
||||
// NOTREACHED
|
||||
|
@ -1317,7 +1317,7 @@ class User
|
|||
|
||||
if (DBA::isResult($profile) && $profile['net-publish'] && Search::getGlobalDirectory()) {
|
||||
$url = DI::baseUrl() . '/profile/' . $user['nickname'];
|
||||
Worker::add(PRIORITY_LOW, "Directory", $url);
|
||||
Worker::add(Worker::PRIORITY_LOW, "Directory", $url);
|
||||
}
|
||||
|
||||
$l10n = DI::l10n()->withLang($register['language']);
|
||||
|
@ -1567,14 +1567,14 @@ class User
|
|||
|
||||
// The user and related data will be deleted in Friendica\Worker\ExpireAndRemoveUsers
|
||||
DBA::update('user', ['account_removed' => true, 'account_expires_on' => DateTimeFormat::utc('now + 7 day')], ['uid' => $uid]);
|
||||
Worker::add(PRIORITY_HIGH, 'Notifier', Delivery::REMOVAL, $uid);
|
||||
Worker::add(Worker::PRIORITY_HIGH, 'Notifier', Delivery::REMOVAL, $uid);
|
||||
|
||||
// Send an update to the directory
|
||||
$self = DBA::selectFirst('contact', ['url'], ['uid' => $uid, 'self' => true]);
|
||||
Worker::add(PRIORITY_LOW, 'Directory', $self['url']);
|
||||
Worker::add(Worker::PRIORITY_LOW, 'Directory', $self['url']);
|
||||
|
||||
// Remove the user relevant data
|
||||
Worker::add(PRIORITY_NEGLIGIBLE, 'RemoveUser', $uid);
|
||||
Worker::add(Worker::PRIORITY_NEGLIGIBLE, 'RemoveUser', $uid);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ class Details extends BaseAdmin
|
|||
|
||||
$addon = Strings::sanitizeFilePathItem($this->parameters['addon']);
|
||||
if (!is_file("addon/$addon/$addon.php")) {
|
||||
notice(DI::l10n()->t('Addon not found.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Addon not found.'));
|
||||
Addon::uninstall($addon);
|
||||
DI::baseUrl()->redirect('admin/addons');
|
||||
}
|
||||
|
@ -73,10 +73,10 @@ class Details extends BaseAdmin
|
|||
// Toggle addon status
|
||||
if (Addon::isEnabled($addon)) {
|
||||
Addon::uninstall($addon);
|
||||
info(DI::l10n()->t('Addon %s disabled.', $addon));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->t('Addon %s disabled.', $addon));
|
||||
} else {
|
||||
Addon::install($addon);
|
||||
info(DI::l10n()->t('Addon %s enabled.', $addon));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->t('Addon %s enabled.', $addon));
|
||||
}
|
||||
|
||||
DI::baseUrl()->redirect('admin/addons/' . $addon);
|
||||
|
|
|
@ -39,18 +39,18 @@ class Index extends BaseAdmin
|
|||
switch ($_GET['action']) {
|
||||
case 'reload':
|
||||
Addon::reload();
|
||||
info(DI::l10n()->t('Addons reloaded'));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->t('Addons reloaded'));
|
||||
break;
|
||||
|
||||
case 'toggle' :
|
||||
$addon = $_GET['addon'] ?? '';
|
||||
if (Addon::isEnabled($addon)) {
|
||||
Addon::uninstall($addon);
|
||||
info(DI::l10n()->t('Addon %s disabled.', $addon));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->t('Addon %s disabled.', $addon));
|
||||
} elseif (Addon::install($addon)) {
|
||||
info(DI::l10n()->t('Addon %s enabled.', $addon));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->t('Addon %s enabled.', $addon));
|
||||
} else {
|
||||
notice(DI::l10n()->t('Addon %s failed to install.', $addon));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Addon %s failed to install.', $addon));
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
|
@ -46,12 +46,12 @@ class Contact extends BaseAdmin
|
|||
if (!empty($_POST['page_contactblock_block'])) {
|
||||
$contact = Model\Contact::getByURL($contact_url, null, ['id', 'nurl']);
|
||||
if (empty($contact)) {
|
||||
notice(DI::l10n()->t('Could not find any contact entry for this URL (%s)', $contact_url));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Could not find any contact entry for this URL (%s)', $contact_url));
|
||||
DI::baseUrl()->redirect('admin/blocklist/contact');
|
||||
}
|
||||
|
||||
if (Network::isLocalLink($contact['nurl'])) {
|
||||
notice(DI::l10n()->t('You can\'t block a local contact, please block the user instead'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('You can\'t block a local contact, please block the user instead'));
|
||||
DI::baseUrl()->redirect('admin/blocklist/contact');
|
||||
}
|
||||
|
||||
|
@ -59,18 +59,18 @@ class Contact extends BaseAdmin
|
|||
|
||||
if ($block_purge) {
|
||||
foreach (Model\Contact::selectToArray(['id'], ['nurl' => $contact['nurl']]) as $contact) {
|
||||
Worker::add(PRIORITY_LOW, 'Contact\RemoveContent', $contact['id']);
|
||||
Worker::add(Worker::PRIORITY_LOW, 'Contact\RemoveContent', $contact['id']);
|
||||
}
|
||||
}
|
||||
|
||||
info(DI::l10n()->t('The contact has been blocked from the node'));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->t('The contact has been blocked from the node'));
|
||||
}
|
||||
|
||||
if (!empty($_POST['page_contactblock_unblock'])) {
|
||||
foreach ($contacts as $uid) {
|
||||
Model\Contact::unblock($uid);
|
||||
}
|
||||
info(DI::l10n()->tt('%s contact unblocked', '%s contacts unblocked', count($contacts)));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->tt('%s contact unblocked', '%s contacts unblocked', count($contacts)));
|
||||
}
|
||||
|
||||
DI::baseUrl()->redirect('admin/blocklist/contact');
|
||||
|
|
|
@ -82,7 +82,7 @@ class Add extends BaseAdmin
|
|||
if (!empty($request['purge'])) {
|
||||
$gservers = GServer::listByDomainPattern($pattern);
|
||||
foreach (Contact::selectToArray(['id'], ['gsid' => array_column($gservers, 'id')]) as $contact) {
|
||||
Worker::add(PRIORITY_LOW, 'Contact\RemoveContent', $contact['id']);
|
||||
Worker::add(Worker::PRIORITY_LOW, 'Contact\RemoveContent', $contact['id']);
|
||||
}
|
||||
|
||||
$this->sysmsg->addInfo($this->l10n->tt('%s server scheduled to be purged.', '%s servers scheduled to be purged.', count($gservers)));
|
||||
|
|
|
@ -48,7 +48,7 @@ class DBSync extends BaseAdmin
|
|||
DI::config()->set('system', 'build', intval($curr) + 1);
|
||||
}
|
||||
|
||||
info(DI::l10n()->t('Update has been marked successful'));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->t('Update has been marked successful'));
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
namespace Friendica\Module\Admin;
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Database\DBA;
|
||||
|
@ -202,7 +203,7 @@ class Federation extends BaseAdmin
|
|||
'$page' => DI::l10n()->t('Federation Statistics'),
|
||||
'$intro' => $intro,
|
||||
'$counts' => $counts,
|
||||
'$version' => FRIENDICA_VERSION,
|
||||
'$version' => App::VERSION,
|
||||
'$legendtext' => DI::l10n()->tt('Currently this node is aware of %2$s node (%3$s active users last month, %4$s active users last six months, %5$s registered users in total) from the following platforms:', 'Currently this node is aware of %2$s nodes (%3$s active users last month, %4$s active users last six months, %5$s registered users in total) from the following platforms:', $total, number_format($total), number_format($month), number_format($halfyear), number_format($users)),
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ class Delete extends BaseAdmin
|
|||
Item::markForDeletion(['guid' => $guid]);
|
||||
}
|
||||
|
||||
info(DI::l10n()->t('Item marked for deletion.'));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->t('Item marked for deletion.'));
|
||||
DI::baseUrl()->redirect('admin/item/delete');
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ class Settings extends BaseAdmin
|
|||
|
||||
if (is_file($logfile) &&
|
||||
!is_writeable($logfile)) {
|
||||
notice(DI::l10n()->t('The logfile \'%s\' is not writable. No logging possible', $logfile));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('The logfile \'%s\' is not writable. No logging possible', $logfile));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
namespace Friendica\Module\Admin;
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Relocate;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Search;
|
||||
use Friendica\Core\System;
|
||||
|
@ -33,12 +32,11 @@ use Friendica\DI;
|
|||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Module\BaseAdmin;
|
||||
use Friendica\Module\Conversation\Community;
|
||||
use Friendica\Module\Register;
|
||||
use Friendica\Protocol\Relay;
|
||||
use Friendica\Util\BasePath;
|
||||
use Friendica\Util\EMailer\MailBuilder;
|
||||
use Friendica\Util\Strings;
|
||||
use Friendica\Worker\Delivery;
|
||||
|
||||
require_once __DIR__ . '/../../../boot.php';
|
||||
|
||||
|
@ -53,7 +51,7 @@ class Site extends BaseAdmin
|
|||
$a = DI::app();
|
||||
|
||||
if (!empty($_POST['republish_directory'])) {
|
||||
Worker::add(PRIORITY_LOW, 'Directory');
|
||||
Worker::add(Worker::PRIORITY_LOW, 'Directory');
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -150,7 +148,7 @@ class Site extends BaseAdmin
|
|||
// Has the directory url changed? If yes, then resubmit the existing profiles there
|
||||
if ($global_directory != DI::config()->get('system', 'directory') && ($global_directory != '')) {
|
||||
DI::config()->set('system', 'directory', $global_directory);
|
||||
Worker::add(PRIORITY_LOW, 'Directory');
|
||||
Worker::add(Worker::PRIORITY_LOW, 'Directory');
|
||||
}
|
||||
|
||||
if (DI::baseUrl()->getUrlPath() != "") {
|
||||
|
@ -364,11 +362,11 @@ class Site extends BaseAdmin
|
|||
|
||||
/* Community page style */
|
||||
$community_page_style_choices = [
|
||||
CP_NO_INTERNAL_COMMUNITY => DI::l10n()->t('No community page for local users'),
|
||||
CP_NO_COMMUNITY_PAGE => DI::l10n()->t('No community page'),
|
||||
CP_USERS_ON_SERVER => DI::l10n()->t('Public postings from users of this site'),
|
||||
CP_GLOBAL_COMMUNITY => DI::l10n()->t('Public postings from the federated network'),
|
||||
CP_USERS_AND_GLOBAL => DI::l10n()->t('Public postings from local users and the federated network')
|
||||
Community::DISABLED => DI::l10n()->t('No community page'),
|
||||
Community::DISABLED_VISITOR => DI::l10n()->t('No community page for visitors'),
|
||||
Community::LOCAL => DI::l10n()->t('Public postings from users of this site'),
|
||||
Community::GLOBAL => DI::l10n()->t('Public postings from the federated network'),
|
||||
Community::LOCAL_AND_GLOBAL => DI::l10n()->t('Public postings from local users and the federated network')
|
||||
];
|
||||
|
||||
/* get user names to make the install a personal install of X */
|
||||
|
|
|
@ -43,7 +43,7 @@ class Storage extends BaseAdmin
|
|||
/** @var ICanConfigureStorage|false $newStorageConfig */
|
||||
$newStorageConfig = DI::storageManager()->getConfigurationByName($storagebackend);
|
||||
} catch (InvalidClassStorageException $storageException) {
|
||||
notice(DI::l10n()->t('Storage backend, %s is invalid.', $storagebackend));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Storage backend, %s is invalid.', $storagebackend));
|
||||
DI::baseUrl()->redirect('admin/storage');
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ class Storage extends BaseAdmin
|
|||
$storage_form_errors = $newStorageConfig->saveOptions($storage_opts_data);
|
||||
if (count($storage_form_errors)) {
|
||||
foreach ($storage_form_errors as $name => $err) {
|
||||
notice(DI::l10n()->t('Storage backend %s error: %s', $storage_opts[$name][1], $err));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Storage backend %s error: %s', $storage_opts[$name][1], $err));
|
||||
}
|
||||
DI::baseUrl()->redirect('admin/storage');
|
||||
}
|
||||
|
@ -81,10 +81,10 @@ class Storage extends BaseAdmin
|
|||
$newstorage = DI::storageManager()->getWritableStorageByName($storagebackend);
|
||||
|
||||
if (!DI::storageManager()->setBackend($newstorage)) {
|
||||
notice(DI::l10n()->t('Invalid storage backend setting value.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Invalid storage backend setting value.'));
|
||||
}
|
||||
} catch (InvalidClassStorageException $storageException) {
|
||||
notice(DI::l10n()->t('Invalid storage backend setting value.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Invalid storage backend setting value.'));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
namespace Friendica\Module\Admin;
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Config\ValueObject\Cache;
|
||||
use Friendica\Core\Logger;
|
||||
|
@ -79,8 +80,8 @@ class Summary extends BaseAdmin
|
|||
// the local version of Friendica. Check is opt-in, source may be stable or develop branch
|
||||
if (DI::config()->get('system', 'check_new_version_url', 'none') != 'none') {
|
||||
$gitversion = DI::config()->get('system', 'git_friendica_version');
|
||||
if (version_compare(FRIENDICA_VERSION, $gitversion) < 0) {
|
||||
$warningtext[] = DI::l10n()->t('There is a new version of Friendica available for download. Your current version is %1$s, upstream version is %2$s', FRIENDICA_VERSION, $gitversion);
|
||||
if (version_compare(App::VERSION, $gitversion) < 0) {
|
||||
$warningtext[] = DI::l10n()->t('There is a new version of Friendica available for download. Your current version is %1$s, upstream version is %2$s', App::VERSION, $gitversion);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -236,9 +237,9 @@ class Summary extends BaseAdmin
|
|||
'$users' => [DI::l10n()->t('Registered users'), $users],
|
||||
'$accounts' => $accounts,
|
||||
'$pending' => [DI::l10n()->t('Pending registrations'), $pending],
|
||||
'$version' => [DI::l10n()->t('Version'), FRIENDICA_VERSION],
|
||||
'$platform' => FRIENDICA_PLATFORM,
|
||||
'$codename' => FRIENDICA_CODENAME,
|
||||
'$version' => [DI::l10n()->t('Version'), App::VERSION],
|
||||
'$platform' => App::PLATFORM,
|
||||
'$codename' => App::CODENAME,
|
||||
'$build' => DI::config()->get('system', 'build'),
|
||||
'$addons' => [DI::l10n()->t('Active addons'), Addon::getEnabledList()],
|
||||
'$serversettings' => $server_settings,
|
||||
|
|
|
@ -36,7 +36,7 @@ class Details extends BaseAdmin
|
|||
|
||||
$theme = Strings::sanitizeFilePathItem($this->parameters['theme']);
|
||||
if (!is_dir("view/theme/$theme")) {
|
||||
notice(DI::l10n()->t("Item not found."));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t("Item not found."));
|
||||
return '';
|
||||
}
|
||||
|
||||
|
@ -54,11 +54,11 @@ class Details extends BaseAdmin
|
|||
|
||||
if ($isEnabled) {
|
||||
Theme::uninstall($theme);
|
||||
info(DI::l10n()->t('Theme %s disabled.', $theme));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->t('Theme %s disabled.', $theme));
|
||||
} elseif (Theme::install($theme)) {
|
||||
info(DI::l10n()->t('Theme %s successfully enabled.', $theme));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->t('Theme %s successfully enabled.', $theme));
|
||||
} else {
|
||||
notice(DI::l10n()->t('Theme %s failed to install.', $theme));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Theme %s failed to install.', $theme));
|
||||
}
|
||||
|
||||
DI::baseUrl()->redirect('admin/themes/' . $theme);
|
||||
|
|
|
@ -77,7 +77,7 @@ class Embed extends BaseAdmin
|
|||
|
||||
$theme = Strings::sanitizeFilePathItem($this->parameters['theme']);
|
||||
if (!is_dir("view/theme/$theme")) {
|
||||
notice($this->t('Unknown theme.'));
|
||||
DI::sysmsg()->addNotice($this->t('Unknown theme.'));
|
||||
return '';
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ class Index extends BaseAdmin
|
|||
}
|
||||
Theme::setAllowedList($allowed_themes);
|
||||
|
||||
info(DI::l10n()->t('Themes reloaded'));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->t('Themes reloaded'));
|
||||
break;
|
||||
|
||||
case 'toggle' :
|
||||
|
@ -56,17 +56,17 @@ class Index extends BaseAdmin
|
|||
if ($theme) {
|
||||
$theme = Strings::sanitizeFilePathItem($theme);
|
||||
if (!is_dir("view/theme/$theme")) {
|
||||
notice(DI::l10n()->t('Item not found.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Item not found.'));
|
||||
return '';
|
||||
}
|
||||
|
||||
if (in_array($theme, Theme::getAllowedList())) {
|
||||
Theme::uninstall($theme);
|
||||
info(DI::l10n()->t('Theme %s disabled.', $theme));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->t('Theme %s disabled.', $theme));
|
||||
} elseif (Theme::install($theme)) {
|
||||
info(DI::l10n()->t('Theme %s successfully enabled.', $theme));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->t('Theme %s successfully enabled.', $theme));
|
||||
} else {
|
||||
notice(DI::l10n()->t('Theme %s failed to install.', $theme));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Theme %s failed to install.', $theme));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ class Active extends BaseUsers
|
|||
foreach ($users as $uid) {
|
||||
User::block($uid);
|
||||
}
|
||||
info(DI::l10n()->tt('%s user blocked', '%s users blocked', count($users)));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->tt('%s user blocked', '%s users blocked', count($users)));
|
||||
}
|
||||
|
||||
if (!empty($_POST['page_users_delete'])) {
|
||||
|
@ -50,11 +50,11 @@ class Active extends BaseUsers
|
|||
if (local_user() != $uid) {
|
||||
User::remove($uid);
|
||||
} else {
|
||||
notice(DI::l10n()->t('You can\'t remove yourself'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('You can\'t remove yourself'));
|
||||
}
|
||||
}
|
||||
|
||||
info(DI::l10n()->tt('%s user deleted', '%s users deleted', count($users)));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->tt('%s user deleted', '%s users deleted', count($users)));
|
||||
}
|
||||
|
||||
DI::baseUrl()->redirect(DI::args()->getQueryString());
|
||||
|
@ -70,7 +70,7 @@ class Active extends BaseUsers
|
|||
if ($uid) {
|
||||
$user = User::getById($uid, ['username', 'blocked']);
|
||||
if (!DBA::isResult($user)) {
|
||||
notice(DI::l10n()->t('User not found'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('User not found'));
|
||||
DI::baseUrl()->redirect('admin/users');
|
||||
return ''; // NOTREACHED
|
||||
}
|
||||
|
@ -83,9 +83,9 @@ class Active extends BaseUsers
|
|||
// delete user
|
||||
User::remove($uid);
|
||||
|
||||
notice(DI::l10n()->t('User "%s" deleted', $user['username']));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('User "%s" deleted', $user['username']));
|
||||
} else {
|
||||
notice(DI::l10n()->t('You can\'t remove yourself'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('You can\'t remove yourself'));
|
||||
}
|
||||
|
||||
DI::baseUrl()->redirect('admin/users/active');
|
||||
|
@ -93,7 +93,7 @@ class Active extends BaseUsers
|
|||
case 'block':
|
||||
self::checkFormSecurityTokenRedirectOnError('admin/users/active', 'admin_users_active', 't');
|
||||
User::block($uid);
|
||||
notice(DI::l10n()->t('User "%s" blocked', $user['username']));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('User "%s" blocked', $user['username']));
|
||||
DI::baseUrl()->redirect('admin/users/active');
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ class Blocked extends BaseUsers
|
|||
foreach ($users as $uid) {
|
||||
User::block($uid, false);
|
||||
}
|
||||
info(DI::l10n()->tt('%s user unblocked', '%s users unblocked', count($users)));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->tt('%s user unblocked', '%s users unblocked', count($users)));
|
||||
}
|
||||
|
||||
if (!empty($_POST['page_users_delete'])) {
|
||||
|
@ -51,11 +51,11 @@ class Blocked extends BaseUsers
|
|||
if (local_user() != $uid) {
|
||||
User::remove($uid);
|
||||
} else {
|
||||
notice(DI::l10n()->t('You can\'t remove yourself'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('You can\'t remove yourself'));
|
||||
}
|
||||
}
|
||||
|
||||
info(DI::l10n()->tt('%s user deleted', '%s users deleted', count($users)));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->tt('%s user deleted', '%s users deleted', count($users)));
|
||||
}
|
||||
|
||||
DI::baseUrl()->redirect('admin/users/blocked');
|
||||
|
@ -71,7 +71,7 @@ class Blocked extends BaseUsers
|
|||
if ($uid) {
|
||||
$user = User::getById($uid, ['username', 'blocked']);
|
||||
if (!DBA::isResult($user)) {
|
||||
notice(DI::l10n()->t('User not found'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('User not found'));
|
||||
DI::baseUrl()->redirect('admin/users');
|
||||
return ''; // NOTREACHED
|
||||
}
|
||||
|
@ -84,16 +84,16 @@ class Blocked extends BaseUsers
|
|||
// delete user
|
||||
User::remove($uid);
|
||||
|
||||
notice(DI::l10n()->t('User "%s" deleted', $user['username']));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('User "%s" deleted', $user['username']));
|
||||
} else {
|
||||
notice(DI::l10n()->t('You can\'t remove yourself'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('You can\'t remove yourself'));
|
||||
}
|
||||
DI::baseUrl()->redirect('admin/users/blocked');
|
||||
break;
|
||||
case 'unblock':
|
||||
self::checkFormSecurityTokenRedirectOnError('/admin/users/blocked', 'admin_users_blocked', 't');
|
||||
User::block($uid, false);
|
||||
notice(DI::l10n()->t('User "%s" unblocked', $user['username']));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('User "%s" unblocked', $user['username']));
|
||||
DI::baseUrl()->redirect('admin/users/blocked');
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ class Create extends BaseUsers
|
|||
User::createMinimal($nu_name, $nu_email, $nu_nickname, $nu_language);
|
||||
DI::baseUrl()->redirect('admin/users');
|
||||
} catch (\Exception $ex) {
|
||||
notice($ex->getMessage());
|
||||
DI::sysmsg()->addNotice($ex->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -42,14 +42,14 @@ class Index extends BaseUsers
|
|||
foreach ($users as $uid) {
|
||||
User::block($uid);
|
||||
}
|
||||
info(DI::l10n()->tt('%s user blocked', '%s users blocked', count($users)));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->tt('%s user blocked', '%s users blocked', count($users)));
|
||||
}
|
||||
|
||||
if (!empty($_POST['page_users_unblock'])) {
|
||||
foreach ($users as $uid) {
|
||||
User::block($uid, false);
|
||||
}
|
||||
info(DI::l10n()->tt('%s user unblocked', '%s users unblocked', count($users)));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->tt('%s user unblocked', '%s users unblocked', count($users)));
|
||||
}
|
||||
|
||||
if (!empty($_POST['page_users_delete'])) {
|
||||
|
@ -57,11 +57,11 @@ class Index extends BaseUsers
|
|||
if (local_user() != $uid) {
|
||||
User::remove($uid);
|
||||
} else {
|
||||
notice(DI::l10n()->t('You can\'t remove yourself'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('You can\'t remove yourself'));
|
||||
}
|
||||
}
|
||||
|
||||
info(DI::l10n()->tt('%s user deleted', '%s users deleted', count($users)));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->tt('%s user deleted', '%s users deleted', count($users)));
|
||||
}
|
||||
|
||||
DI::baseUrl()->redirect(DI::args()->getQueryString());
|
||||
|
@ -77,7 +77,7 @@ class Index extends BaseUsers
|
|||
if ($uid) {
|
||||
$user = User::getById($uid, ['username', 'blocked']);
|
||||
if (!DBA::isResult($user)) {
|
||||
notice(DI::l10n()->t('User not found'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('User not found'));
|
||||
DI::baseUrl()->redirect('admin/users');
|
||||
return ''; // NOTREACHED
|
||||
}
|
||||
|
@ -90,9 +90,9 @@ class Index extends BaseUsers
|
|||
// delete user
|
||||
User::remove($uid);
|
||||
|
||||
notice(DI::l10n()->t('User "%s" deleted', $user['username']));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('User "%s" deleted', $user['username']));
|
||||
} else {
|
||||
notice(DI::l10n()->t('You can\'t remove yourself'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('You can\'t remove yourself'));
|
||||
}
|
||||
|
||||
DI::baseUrl()->redirect('admin/users');
|
||||
|
@ -100,13 +100,13 @@ class Index extends BaseUsers
|
|||
case 'block':
|
||||
self::checkFormSecurityTokenRedirectOnError('admin/users', 'admin_users', 't');
|
||||
User::block($uid);
|
||||
notice(DI::l10n()->t('User "%s" blocked', $user['username']));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('User "%s" blocked', $user['username']));
|
||||
DI::baseUrl()->redirect('admin/users');
|
||||
break;
|
||||
case 'unblock':
|
||||
self::checkFormSecurityTokenRedirectOnError('admin/users', 'admin_users', 't');
|
||||
User::block($uid, false);
|
||||
notice(DI::l10n()->t('User "%s" unblocked', $user['username']));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('User "%s" unblocked', $user['username']));
|
||||
DI::baseUrl()->redirect('admin/users');
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -45,14 +45,14 @@ class Pending extends BaseUsers
|
|||
foreach ($pending as $hash) {
|
||||
User::allow($hash);
|
||||
}
|
||||
info(DI::l10n()->tt('%s user approved', '%s users approved', count($pending)));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->tt('%s user approved', '%s users approved', count($pending)));
|
||||
}
|
||||
|
||||
if (!empty($_POST['page_users_deny'])) {
|
||||
foreach ($pending as $hash) {
|
||||
User::deny($hash);
|
||||
}
|
||||
info(DI::l10n()->tt('%s registration revoked', '%s registrations revoked', count($pending)));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->tt('%s registration revoked', '%s registrations revoked', count($pending)));
|
||||
}
|
||||
|
||||
DI::baseUrl()->redirect('admin/users/pending');
|
||||
|
@ -68,7 +68,7 @@ class Pending extends BaseUsers
|
|||
if ($uid) {
|
||||
$user = User::getById($uid, ['username', 'blocked']);
|
||||
if (!DBA::isResult($user)) {
|
||||
notice(DI::l10n()->t('User not found'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('User not found'));
|
||||
DI::baseUrl()->redirect('admin/users');
|
||||
return ''; // NOTREACHED
|
||||
}
|
||||
|
@ -78,13 +78,13 @@ class Pending extends BaseUsers
|
|||
case 'allow':
|
||||
self::checkFormSecurityTokenRedirectOnError('/admin/users/pending', 'admin_users_pending', 't');
|
||||
User::allow(Register::getPendingForUser($uid)['hash'] ?? '');
|
||||
notice(DI::l10n()->t('Account approved.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Account approved.'));
|
||||
DI::baseUrl()->redirect('admin/users/pending');
|
||||
break;
|
||||
case 'deny':
|
||||
self::checkFormSecurityTokenRedirectOnError('/admin/users/pending', 'admin_users_pending', 't');
|
||||
User::deny(Register::getPendingForUser($uid)['hash'] ?? '');
|
||||
notice(DI::l10n()->t('Registration revoked'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Registration revoked'));
|
||||
DI::baseUrl()->redirect('admin/users/pending');
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -104,7 +104,7 @@ class Create extends BaseApi
|
|||
$item = ['network' => Protocol::DFRN, 'protocol' => Conversation::PARCEL_DIRECT, 'direction' => Conversation::PUSH];
|
||||
$item = Event::getItemArrayForId($event_id, $item);
|
||||
if (Item::insert($item)) {
|
||||
Worker::add(PRIORITY_HIGH, "Notifier", Delivery::POST, (int)$item['uri-id'], $uid);
|
||||
Worker::add(Worker::PRIORITY_HIGH, "Notifier", Delivery::POST, (int)$item['uri-id'], $uid);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -53,9 +53,8 @@ class Config extends BaseApi
|
|||
'sslserver' => null,
|
||||
'ssl' => DI::config()->get('system', 'ssl_policy') == App\BaseURL::SSL_POLICY_FULL ? 'always' : '0',
|
||||
'friendica' => [
|
||||
'FRIENDICA_PLATFORM' => FRIENDICA_PLATFORM,
|
||||
'FRIENDICA_VERSION' => FRIENDICA_VERSION,
|
||||
'DFRN_PROTOCOL_VERSION' => DFRN_PROTOCOL_VERSION,
|
||||
'FRIENDICA_PLATFORM' => App::PLATFORM,
|
||||
'FRIENDICA_VERSION' => App::VERSION,
|
||||
'DB_UPDATE_VERSION' => DB_UPDATE_VERSION,
|
||||
]
|
||||
],
|
||||
|
|
|
@ -25,6 +25,7 @@ use Friendica\App\Router;
|
|||
use Friendica\Content\Text\Markdown;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
|
@ -204,7 +205,7 @@ class Statuses extends BaseApi
|
|||
if (!empty($request['scheduled_at'])) {
|
||||
$item['guid'] = Item::guid($item, true);
|
||||
$item['uri'] = Item::newURI($item['guid']);
|
||||
$id = Post\Delayed::add($item['uri'], $item, PRIORITY_HIGH, Post\Delayed::PREPARED, $request['scheduled_at']);
|
||||
$id = Post\Delayed::add($item['uri'], $item, Worker::PRIORITY_HIGH, Post\Delayed::PREPARED, $request['scheduled_at']);
|
||||
if (empty($id)) {
|
||||
DI::mstdnError()->InternalError();
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ use Friendica\Content\Nav;
|
|||
use Friendica\Core\Config\Capability\IManageConfigValues;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
use Friendica\Util\Profiler;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
|
@ -51,7 +52,7 @@ class Apps extends BaseModule
|
|||
$apps = Nav::getAppMenu();
|
||||
|
||||
if (count($apps) == 0) {
|
||||
notice($this->t('No installed applications.'));
|
||||
DI::sysmsg()->addNotice($this->t('No installed applications.'));
|
||||
}
|
||||
|
||||
$tpl = Renderer::getMarkupTemplate('apps.tpl');
|
||||
|
|
|
@ -54,7 +54,7 @@ abstract class BaseAdmin extends BaseModule
|
|||
{
|
||||
if (!local_user()) {
|
||||
if ($interactive) {
|
||||
notice(DI::l10n()->t('Please login to continue.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Please login to continue.'));
|
||||
Session::set('return_path', DI::args()->getQueryString());
|
||||
DI::baseUrl()->redirect('login');
|
||||
} else {
|
||||
|
|
|
@ -116,7 +116,7 @@ class BaseSearch extends BaseModule
|
|||
protected static function printResult(ResultList $results, Pager $pager, string $header = ''): string
|
||||
{
|
||||
if ($results->getTotal() == 0) {
|
||||
notice(DI::l10n()->t('No matches'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('No matches'));
|
||||
return '';
|
||||
}
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ class Contact extends BaseModule
|
|||
}
|
||||
}
|
||||
if ($count_actions > 0) {
|
||||
info(DI::l10n()->tt('%d contact edited.', '%d contacts edited.', $count_actions));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->tt('%d contact edited.', '%d contacts edited.', $count_actions));
|
||||
}
|
||||
|
||||
DI::baseUrl()->redirect($redirectUrl);
|
||||
|
@ -126,9 +126,9 @@ class Contact extends BaseModule
|
|||
}
|
||||
|
||||
// pull feed and consume it, which should subscribe to the hub.
|
||||
Worker::add(PRIORITY_HIGH, 'OnePoll', $contact_id, 'force');
|
||||
Worker::add(Worker::PRIORITY_HIGH, 'OnePoll', $contact_id, 'force');
|
||||
} else {
|
||||
Worker::add(PRIORITY_HIGH, 'UpdateContact', $contact_id);
|
||||
Worker::add(Worker::PRIORITY_HIGH, 'UpdateContact', $contact_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ use Friendica\Core\Protocol;
|
|||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Database\Database;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model;
|
||||
use Friendica\Module\Contact;
|
||||
use Friendica\Module\Response;
|
||||
|
@ -96,7 +97,7 @@ class Advanced extends BaseModule
|
|||
}
|
||||
|
||||
if (!$r) {
|
||||
notice($this->t('Contact update failed.'));
|
||||
DI::sysmsg()->addNotice($this->t('Contact update failed.'));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ use Friendica\Core\L10n;
|
|||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Group;
|
||||
use Friendica\Module;
|
||||
|
@ -124,7 +125,7 @@ class Profile extends BaseModule
|
|||
}
|
||||
|
||||
if (!Contact::update($fields, ['id' => $cdata['user'], 'uid' => local_user()])) {
|
||||
notice($this->t('Failed to update contact record.'));
|
||||
DI::sysmsg()->addNotice($this->t('Failed to update contact record.'));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -182,7 +183,7 @@ class Profile extends BaseModule
|
|||
}
|
||||
|
||||
// @TODO: add $this->localRelationship->save($localRelationship);
|
||||
info($message);
|
||||
DI::sysmsg()->addInfo($message);
|
||||
}
|
||||
|
||||
if ($cmd === 'ignore') {
|
||||
|
@ -198,7 +199,7 @@ class Profile extends BaseModule
|
|||
}
|
||||
|
||||
// @TODO: add $this->localRelationship->save($localRelationship);
|
||||
info($message);
|
||||
DI::sysmsg()->addInfo($message);
|
||||
}
|
||||
|
||||
$this->baseUrl->redirect('contact/' . $contact['id']);
|
||||
|
|
|
@ -28,6 +28,7 @@ use Friendica\Core\L10n;
|
|||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Database\Database;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model;
|
||||
use Friendica\Module\Contact;
|
||||
use Friendica\Module\Response;
|
||||
|
@ -87,7 +88,7 @@ class Revoke extends BaseModule
|
|||
|
||||
Model\Contact::revokeFollow($this->contact);
|
||||
|
||||
notice($this->t('Follow was successfully revoked.'));
|
||||
DI::sysmsg()->addNotice($this->t('Follow was successfully revoked.'));
|
||||
|
||||
$this->baseUrl->redirect('contact/' . $this->parameters['id']);
|
||||
}
|
||||
|
|
|
@ -40,6 +40,21 @@ use Friendica\Network\HTTPException;
|
|||
|
||||
class Community extends BaseModule
|
||||
{
|
||||
/**
|
||||
* @name CP
|
||||
*
|
||||
* Type of the community page
|
||||
* @{
|
||||
*/
|
||||
const DISABLED = -2;
|
||||
const DISABLED_VISITOR = -1;
|
||||
const LOCAL = 0;
|
||||
const GLOBAL = 1;
|
||||
const LOCAL_AND_GLOBAL = 2;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
protected static $page_style;
|
||||
protected static $content;
|
||||
protected static $accountTypeString;
|
||||
|
@ -69,7 +84,7 @@ class Community extends BaseModule
|
|||
if (empty($_GET['mode']) || ($_GET['mode'] != 'raw')) {
|
||||
$tabs = [];
|
||||
|
||||
if ((Session::isAuthenticated() || in_array(self::$page_style, [CP_USERS_AND_GLOBAL, CP_USERS_ON_SERVER])) && empty(DI::config()->get('system', 'singleuser'))) {
|
||||
if ((Session::isAuthenticated() || in_array(self::$page_style, [self::LOCAL_AND_GLOBAL, self::LOCAL])) && empty(DI::config()->get('system', 'singleuser'))) {
|
||||
$tabs[] = [
|
||||
'label' => DI::l10n()->t('Local Community'),
|
||||
'url' => 'community/local',
|
||||
|
@ -80,7 +95,7 @@ class Community extends BaseModule
|
|||
];
|
||||
}
|
||||
|
||||
if (Session::isAuthenticated() || in_array(self::$page_style, [CP_USERS_AND_GLOBAL, CP_GLOBAL_COMMUNITY])) {
|
||||
if (Session::isAuthenticated() || in_array(self::$page_style, [self::LOCAL_AND_GLOBAL, self::GLOBAL])) {
|
||||
$tabs[] = [
|
||||
'label' => DI::l10n()->t('Global Community'),
|
||||
'url' => 'community/global',
|
||||
|
@ -140,7 +155,7 @@ class Community extends BaseModule
|
|||
$items = self::getItems();
|
||||
|
||||
if (!DBA::isResult($items)) {
|
||||
notice(DI::l10n()->t('No results.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('No results.'));
|
||||
return $o;
|
||||
}
|
||||
|
||||
|
@ -177,7 +192,7 @@ class Community extends BaseModule
|
|||
|
||||
self::$page_style = DI::config()->get('system', 'community_page_style');
|
||||
|
||||
if (self::$page_style == CP_NO_INTERNAL_COMMUNITY) {
|
||||
if (self::$page_style == self::DISABLED) {
|
||||
throw new HTTPException\ForbiddenException(DI::l10n()->t('Access denied.'));
|
||||
}
|
||||
|
||||
|
@ -191,7 +206,7 @@ class Community extends BaseModule
|
|||
self::$content = 'global';
|
||||
} else {
|
||||
// When only the global community is allowed, we use this as default
|
||||
self::$content = self::$page_style == CP_GLOBAL_COMMUNITY ? 'global' : 'local';
|
||||
self::$content = self::$page_style == self::GLOBAL ? 'global' : 'local';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -201,14 +216,14 @@ class Community extends BaseModule
|
|||
|
||||
// Check if we are allowed to display the content to visitors
|
||||
if (!Session::isAuthenticated()) {
|
||||
$available = self::$page_style == CP_USERS_AND_GLOBAL;
|
||||
$available = self::$page_style == self::LOCAL_AND_GLOBAL;
|
||||
|
||||
if (!$available) {
|
||||
$available = (self::$page_style == CP_USERS_ON_SERVER) && (self::$content == 'local');
|
||||
$available = (self::$page_style == self::LOCAL) && (self::$content == 'local');
|
||||
}
|
||||
|
||||
if (!$available) {
|
||||
$available = (self::$page_style == CP_GLOBAL_COMMUNITY) && (self::$content == 'global');
|
||||
$available = (self::$page_style == self::GLOBAL) && (self::$content == 'global');
|
||||
}
|
||||
|
||||
if (!$available) {
|
||||
|
|
|
@ -170,7 +170,7 @@ class Network extends BaseModule
|
|||
if (self::$groupId) {
|
||||
$group = DBA::selectFirst('group', ['name'], ['id' => self::$groupId, 'uid' => local_user()]);
|
||||
if (!DBA::isResult($group)) {
|
||||
notice(DI::l10n()->t('No such group'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('No such group'));
|
||||
}
|
||||
|
||||
$o = Renderer::replaceMacros(Renderer::getMarkupTemplate('section_title.tpl'), [
|
||||
|
@ -184,7 +184,7 @@ class Network extends BaseModule
|
|||
'id' => DI::args()->get(0),
|
||||
]) . $o;
|
||||
} else {
|
||||
notice(DI::l10n()->t('Invalid contact.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Invalid contact.'));
|
||||
}
|
||||
} elseif (!DI::config()->get('theme', 'hide_eventlist')) {
|
||||
$o .= Profile::getBirthdays();
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue