mirror of
https://github.com/friendica/friendica
synced 2025-04-27 02:30:10 +00:00
Fix code style
This commit is contained in:
parent
d4697a17a3
commit
0e59dba914
102 changed files with 3038 additions and 2764 deletions
|
@ -40,12 +40,12 @@ class Addon
|
|||
public static function getAvailableList(): array
|
||||
{
|
||||
$addons = [];
|
||||
$files = glob('addon/*/');
|
||||
$files = glob('addon/*/');
|
||||
if (is_array($files)) {
|
||||
foreach ($files as $file) {
|
||||
if (is_dir($file)) {
|
||||
list($tmp, $addon) = array_map('trim', explode('/', $file));
|
||||
$info = self::getInfo($addon);
|
||||
$info = self::getInfo($addon);
|
||||
|
||||
if (DI::config()->get('system', 'show_unsupported_addons')
|
||||
|| strtolower($info['status']) != 'unsupported'
|
||||
|
@ -70,7 +70,7 @@ class Addon
|
|||
public static function getAdminList(): array
|
||||
{
|
||||
$addons_admin = [];
|
||||
$addons = array_filter(DI::config()->get('addons') ?? []);
|
||||
$addons = array_filter(DI::config()->get('addons') ?? []);
|
||||
|
||||
ksort($addons);
|
||||
foreach ($addons as $name => $data) {
|
||||
|
@ -79,8 +79,8 @@ class Addon
|
|||
}
|
||||
|
||||
$addons_admin[$name] = [
|
||||
'url' => 'admin/addons/' . $name,
|
||||
'name' => $name,
|
||||
'url' => 'admin/addons/' . $name,
|
||||
'name' => $name,
|
||||
'class' => 'addon'
|
||||
];
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ class Addon
|
|||
|
||||
DI::config()->set('addons', $addon, [
|
||||
'last_update' => $t,
|
||||
'admin' => function_exists($addon . '_addon_admin'),
|
||||
'admin' => function_exists($addon . '_addon_admin'),
|
||||
]);
|
||||
|
||||
if (!self::isEnabled($addon)) {
|
||||
|
@ -182,7 +182,7 @@ class Addon
|
|||
$addons = array_filter(DI::config()->get('addons') ?? []);
|
||||
|
||||
foreach ($addons as $name => $data) {
|
||||
$addonname = Strings::sanitizeFilePathItem(trim($name));
|
||||
$addonname = Strings::sanitizeFilePathItem(trim($name));
|
||||
$addon_file_path = 'addon/' . $addonname . '/' . $addonname . '.php';
|
||||
if (file_exists($addon_file_path) && $data['last_update'] == filemtime($addon_file_path)) {
|
||||
// Addon unmodified, skipping
|
||||
|
@ -218,12 +218,12 @@ class Addon
|
|||
$addon = Strings::sanitizeFilePathItem($addon);
|
||||
|
||||
$info = [
|
||||
'name' => $addon,
|
||||
'name' => $addon,
|
||||
'description' => "",
|
||||
'author' => [],
|
||||
'maintainer' => [],
|
||||
'version' => "",
|
||||
'status' => ""
|
||||
'author' => [],
|
||||
'maintainer' => [],
|
||||
'version' => "",
|
||||
'status' => ""
|
||||
];
|
||||
|
||||
if (!is_file("addon/$addon/$addon.php")) {
|
||||
|
@ -247,7 +247,7 @@ class Addon
|
|||
}
|
||||
|
||||
list($type, $v) = $addon_info;
|
||||
$type = strtolower($type);
|
||||
$type = strtolower($type);
|
||||
if ($type == "author" || $type == "maintainer") {
|
||||
$r = preg_match("|([^<]+)<([^>]+)>|", $v, $m);
|
||||
if ($r) {
|
||||
|
@ -302,7 +302,7 @@ class Addon
|
|||
public static function getVisibleList(): array
|
||||
{
|
||||
$visible_addons = [];
|
||||
$addons = array_filter(DI::config()->get('addons') ?? []);
|
||||
$addons = array_filter(DI::config()->get('addons') ?? []);
|
||||
|
||||
foreach ($addons as $name => $data) {
|
||||
$visible_addons[] = $name;
|
||||
|
|
|
@ -57,7 +57,7 @@ class Protocol
|
|||
const XMPP = 'xmpp'; // XMPP
|
||||
const ZOT = 'zot!'; // Zot!
|
||||
|
||||
const PHANTOM = 'unkn'; // Place holder
|
||||
const PHANTOM = 'unkn'; // Place holder
|
||||
|
||||
/**
|
||||
* Returns whether the provided protocol supports following
|
||||
|
@ -74,7 +74,7 @@ class Protocol
|
|||
|
||||
$hook_data = [
|
||||
'protocol' => $protocol,
|
||||
'result' => null
|
||||
'result' => null
|
||||
];
|
||||
Hook::callAll('support_follow', $hook_data);
|
||||
|
||||
|
@ -96,7 +96,7 @@ class Protocol
|
|||
|
||||
$hook_data = [
|
||||
'protocol' => $protocol,
|
||||
'result' => null
|
||||
'result' => null
|
||||
];
|
||||
Hook::callAll('support_revoke_follow', $hook_data);
|
||||
|
||||
|
@ -242,8 +242,8 @@ class Protocol
|
|||
// Catch-all hook for connector addons
|
||||
$hook_data = [
|
||||
'contact' => $contact,
|
||||
'uid' => $uid,
|
||||
'result' => null,
|
||||
'uid' => $uid,
|
||||
'result' => null,
|
||||
];
|
||||
Hook::callAll('block', $hook_data);
|
||||
|
||||
|
@ -281,8 +281,8 @@ class Protocol
|
|||
// Catch-all hook for connector addons
|
||||
$hook_data = [
|
||||
'contact' => $contact,
|
||||
'uid' => $uid,
|
||||
'result' => null,
|
||||
'uid' => $uid,
|
||||
'result' => null,
|
||||
];
|
||||
Hook::callAll('unblock', $hook_data);
|
||||
|
||||
|
@ -309,7 +309,7 @@ class Protocol
|
|||
|
||||
$hook_data = [
|
||||
'protocol' => $protocol,
|
||||
'result' => null
|
||||
'result' => null
|
||||
];
|
||||
Hook::callAll('support_probe', $hook_data);
|
||||
|
||||
|
|
|
@ -117,15 +117,15 @@ class Search
|
|||
$results = json_decode($resultJson, true);
|
||||
|
||||
$resultList = new ResultList(
|
||||
($results['page'] ?? 0) ?: 1,
|
||||
$results['count'] ?? 0,
|
||||
($results['page'] ?? 0) ?: 1,
|
||||
$results['count'] ?? 0,
|
||||
($results['itemsperpage'] ?? 0) ?: 30
|
||||
);
|
||||
|
||||
$profiles = $results['profiles'] ?? [];
|
||||
|
||||
foreach ($profiles as $profile) {
|
||||
$profile_url = $profile['profile_url'] ?? '';
|
||||
$profile_url = $profile['profile_url'] ?? '';
|
||||
$contactDetails = Contact::getByURLForUser($profile_url, DI::userSession()->getLocalUserId());
|
||||
|
||||
$result = new ContactResult(
|
||||
|
@ -137,7 +137,7 @@ class Search
|
|||
Protocol::DFRN,
|
||||
$contactDetails['cid'] ?? 0,
|
||||
$contactDetails['zid'] ?? 0,
|
||||
$profile['tags'] ?? ''
|
||||
$profile['tags'] ?? ''
|
||||
);
|
||||
|
||||
$resultList->addResult($result);
|
||||
|
@ -231,7 +231,7 @@ class Search
|
|||
// Converting Directory Search results into contact-looking records
|
||||
$return = array_map(function ($result) {
|
||||
static $contactType = [
|
||||
'People' => Contact::TYPE_PERSON,
|
||||
'People' => Contact::TYPE_PERSON,
|
||||
// Kept for backward compatibility
|
||||
'Forum' => Contact::TYPE_COMMUNITY,
|
||||
'Group' => Contact::TYPE_COMMUNITY,
|
||||
|
|
|
@ -20,7 +20,7 @@ class Theme
|
|||
{
|
||||
$allowed_themes_str = DI::config()->get('system', 'allowed_themes');
|
||||
$allowed_themes_raw = explode(',', str_replace(' ', '', $allowed_themes_str));
|
||||
$allowed_themes = [];
|
||||
$allowed_themes = [];
|
||||
if (count($allowed_themes_raw)) {
|
||||
foreach ($allowed_themes_raw as $theme) {
|
||||
$theme = Strings::sanitizeFilePathItem(trim($theme));
|
||||
|
@ -58,14 +58,14 @@ class Theme
|
|||
$theme = Strings::sanitizeFilePathItem($theme);
|
||||
|
||||
$info = [
|
||||
'name' => $theme,
|
||||
'description' => "",
|
||||
'author' => [],
|
||||
'maintainer' => [],
|
||||
'version' => "",
|
||||
'credits' => "",
|
||||
'name' => $theme,
|
||||
'description' => "",
|
||||
'author' => [],
|
||||
'maintainer' => [],
|
||||
'version' => "",
|
||||
'credits' => "",
|
||||
'experimental' => file_exists("view/theme/$theme/experimental"),
|
||||
'unsupported' => file_exists("view/theme/$theme/unsupported")
|
||||
'unsupported' => file_exists("view/theme/$theme/unsupported")
|
||||
];
|
||||
|
||||
if (!is_file("view/theme/$theme/theme.php")) {
|
||||
|
@ -84,7 +84,7 @@ class Theme
|
|||
$comment_line = trim($comment_line, "\t\n\r */");
|
||||
if (strpos($comment_line, ':') !== false) {
|
||||
list($key, $value) = array_map("trim", explode(":", $comment_line, 2));
|
||||
$key = strtolower($key);
|
||||
$key = strtolower($key);
|
||||
if ($key == "author") {
|
||||
$result = preg_match("|([^<]+)<([^>]+)>|", $value, $matches);
|
||||
if ($result) {
|
||||
|
@ -153,7 +153,7 @@ class Theme
|
|||
}
|
||||
|
||||
$allowed_themes = Theme::getAllowedList();
|
||||
$key = array_search($theme, $allowed_themes);
|
||||
$key = array_search($theme, $allowed_themes);
|
||||
if ($key !== false) {
|
||||
unset($allowed_themes[$key]);
|
||||
Theme::setAllowedList($allowed_themes);
|
||||
|
@ -185,7 +185,7 @@ class Theme
|
|||
$func();
|
||||
}
|
||||
|
||||
$allowed_themes = Theme::getAllowedList();
|
||||
$allowed_themes = Theme::getAllowedList();
|
||||
$allowed_themes[] = $theme;
|
||||
Theme::setAllowedList($allowed_themes);
|
||||
|
||||
|
@ -267,7 +267,7 @@ class Theme
|
|||
{
|
||||
$theme = Strings::sanitizeFilePathItem($theme);
|
||||
|
||||
$appHelper = DI::appHelper();
|
||||
$appHelper = DI::appHelper();
|
||||
$base_theme = $appHelper->getThemeInfoValue('extends') ?? '';
|
||||
|
||||
if (file_exists("view/theme/$theme/config.php")) {
|
||||
|
|
|
@ -169,7 +169,7 @@ class Update
|
|||
if ($build != DB_UPDATE_VERSION || $force) {
|
||||
require_once 'update.php';
|
||||
|
||||
$stored = intval($build);
|
||||
$stored = intval($build);
|
||||
$current = intval(DB_UPDATE_VERSION);
|
||||
if ($stored < $current || $force) {
|
||||
DI::config()->reload();
|
||||
|
@ -203,8 +203,11 @@ class Update
|
|||
// run the pre_update_nnnn functions in update.php
|
||||
for ($version = $stored + 1; $version <= $current; $version++) {
|
||||
DI::logger()->notice('Execute pre update.', ['version' => $version]);
|
||||
DI::config()->set('system', 'maintenance_reason', DI::l10n()->t('%s: executing pre update %d',
|
||||
DateTimeFormat::utcNow() . ' ' . date('e'), $version));
|
||||
DI::config()->set('system', 'maintenance_reason', DI::l10n()->t(
|
||||
'%s: executing pre update %d',
|
||||
DateTimeFormat::utcNow() . ' ' . date('e'),
|
||||
$version
|
||||
));
|
||||
$r = self::runUpdateFunction($version, 'pre_update', $sendMail);
|
||||
if (!$r) {
|
||||
DI::logger()->warning('Pre update failed', ['version' => $version]);
|
||||
|
@ -245,8 +248,11 @@ class Update
|
|||
// run the update_nnnn functions in update.php
|
||||
for ($version = $stored + 1; $version <= $current; $version++) {
|
||||
DI::logger()->notice('Execute post update.', ['version' => $version]);
|
||||
DI::config()->set('system', 'maintenance_reason', DI::l10n()->t('%s: executing post update %d',
|
||||
DateTimeFormat::utcNow() . ' ' . date('e'), $version));
|
||||
DI::config()->set('system', 'maintenance_reason', DI::l10n()->t(
|
||||
'%s: executing post update %d',
|
||||
DateTimeFormat::utcNow() . ' ' . date('e'),
|
||||
$version
|
||||
));
|
||||
$r = self::runUpdateFunction($version, 'update', $sendMail);
|
||||
if (!$r) {
|
||||
DI::logger()->warning('Post update failed', ['version' => $version]);
|
||||
|
@ -359,13 +365,15 @@ class Update
|
|||
foreach($adminEmails as $admin) {
|
||||
$l10n = DI::l10n()->withLang($admin['language'] ?: 'en');
|
||||
|
||||
$preamble = Strings::deindent($l10n->t("
|
||||
$preamble = Strings::deindent($l10n->t(
|
||||
"
|
||||
The friendica developers released update %s recently,
|
||||
but when I tried to install it, something went terribly wrong.
|
||||
This needs to be fixed soon and I can't do it alone. Please contact a
|
||||
friendica developer if you can not help me on your own. My database might be invalid.",
|
||||
$update_id));
|
||||
$body = $l10n->t('The error message is\n[pre]%s[/pre]', $error_message);
|
||||
$update_id
|
||||
));
|
||||
$body = $l10n->t('The error message is\n[pre]%s[/pre]', $error_message);
|
||||
|
||||
$email = DI::emailer()
|
||||
->newSystemMail()
|
||||
|
@ -391,9 +399,12 @@ class Update
|
|||
foreach(User::getAdminListForEmailing(['uid', 'language', 'email']) as $admin) {
|
||||
$l10n = DI::l10n()->withLang($admin['language'] ?: 'en');
|
||||
|
||||
$preamble = Strings::deindent($l10n->t('
|
||||
$preamble = Strings::deindent($l10n->t(
|
||||
'
|
||||
The friendica database was successfully updated from %s to %s.',
|
||||
$from_build, $to_build));
|
||||
$from_build,
|
||||
$to_build
|
||||
));
|
||||
|
||||
$email = DI::emailer()
|
||||
->newSystemMail()
|
||||
|
|
|
@ -112,7 +112,10 @@ class Cron
|
|||
} 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"]]
|
||||
DBA::update(
|
||||
'workerqueue',
|
||||
['executed' => DBA::NULL_DATETIME, 'created' => DateTimeFormat::utcNow(), 'priority' => $new_priority, 'pid' => 0],
|
||||
['id' => $entry["id"]]
|
||||
);
|
||||
} else {
|
||||
DI::logger()->info('Process runtime is okay', ['duration' => number_format($duration, 3), 'max' => $max_duration, 'id' => $entry["id"], 'pid' => $entry["pid"], 'command' => $command]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue