diff --git a/phpBB/adm/style/acp_main.html b/phpBB/adm/style/acp_main.html index 4718869d73..192d2e50f5 100644 --- a/phpBB/adm/style/acp_main.html +++ b/phpBB/adm/style/acp_main.html @@ -14,6 +14,22 @@

{L_ADMIN_INTRO}

+ +
+

{L_VERSIONCHECK_FAIL} - {L_VERSIONCHECK_FORCE_UPDATE} - {L_MORE}

+
+ + +
+

{L_VERSION_UP_TO_DATE_ACP} - {L_VERSIONCHECK_FORCE_UPDATE} - {L_MORE}

+
+ +
+

{L_VERSION_NOT_UP_TO_DATE_ACP} - {L_VERSIONCHECK_FORCE_UPDATE} - {L_MORE}

+
+ + +

{L_WARNING}

diff --git a/phpBB/adm/style/acp_update.html b/phpBB/adm/style/acp_update.html index e82aee0e87..34d4f6934e 100644 --- a/phpBB/adm/style/acp_update.html +++ b/phpBB/adm/style/acp_update.html @@ -10,11 +10,11 @@
-

{L_VERSION_UP_TO_DATE_ACP}

+

{L_VERSION_UP_TO_DATE_ACP} - {L_VERSIONCHECK_FORCE_UPDATE}

-

{L_VERSION_NOT_UP_TO_DATE_ACP}

+

{L_VERSION_NOT_UP_TO_DATE_ACP} - {L_VERSIONCHECK_FORCE_UPDATE}

diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 93cafef1bd..a9f68729e2 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -201,6 +201,7 @@
  • [Change] Add confirm-box when deleting permissions (Bug #13673 - Patch by nickvergessen)
  • [Change] Add pagination for icons and smilies in the ACP and smilies in the smiley popup
  • [Change] Cache get_username_string() function calls on viewtopic.
  • +
  • [Change] Cache version check.
  • [Feature] Add language selection on the registration terms page (Bug #15085 - Patch by leviatan21)
  • [Feature] Backported 3.2 captcha plugins.
  • +
  • [Feature] Display version check on ACP main page.
  • 1.ii. Changes since 3.0.4

    diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php index f9d611f8db..8a5918b558 100644 --- a/phpBB/includes/acp/acp_main.php +++ b/phpBB/includes/acp/acp_main.php @@ -395,6 +395,25 @@ class acp_main } } + // Version check + $user->add_lang('install'); + + $latest_version_info = false; + if (($latest_version_info = obtain_latest_version_info(request_var('versioncheck_force', false))) === false) + { + $template->assign_var('S_VERSIONCHECK_FAIL', true); + } + else + { + $latest_version_info = explode("\n", $latest_version_info); + $latest_version = trim($latest_version_info[0]); + $template->assign_var('S_VERSION_UP_TO_DATE', + version_compare( + str_replace('rc', 'RC', strtolower($config['version'])), + str_replace('rc', 'RC', strtolower($latest_version)), + '<') ? false : true); + } + // Get forum statistics $total_posts = $config['num_posts']; $total_topics = $config['num_topics']; @@ -492,6 +511,8 @@ class acp_main 'U_ACTION' => $this->u_action, 'U_ADMIN_LOG' => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=logs&mode=admin'), 'U_INACTIVE_USERS' => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=inactive&mode=list'), + 'U_VERSIONCHECK' => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=update&mode=version_check'), + 'U_VERSIONCHECK_FORCE' => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=1&versioncheck_force=1'), 'S_ACTION_OPTIONS' => ($auth->acl_get('a_board')) ? true : false, 'S_FOUNDER' => ($user->data['user_type'] == USER_FOUNDER) ? true : false, diff --git a/phpBB/includes/acp/acp_update.php b/phpBB/includes/acp/acp_update.php index dbb25bdbbd..121c72aeb3 100644 --- a/phpBB/includes/acp/acp_update.php +++ b/phpBB/includes/acp/acp_update.php @@ -37,12 +37,7 @@ class acp_update $errstr = ''; $errno = 0; - $info = get_remote_file('www.phpbb.com', '/updatecheck', ((defined('PHPBB_QA')) ? '30x_qa.txt' : '30x.txt'), $errstr, $errno); - - if ($info === false) - { - trigger_error($errstr, E_USER_WARNING); - } + $info = obtain_latest_version_info(request_var('versioncheck_force', false), true); $info = explode("\n", $info); $latest_version = trim($info[0]); @@ -68,6 +63,7 @@ class acp_update 'S_UP_TO_DATE_AUTO' => $up_to_date_automatic, 'S_VERSION_CHECK' => true, 'U_ACTION' => $this->u_action, + 'U_VERSIONCHECK_FORCE' => append_sid($this->u_action . '&versioncheck_force=1'), 'LATEST_VERSION' => $latest_version, 'CURRENT_VERSION' => $config['version'], diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 8fc895efdc..afd00f88bf 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -3054,4 +3054,43 @@ function add_permission_language() return true; } +/** + * Obtains the latest version information + * + * @param bool $force_update Ignores cached data. Defaults to false. + * @param bool $warn_fail Trigger a warning if obtaining the latest version information fails. Defaults to false. + * @param int $ttl Cache version information for $ttl seconds. Defaults to 86400 (24 hours). + * + * @return string | false Version info on success, false on failure. + */ +function obtain_latest_version_info($force_update = false, $warn_fail = false, $ttl = 86400) +{ + global $cache; + + $info = $cache->get('versioncheck'); + + if ($info === false || $force_update) + { + $errstr = ''; + $errno = 0; + + $info = get_remote_file('www.phpbb.com', '/updatecheck', + ((defined('PHPBB_QA')) ? '30x_qa.txt' : '30x.txt'), $errstr, $errno); + + if ($info === false) + { + $cache->destroy('versioncheck'); + if ($warn_fail) + { + trigger_error($errstr, E_USER_WARNING); + } + return false; + } + + $cache->put('versioncheck', $info, $ttl); + } + + return $info; +} + ?> \ No newline at end of file diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php index af0a61fd32..47ce59183f 100644 --- a/phpBB/language/en/acp/common.php +++ b/phpBB/language/en/acp/common.php @@ -249,6 +249,7 @@ $lang = array_merge($lang, array( 'MANAGE' => 'Manage', 'MENU_TOGGLE' => 'Hide or display the side menu', + 'MORE' => 'More »', 'MOVE_DOWN' => 'Move down', 'MOVE_UP' => 'Move up', @@ -374,9 +375,11 @@ $lang = array_merge($lang, array( 'UPLOAD_DIR_SIZE' => 'Size of posted attachments', 'USERS_PER_DAY' => 'Users per day', - 'VALUE' => 'Value', - 'VIEW_ADMIN_LOG' => 'View administrator log', - 'VIEW_INACTIVE_USERS' => 'View inactive users', + 'VALUE' => 'Value', + 'VERSIONCHECK_FAIL' => 'Failed to obtain latest version', + 'VERSIONCHECK_FORCE_UPDATE' => 'Re-Check version', + 'VIEW_ADMIN_LOG' => 'View administrator log', + 'VIEW_INACTIVE_USERS' => 'View inactive users', 'WELCOME_PHPBB' => 'Welcome to phpBB', 'WRITABLE_CONFIG' => 'Your config file (config.php) is currently world-writable. We strongly encourage you to change the permissions to 640 or at least to 644 (for example: chmod 640 config.php).',