Fix code style

This commit is contained in:
Art4 2025-02-03 13:59:58 +00:00
parent d82483f342
commit 9c002a1aa2
3 changed files with 33 additions and 24 deletions

View file

@ -19,14 +19,14 @@ interface AddonHelper
*/ */
public function isEnabled(string $addonId): bool; public function isEnabled(string $addonId): bool;
/** /**
* Returns a list with the IDs of the enabled addons * Returns a list with the IDs of the enabled addons
* *
* @return string[] * @return string[]
*/ */
public function getEnabledList(): array; public function getEnabledList(): array;
/** /**
* Returns the list of the IDs of the non-hidden enabled addons * Returns the list of the IDs of the non-hidden enabled addons
* *
* @return string[] * @return string[]

View file

@ -34,7 +34,7 @@ class Index extends BaseAdmin
DI::sysmsg()->addInfo(DI::l10n()->t('Addons reloaded')); DI::sysmsg()->addInfo(DI::l10n()->t('Addons reloaded'));
break; break;
case 'toggle' : case 'toggle':
$addonHelper = DI::addonHelper(); $addonHelper = DI::addonHelper();
$addon = $_GET['addon'] ?? ''; $addon = $_GET['addon'] ?? '';
@ -58,14 +58,14 @@ class Index extends BaseAdmin
$t = Renderer::getMarkupTemplate('admin/addons/index.tpl'); $t = Renderer::getMarkupTemplate('admin/addons/index.tpl');
return Renderer::replaceMacros($t, [ return Renderer::replaceMacros($t, [
'$title' => DI::l10n()->t('Administration'), '$title' => DI::l10n()->t('Administration'),
'$page' => DI::l10n()->t('Addons'), '$page' => DI::l10n()->t('Addons'),
'$submit' => DI::l10n()->t('Save Settings'), '$submit' => DI::l10n()->t('Save Settings'),
'$reload' => DI::l10n()->t('Reload active addons'), '$reload' => DI::l10n()->t('Reload active addons'),
'$function' => 'addons', '$function' => 'addons',
'$addons' => $addons, '$addons' => $addons,
'$pcount' => count($addons), '$pcount' => count($addons),
'$noplugshint' => DI::l10n()->t('There are currently no addons available on your node. You can find the official addon repository at %1$s.', 'https://git.friendi.ca/friendica/friendica-addons'), '$noplugshint' => DI::l10n()->t('There are currently no addons available on your node. You can find the official addon repository at %1$s.', 'https://git.friendi.ca/friendica/friendica-addons'),
'$form_security_token' => self::getFormSecurityToken('admin_addons'), '$form_security_token' => self::getFormSecurityToken('admin_addons'),
]); ]);
} }

View file

@ -8,7 +8,6 @@
namespace Friendica\Module\Admin; namespace Friendica\Module\Admin;
use Friendica\App; use Friendica\App;
use Friendica\Core\Addon;
use Friendica\Core\Config\ValueObject\Cache; use Friendica\Core\Config\ValueObject\Cache;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Core\Update; use Friendica\Core\Update;
@ -33,7 +32,7 @@ class Summary extends BaseAdmin
$warningtext = []; $warningtext = [];
$templateEngine = Renderer::getTemplateEngine(); $templateEngine = Renderer::getTemplateEngine();
$errors = []; $errors = [];
$templateEngine->testInstall($errors); $templateEngine->testInstall($errors);
foreach ($errors as $error) { foreach ($errors as $error) {
$warningtext[] = DI::l10n()->t('Template engine (%s) error: %s', $templateEngine::$name, $error); $warningtext[] = DI::l10n()->t('Template engine (%s) error: %s', $templateEngine::$name, $error);
@ -51,7 +50,7 @@ class Summary extends BaseAdmin
// Avoid the database error 1615 "Prepared statement needs to be re-prepared", see https://github.com/friendica/friendica/issues/8550 // Avoid the database error 1615 "Prepared statement needs to be re-prepared", see https://github.com/friendica/friendica/issues/8550
if (!DI::config()->get('database', 'pdo_emulate_prepares')) { if (!DI::config()->get('database', 'pdo_emulate_prepares')) {
$table_definition_cache = DBA::getVariable('table_definition_cache'); $table_definition_cache = DBA::getVariable('table_definition_cache');
$table_open_cache = DBA::getVariable('table_open_cache'); $table_open_cache = DBA::getVariable('table_open_cache');
if (!empty($table_definition_cache) && !empty($table_open_cache)) { if (!empty($table_definition_cache) && !empty($table_open_cache)) {
$suggested_definition_cache = min(400 + round((int) $table_open_cache / 2, 1), 2000); $suggested_definition_cache = min(400 + round((int) $table_open_cache / 2, 1), 2000);
if ($suggested_definition_cache > $table_definition_cache) { if ($suggested_definition_cache > $table_definition_cache) {
@ -100,9 +99,13 @@ class Summary extends BaseAdmin
// Check server vitality // Check server vitality
if (!self::checkSelfHostMeta()) { if (!self::checkSelfHostMeta()) {
$well_known = DI::baseUrl() . Probe::HOST_META; $well_known = DI::baseUrl() . Probe::HOST_META;
$warningtext[] = DI::l10n()->t('<a href="%s">%s</a> is not reachable on your system. This is a severe configuration issue that prevents server to server communication. See <a href="%s">the installation page</a> for help.', $warningtext[] = DI::l10n()->t(
$well_known, $well_known, DI::baseUrl() . '/help/Install'); '<a href="%s">%s</a> is not reachable on your system. This is a severe configuration issue that prevents server to server communication. See <a href="%s">the installation page</a> for help.',
$well_known,
$well_known,
DI::baseUrl() . '/help/Install'
);
} }
// Check logfile permission // Check logfile permission
@ -115,7 +118,7 @@ class Summary extends BaseAdmin
// check legacy basepath settings // check legacy basepath settings
$configLoader = (new Config())->createConfigFileManager($basePath, $_SERVER); $configLoader = (new Config())->createConfigFileManager($basePath, $_SERVER);
$configCache = new Cache(); $configCache = new Cache();
$configLoader->setupCache($configCache); $configLoader->setupCache($configCache);
$confBasepath = $configCache->get('system', 'basepath'); $confBasepath = $configCache->get('system', 'basepath');
$currBasepath = DI::config()->get('system', 'basepath'); $currBasepath = DI::config()->get('system', 'basepath');
@ -125,25 +128,31 @@ class Summary extends BaseAdmin
'from' => $currBasepath, 'from' => $currBasepath,
'to' => $confBasepath, 'to' => $confBasepath,
]); ]);
$warningtext[] = DI::l10n()->t('Friendica\'s system.basepath was updated from \'%s\' to \'%s\'. Please remove the system.basepath from your db to avoid differences.', $warningtext[] = DI::l10n()->t(
'Friendica\'s system.basepath was updated from \'%s\' to \'%s\'. Please remove the system.basepath from your db to avoid differences.',
$currBasepath, $currBasepath,
$confBasepath); $confBasepath
);
} elseif (!is_dir($currBasepath)) { } elseif (!is_dir($currBasepath)) {
DI::logger()->alert('Friendica\'s system.basepath is wrong.', [ DI::logger()->alert('Friendica\'s system.basepath is wrong.', [
'from' => $currBasepath, 'from' => $currBasepath,
'to' => $confBasepath, 'to' => $confBasepath,
]); ]);
$warningtext[] = DI::l10n()->t('Friendica\'s current system.basepath \'%s\' is wrong and the config file \'%s\' isn\'t used.', $warningtext[] = DI::l10n()->t(
'Friendica\'s current system.basepath \'%s\' is wrong and the config file \'%s\' isn\'t used.',
$currBasepath, $currBasepath,
$confBasepath); $confBasepath
);
} else { } else {
DI::logger()->alert('Friendica\'s system.basepath is wrong.', [ DI::logger()->alert('Friendica\'s system.basepath is wrong.', [
'from' => $currBasepath, 'from' => $currBasepath,
'to' => $confBasepath, 'to' => $confBasepath,
]); ]);
$warningtext[] = DI::l10n()->t('Friendica\'s current system.basepath \'%s\' is not equal to the config file \'%s\'. Please fix your configuration.', $warningtext[] = DI::l10n()->t(
'Friendica\'s current system.basepath \'%s\' is not equal to the config file \'%s\'. Please fix your configuration.',
$currBasepath, $currBasepath,
$confBasepath); $confBasepath
);
} }
} }