mirror of
https://github.com/friendica/friendica
synced 2025-04-29 05:04:24 +02:00
Merge branch 'develop' into phpstan-level-1
This commit is contained in:
commit
c79f3cde22
150 changed files with 2429 additions and 1781 deletions
|
@ -7,7 +7,6 @@
|
|||
|
||||
namespace Friendica\Core;
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Util\Strings;
|
||||
|
@ -81,7 +80,7 @@ class Hook
|
|||
*/
|
||||
public static function register(string $hook, string $file, string $function, int $priority = 0)
|
||||
{
|
||||
$file = str_replace(DI::app()->getBasePath() . DIRECTORY_SEPARATOR, '', $file);
|
||||
$file = str_replace(DI::appHelper()->getBasePath() . DIRECTORY_SEPARATOR, '', $file);
|
||||
|
||||
$condition = ['hook' => $hook, 'file' => $file, 'function' => $function];
|
||||
if (DBA::exists('hook', $condition)) {
|
||||
|
@ -102,7 +101,7 @@ class Hook
|
|||
*/
|
||||
public static function unregister(string $hook, string $file, string $function): bool
|
||||
{
|
||||
$relative_file = str_replace(DI::app()->getBasePath() . DIRECTORY_SEPARATOR, '', $file);
|
||||
$relative_file = str_replace(DI::appHelper()->getBasePath() . DIRECTORY_SEPARATOR, '', $file);
|
||||
|
||||
// This here is only needed for fixing a problem that existed on the develop branch
|
||||
$condition = ['hook' => $hook, 'file' => $file, 'function' => $function];
|
||||
|
@ -198,7 +197,7 @@ class Hook
|
|||
public static function callSingle(string $name, array $hook, &$data = null)
|
||||
{
|
||||
// Don't run a theme's hook if the user isn't using the theme
|
||||
if (strpos($hook[0], 'view/theme/') !== false && strpos($hook[0], 'view/theme/' . DI::app()->getCurrentTheme()) === false) {
|
||||
if (strpos($hook[0], 'view/theme/') !== false && strpos($hook[0], 'view/theme/' . DI::appHelper()->getCurrentTheme()) === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -155,9 +155,9 @@ class Renderer
|
|||
if (isset(self::$template_engine_instance[$template_engine])) {
|
||||
return self::$template_engine_instance[$template_engine];
|
||||
} else {
|
||||
$a = DI::app();
|
||||
$appHelper = DI::appHelper();
|
||||
$class = self::$template_engines[$template_engine];
|
||||
$obj = new $class($a->getCurrentTheme(), $a->getThemeInfo());
|
||||
$obj = new $class($appHelper->getCurrentTheme(), $appHelper->getThemeInfo());
|
||||
self::$template_engine_instance[$template_engine] = $obj;
|
||||
return $obj;
|
||||
}
|
||||
|
|
|
@ -7,7 +7,8 @@
|
|||
|
||||
namespace Friendica\Core\Session\Factory;
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\App\BaseURL;
|
||||
use Friendica\App\Mode;
|
||||
use Friendica\Core\Cache\Factory\Cache;
|
||||
use Friendica\Core\Cache\Type\DatabaseCache;
|
||||
use Friendica\Core\Config\Capability\IManageConfigValues;
|
||||
|
@ -33,8 +34,8 @@ class Session
|
|||
const HANDLER_DEFAULT = self::HANDLER_DATABASE;
|
||||
|
||||
/**
|
||||
* @param App\Mode $mode
|
||||
* @param App\BaseURL $baseURL
|
||||
* @param Mode $mode
|
||||
* @param BaseURL $baseURL
|
||||
* @param IManageConfigValues $config
|
||||
* @param Database $dba
|
||||
* @param Cache $cacheFactory
|
||||
|
@ -43,7 +44,7 @@ class Session
|
|||
* @param array $server
|
||||
* @return IHandleSessions
|
||||
*/
|
||||
public function create(App\Mode $mode, App\BaseURL $baseURL, IManageConfigValues $config, Database $dba, Cache $cacheFactory, LoggerInterface $logger, Profiler $profiler, array $server = []): IHandleSessions
|
||||
public function create(Mode $mode, BaseURL $baseURL, IManageConfigValues $config, Database $dba, Cache $cacheFactory, LoggerInterface $logger, Profiler $profiler, array $server = []): IHandleSessions
|
||||
{
|
||||
$profiler->startRecording('session');
|
||||
$session_handler = $config->get('system', 'session_handler', self::HANDLER_DEFAULT);
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
namespace Friendica\Core\Session\Type;
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\App\BaseURL;
|
||||
use Friendica\Core\Session\Capability\IHandleSessions;
|
||||
use Friendica\Model\User\Cookie;
|
||||
use SessionHandlerInterface;
|
||||
|
@ -17,7 +17,7 @@ use SessionHandlerInterface;
|
|||
*/
|
||||
class Native extends AbstractSession implements IHandleSessions
|
||||
{
|
||||
public function __construct(App\BaseURL $baseURL, SessionHandlerInterface $handler = null)
|
||||
public function __construct(BaseURL $baseURL, SessionHandlerInterface $handler = null)
|
||||
{
|
||||
ini_set('session.gc_probability', 50);
|
||||
ini_set('session.use_only_cookies', 1);
|
||||
|
|
|
@ -208,11 +208,11 @@ class Theme
|
|||
*/
|
||||
public static function getPathForFile(string $file): string
|
||||
{
|
||||
$a = DI::app();
|
||||
$appHelper = DI::appHelper();
|
||||
|
||||
$theme = $a->getCurrentTheme();
|
||||
$theme = $appHelper->getCurrentTheme();
|
||||
|
||||
$parent = Strings::sanitizeFilePathItem($a->getThemeInfoValue('extends', $theme));
|
||||
$parent = Strings::sanitizeFilePathItem($appHelper->getThemeInfoValue('extends', $theme));
|
||||
|
||||
$paths = [
|
||||
"view/theme/$theme/$file",
|
||||
|
@ -245,11 +245,11 @@ class Theme
|
|||
return 'view/theme/' . $theme . '/style.css';
|
||||
}
|
||||
|
||||
$a = DI::app();
|
||||
$appHelper = DI::appHelper();
|
||||
|
||||
$query_params = [];
|
||||
|
||||
$puid = Profile::getThemeUid($a);
|
||||
$puid = Profile::getThemeUid($appHelper);
|
||||
if ($puid) {
|
||||
$query_params['puid'] = $puid;
|
||||
}
|
||||
|
@ -267,8 +267,8 @@ class Theme
|
|||
{
|
||||
$theme = Strings::sanitizeFilePathItem($theme);
|
||||
|
||||
$a = DI::app();
|
||||
$base_theme = $a->getThemeInfoValue('extends') ?? '';
|
||||
$appHelper = DI::appHelper();
|
||||
$base_theme = $appHelper->getThemeInfoValue('extends') ?? '';
|
||||
|
||||
if (file_exists("view/theme/$theme/config.php")) {
|
||||
return "view/theme/$theme/config.php";
|
||||
|
|
|
@ -67,7 +67,6 @@ class Update
|
|||
*
|
||||
* @param string $basePath The base path of this application
|
||||
* @param boolean $via_worker Is the check run via the worker?
|
||||
* @param App\Mode $mode The current app mode
|
||||
* @return void
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
|
|
|
@ -533,7 +533,7 @@ class Worker
|
|||
*/
|
||||
private static function execFunction(array $queue, string $funcname, array $argv, bool $method_call)
|
||||
{
|
||||
$a = DI::app();
|
||||
$appHelper = DI::appHelper();
|
||||
|
||||
self::coolDown();
|
||||
|
||||
|
@ -547,7 +547,7 @@ class Worker
|
|||
// For this reason the variables have to be initialized.
|
||||
DI::profiler()->reset();
|
||||
|
||||
$a->setQueue($queue);
|
||||
$appHelper->setQueue($queue);
|
||||
|
||||
$up_duration = microtime(true) - self::$up_start;
|
||||
|
||||
|
@ -571,7 +571,7 @@ class Worker
|
|||
|
||||
Logger::disableWorker();
|
||||
|
||||
$a->setQueue([]);
|
||||
$appHelper->setQueue([]);
|
||||
|
||||
$duration = (microtime(true) - $stamp);
|
||||
|
||||
|
@ -830,7 +830,7 @@ class Worker
|
|||
return false;
|
||||
} elseif ($max_idletime > 0) {
|
||||
Logger::debug('Maximum idletime not reached.', ['last' => $last_check, 'last-check' => $last_date, 'seconds' => $max_idletime, 'load' => $load, 'max_load' => $maxsysload, 'active_worker' => $active, 'max_worker' => $maxqueues]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1371,20 +1371,20 @@ class Worker
|
|||
*/
|
||||
public static function getRetrial(): int
|
||||
{
|
||||
$queue = DI::app()->getQueue();
|
||||
$queue = DI::appHelper()->getQueue();
|
||||
return $queue['retrial'] ?? 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defers the current worker entry
|
||||
*
|
||||
* @param int $worker_defer_limit Maximum defer limit
|
||||
* @param int $worker_defer_limit Maximum defer limit
|
||||
* @return boolean had the entry been deferred?
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function defer(int $worker_defer_limit = 0): bool
|
||||
{
|
||||
$queue = DI::app()->getQueue();
|
||||
$queue = DI::appHelper()->getQueue();
|
||||
|
||||
if (empty($queue)) {
|
||||
return false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue