From cdaefc3fd7f58cdabdd6bb7556ac8c66e2ed0d31 Mon Sep 17 00:00:00 2001 From: Mike Macgirvin Date: Sat, 3 Sep 2022 09:45:58 +1000 Subject: [PATCH] cleanup --- Code/Module/Admin.php | 11 +++++------ Code/Module/Admin/Dbsync.php | 13 ++----------- Code/Module/Admin/Logs.php | 14 +++++++------- include/network.php | 5 ++--- 4 files changed, 16 insertions(+), 27 deletions(-) diff --git a/Code/Module/Admin.php b/Code/Module/Admin.php index db5e203b9..181cb32ba 100644 --- a/Code/Module/Admin.php +++ b/Code/Module/Admin.php @@ -18,7 +18,7 @@ use Code\Lib\Navbar; use Code\Lib\Addon; use Code\Render\Theme; - + /** * @brief Admin area. * @@ -162,11 +162,10 @@ class Admin extends Controller $upgrade = EMPTY_STR; - if ((!defined('PLATFORM_ARCHITECTURE')) || (PLATFORM_ARCHITECTURE === 'zap')) { - $vrelease = get_repository_version('release'); - $vdev = get_repository_version('dev'); - $upgrade = ((version_compare(STD_VERSION, $vrelease) < 0) ? t('Your software should be updated') : ''); - } + + $vrelease = get_repository_version('release'); + $vdev = get_repository_version('dev'); + $upgrade = ((version_compare(STD_VERSION, $vrelease) < 0) ? t('Your software should be updated') : ''); $t = Theme::get_template('admin_summary.tpl'); return replace_macros($t, [ diff --git a/Code/Module/Admin/Dbsync.php b/Code/Module/Admin/Dbsync.php index a2d1dfea9..67ef0e35e 100644 --- a/Code/Module/Admin/Dbsync.php +++ b/Code/Module/Admin/Dbsync.php @@ -48,15 +48,6 @@ class Dbsync return $o; - - // remove the old style config if it exists - del_config('database', 'update_r' . intval(argv(3))); - set_config('database', '_' . intval(argv(3)), 'success'); - if (intval(get_config('system', 'db_version')) < intval(argv(3))) { - set_config('system', 'db_version', intval(argv(3))); - } - info(t('Update has been marked successful') . EOL); - goaway(z_root() . '/admin/dbsync'); } if (argc() > 2 && intval(argv(2))) { @@ -93,7 +84,7 @@ class Dbsync } } if (count($failed)) { - $o = replace_macros(Theme::get_template('failed_updates.tpl'), array( + $o = replace_macros(Theme::get_template('failed_updates.tpl'), [ '$base' => z_root(), '$banner' => t('Failed Updates'), '$desc' => '', @@ -101,7 +92,7 @@ class Dbsync '$verify' => t('Attempt to verify this update if a verification procedure exists'), '$apply' => t('Attempt to execute this update step automatically'), '$failed' => $failed - )); + ]); } else { return '

' . t('No failed updates.') . '

'; } diff --git a/Code/Module/Admin/Logs.php b/Code/Module/Admin/Logs.php index 329f4063f..108b555ae 100644 --- a/Code/Module/Admin/Logs.php +++ b/Code/Module/Admin/Logs.php @@ -41,13 +41,13 @@ class Logs public function get() { - $log_choices = array( + $log_choices = [ LOGGER_NORMAL => 'Normal', LOGGER_TRACE => 'Trace', LOGGER_DEBUG => 'Debug', LOGGER_DATA => 'Data', LOGGER_ALL => 'All' - ); + ]; $t = Theme::get_template('admin_logs.tpl'); @@ -81,7 +81,7 @@ class Logs } } - return replace_macros($t, array( + return replace_macros($t, [ '$title' => t('Administration'), '$page' => t('Logs'), '$submit' => t('Submit'), @@ -91,11 +91,11 @@ class Logs '$logname' => get_config('system', 'logfile'), // name, label, value, help string, extra data... - '$debugging' => array('debugging', t("Debugging"), get_config('system', 'debugging'), ""), - '$logfile' => array('logfile', t("Log file"), get_config('system', 'logfile'), t("Must be writable by web server. Relative to your top-level webserver directory.")), - '$loglevel' => array('loglevel', t("Log level"), get_config('system', 'loglevel'), "", $log_choices), + '$debugging' => ['debugging', t('Debugging'), get_config('system', 'debugging'), ""], + '$logfile' => ['logfile', t('Log file'), get_config('system', 'logfile'), t("Must be writable by web server. Relative to your top-level webserver directory.")], + '$loglevel' => ['loglevel', t('Log level'), get_config('system', 'loglevel'), "", $log_choices], '$form_security_token' => get_form_security_token('admin_logs'), - )); + ]); } } diff --git a/include/network.php b/include/network.php index d8d1a0bb8..9bad1da80 100644 --- a/include/network.php +++ b/include/network.php @@ -422,7 +422,7 @@ function xml2array($contents, $namespaces = true, $get_attributes = 1, $priority } libxml_clear_errors(); - return; + return []; } //Initializations @@ -1236,8 +1236,7 @@ function deliverable_singleton($channel_id, $xchan) function get_repository_version($branch = 'release') { - - $path = "https://raw.codeberg.page/streams/" . PLATFORM_NAME . "/@$branch/version.php"; + $path = 'https://raw.codeberg.page/streams/' . PLATFORM_NAME . "/@$branch/version.php"; $x = Url::get($path); if ($x['success']) {