Merge branch 'develop' into new-addonproxy

This commit is contained in:
Art4 2025-02-03 13:58:10 +00:00
commit d82483f342
7 changed files with 57 additions and 25 deletions

1
.gitignore vendored
View file

@ -72,7 +72,6 @@ venv/
/.idea /.idea
#ignore addons directory #ignore addons directory
/addons
/addon /addon
#ignore base .htaccess #ignore base .htaccess

View file

@ -210,9 +210,9 @@ If the deprecated code is no longer used inside Friendica or the official addons
The code MUST NOT be deleted. The code MUST NOT be deleted.
Starting from the next release, it MUST be stay for at least 5 months. Starting from the next release, it MUST be stay for at least 5 months.
Hard deprecated code COULD remain longer than 5 months, depending on when a release appears. Hard deprecated code COULD remain longer than 5 months, depending on when a release appears.
Addon developer MUST NOT consider that they have more than 5 months to adjust their code. Addon developer SHOULD NOT consider that they have more than 5 months to adjust their code.
Hard deprecation code means that the code triggers an `E_USER_DEPRECATION` error if it is called. Hard deprecation code means that the code triggers a muted `E_USER_DEPRECATION` error if it is called.
For instance with the deprecated class `Friendica\Core\Logger` the call of every method should trigger an error: For instance with the deprecated class `Friendica\Core\Logger` the call of every method should trigger an error:
```php ```php
@ -224,7 +224,7 @@ For instance with the deprecated class `Friendica\Core\Logger` the call of every
class Logger { class Logger {
public static function info(string $message, array $context = []) public static function info(string $message, array $context = [])
{ {
trigger_error('Class `' . __CLASS__ . '` is deprecated since 2025.05 and will be removed after 5 months, use constructor injection or `DI::logger()` instead.', E_USER_DEPRECATED); @trigger_error('Class `' . __CLASS__ . '` is deprecated since 2025.05 and will be removed after 5 months, use constructor injection or `DI::logger()` instead.', E_USER_DEPRECATED);
self::getInstance()->info($message, $context); self::getInstance()->info($message, $context);
} }
@ -233,7 +233,7 @@ class Logger {
} }
``` ```
This way the maintainer or users of addons will be notified that the addon will stop working in one of the next releases. This way the maintainer or users of addons will be notified in the logs that the addon will stop working in one of the next releases.
The addon maintainer now has at least 5 months or at least one release to fix the deprecations. The addon maintainer now has at least 5 months or at least one release to fix the deprecations.
Please note that the deprecation message contains the release that will be released next. Please note that the deprecation message contains the release that will be released next.

View file

@ -76,14 +76,6 @@ This makes the software much easier to update.
The Linux commands to clone the repository into a directory "mywebsite" would be The Linux commands to clone the repository into a directory "mywebsite" would be
git clone https://github.com/friendica/friendica.git -b stable mywebsite git clone https://github.com/friendica/friendica.git -b stable mywebsite
cd mywebsite
bin/composer.phar install --no-dev
Make sure the folder *view/smarty3* exists and is writable by the webserver user, in this case *www-data*
mkdir -p view/smarty3
chown www-data:www-data view/smarty3
chmod 775 view/smarty3
Get the addons by going into your website folder. Get the addons by going into your website folder.
@ -93,6 +85,16 @@ Clone the addon repository (separately):
git clone https://github.com/friendica/friendica-addons.git -b stable addon git clone https://github.com/friendica/friendica-addons.git -b stable addon
Install the dependencies:
bin/composer.phar install --no-dev
Make sure the folder *view/smarty3* exists and is writable by the webserver user, in this case *www-data*
mkdir -p view/smarty3
chown www-data:www-data view/smarty3
chmod 775 view/smarty3
If you want to use the development version of Friendica you can switch to the develop branch in the repository by running If you want to use the development version of Friendica you can switch to the develop branch in the repository by running
git checkout develop git checkout develop

View file

@ -8,7 +8,6 @@
namespace Friendica\Core; namespace Friendica\Core;
use Friendica\DI; use Friendica\DI;
use Friendica\Core\Logger\Type\WorkerLogger;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
/** /**
@ -18,10 +17,7 @@ use Psr\Log\LoggerInterface;
*/ */
class Logger class Logger
{ {
/** private static function getInstance(): LoggerInterface
* @return LoggerInterface|WorkerLogger
*/
private static function getInstance()
{ {
return DI::logger(); return DI::logger();
} }
@ -38,6 +34,8 @@ class Logger
*/ */
public static function emergency(string $message, array $context = []) public static function emergency(string $message, array $context = [])
{ {
@trigger_error('Class `' . __CLASS__ . '` is deprecated since 2025.02 and will be removed after 5 months, use constructor injection or `DI::logger()` instead.', E_USER_DEPRECATED);
self::getInstance()->emergency($message, $context); self::getInstance()->emergency($message, $context);
} }
@ -55,6 +53,8 @@ class Logger
*/ */
public static function alert(string $message, array $context = []) public static function alert(string $message, array $context = [])
{ {
@trigger_error('Class `' . __CLASS__ . '` is deprecated since 2025.02 and will be removed after 5 months, use constructor injection or `DI::logger()` instead.', E_USER_DEPRECATED);
self::getInstance()->alert($message, $context); self::getInstance()->alert($message, $context);
} }
@ -71,6 +71,8 @@ class Logger
*/ */
public static function critical(string $message, array $context = []) public static function critical(string $message, array $context = [])
{ {
@trigger_error('Class `' . __CLASS__ . '` is deprecated since 2025.02 and will be removed after 5 months, use constructor injection or `DI::logger()` instead.', E_USER_DEPRECATED);
self::getInstance()->critical($message, $context); self::getInstance()->critical($message, $context);
} }
@ -86,6 +88,8 @@ class Logger
*/ */
public static function error(string $message, array $context = []) public static function error(string $message, array $context = [])
{ {
@trigger_error('Class `' . __CLASS__ . '` is deprecated since 2025.02 and will be removed after 5 months, use constructor injection or `DI::logger()` instead.', E_USER_DEPRECATED);
self::getInstance()->error($message, $context); self::getInstance()->error($message, $context);
} }
@ -103,6 +107,8 @@ class Logger
*/ */
public static function warning(string $message, array $context = []) public static function warning(string $message, array $context = [])
{ {
@trigger_error('Class `' . __CLASS__ . '` is deprecated since 2025.02 and will be removed after 5 months, use constructor injection or `DI::logger()` instead.', E_USER_DEPRECATED);
self::getInstance()->warning($message, $context); self::getInstance()->warning($message, $context);
} }
@ -117,6 +123,8 @@ class Logger
*/ */
public static function notice(string $message, array $context = []) public static function notice(string $message, array $context = [])
{ {
@trigger_error('Class `' . __CLASS__ . '` is deprecated since 2025.02 and will be removed after 5 months, use constructor injection or `DI::logger()` instead.', E_USER_DEPRECATED);
self::getInstance()->notice($message, $context); self::getInstance()->notice($message, $context);
} }
@ -134,6 +142,8 @@ class Logger
*/ */
public static function info(string $message, array $context = []) public static function info(string $message, array $context = [])
{ {
@trigger_error('Class `' . __CLASS__ . '` is deprecated since 2025.02 and will be removed after 5 months, use constructor injection or `DI::logger()` instead.', E_USER_DEPRECATED);
self::getInstance()->info($message, $context); self::getInstance()->info($message, $context);
} }
@ -148,6 +158,8 @@ class Logger
*/ */
public static function debug(string $message, array $context = []) public static function debug(string $message, array $context = [])
{ {
@trigger_error('Class `' . __CLASS__ . '` is deprecated since 2025.02 and will be removed after 5 months, use constructor injection or `DI::logger()` instead.', E_USER_DEPRECATED);
self::getInstance()->debug($message, $context); self::getInstance()->debug($message, $context);
} }
} }

View file

@ -197,7 +197,7 @@ class ErrorHandler
E_STRICT => LogLevel::NOTICE, E_STRICT => LogLevel::NOTICE,
E_RECOVERABLE_ERROR => LogLevel::ERROR, E_RECOVERABLE_ERROR => LogLevel::ERROR,
E_DEPRECATED => LogLevel::NOTICE, E_DEPRECATED => LogLevel::NOTICE,
E_USER_DEPRECATED => LogLevel::NOTICE, E_USER_DEPRECATED => LogLevel::WARNING,
]; ];
} }
@ -248,17 +248,29 @@ class ErrorHandler
*/ */
public function handleError(int $code, string $message, string $file = '', int $line = 0, ?array $context = []): bool public function handleError(int $code, string $message, string $file = '', int $line = 0, ?array $context = []): bool
{ {
if ($this->handleOnlyReportedErrors && !(error_reporting() & $code)) { if ($this->handleOnlyReportedErrors && !(error_reporting() & $code) && $code !== E_USER_DEPRECATED) {
return true; return true;
} }
$trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
array_shift($trace); // Exclude handleError from trace
if ($code === E_USER_DEPRECATED && $trace[0]['function'] ?? '' === 'trigger_error') {
$calledPlace = $trace[1] ?? [];
$message .= sprintf(
' It was called in `%s`%s.',
$calledPlace['file'],
isset($calledPlace['line']) ? ' in line ' . $calledPlace['line'] : ''
);
}
// fatal error codes are ignored if a fatal error handler is present as well to avoid duplicate log entries // fatal error codes are ignored if a fatal error handler is present as well to avoid duplicate log entries
if (!$this->hasFatalErrorHandler || !in_array($code, self::$fatalErrors, true)) { if (!$this->hasFatalErrorHandler || !in_array($code, self::$fatalErrors, true)) {
$level = $this->errorLevelMap[$code] ?? LogLevel::CRITICAL; $level = $this->errorLevelMap[$code] ?? LogLevel::CRITICAL;
$this->logger->log($level, self::codeToString($code).': '.$message, ['code' => $code, 'message' => $message, 'file' => $file, 'line' => $line]); $this->logger->log($level, self::codeToString($code).': '.$message, ['code' => $code, 'message' => $message, 'file' => $file, 'line' => $line]);
} else { } else {
$trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
array_shift($trace); // Exclude handleError from trace
$this->lastFatalTrace = $trace; $this->lastFatalTrace = $trace;
} }

View file

@ -338,9 +338,16 @@ abstract class DI
*/ */
public static function workerLogger() public static function workerLogger()
{ {
@trigger_error('`' . __METHOD__ . '()` is deprecated since 2025.02 and will be removed after 5 months, use `DI::logger()` instead.', E_USER_DEPRECATED);
return self::$dice->create(Core\Logger\Type\WorkerLogger::class); return self::$dice->create(Core\Logger\Type\WorkerLogger::class);
} }
/**
* @internal Only for use in Friendica\Core\Worker class
*
* @see Friendica\Core\Worker::execFunction()
*/
public static function loggerManager(): LoggerManager public static function loggerManager(): LoggerManager
{ {
return self::$dice->create(LoggerManager::class); return self::$dice->create(LoggerManager::class);

View file

@ -2708,10 +2708,10 @@ ul li:hover .contact-wrapper .contact-action-link:hover {
#circle-update-wrapper .shortmode .contact-entry-desc { #circle-update-wrapper .shortmode .contact-entry-desc {
font-size: 12px !important; font-size: 12px !important;
} }
#circle-update-wrapper .shortmode .contact-entry-desc h1.media-heading { #circle-update-wrapper .shortmode .contact-entry-desc h4.media-heading {
margin: 0; margin: 0;
} }
#circle-update-wrapper .shortmode .contact-entry-desc h1.media-heading a { #circle-update-wrapper .shortmode .contact-entry-desc h4.media-heading a {
font-size: 13px !important; font-size: 13px !important;
white-space: nowrap; white-space: nowrap;
} }