From 70e6f4e68ee52003a991a77c41aa3b629204eea1 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Mon, 25 Nov 2013 18:07:52 +0100 Subject: [PATCH] Manually searching for updates bypasses cache --- wcfsetup/install/files/acp/js/WCF.ACP.js | 5 ++++- .../lib/data/package/update/PackageUpdateAction.class.php | 4 +++- .../lib/system/package/PackageUpdateDispatcher.class.php | 5 +++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/wcfsetup/install/files/acp/js/WCF.ACP.js b/wcfsetup/install/files/acp/js/WCF.ACP.js index 3e3c66e134..4d20332b15 100644 --- a/wcfsetup/install/files/acp/js/WCF.ACP.js +++ b/wcfsetup/install/files/acp/js/WCF.ACP.js @@ -1413,7 +1413,10 @@ WCF.ACP.Package.Update.Search = Class.extend({ autoSend: true, data: { actionName: 'searchForUpdates', - className: 'wcf\\data\\package\\update\\PackageUpdateAction' + className: 'wcf\\data\\package\\update\\PackageUpdateAction', + parameters: { + ignoreCache: 1 + } }, success: $.proxy(this._success, this) }); diff --git a/wcfsetup/install/files/lib/data/package/update/PackageUpdateAction.class.php b/wcfsetup/install/files/lib/data/package/update/PackageUpdateAction.class.php index ac6fa2cb5f..bfc03fd2a9 100644 --- a/wcfsetup/install/files/lib/data/package/update/PackageUpdateAction.class.php +++ b/wcfsetup/install/files/lib/data/package/update/PackageUpdateAction.class.php @@ -323,6 +323,8 @@ class PackageUpdateAction extends AbstractDatabaseObjectAction { */ public function validateSearchForUpdates() { WCF::getSession()->checkPermissions(array('admin.system.package.canUpdatePackage')); + + $this->readBoolean('ignoreCache', true); } /** @@ -331,7 +333,7 @@ class PackageUpdateAction extends AbstractDatabaseObjectAction { * @return array */ public function searchForUpdates() { - PackageUpdateDispatcher::getInstance()->refreshPackageDatabase(); + PackageUpdateDispatcher::getInstance()->refreshPackageDatabase(array(), $this->parameters['ignoreCache']); $updates = PackageUpdateDispatcher::getInstance()->getAvailableUpdates(); $url = ''; diff --git a/wcfsetup/install/files/lib/system/package/PackageUpdateDispatcher.class.php b/wcfsetup/install/files/lib/system/package/PackageUpdateDispatcher.class.php index 6a0ae154f1..fd6a7f3c23 100644 --- a/wcfsetup/install/files/lib/system/package/PackageUpdateDispatcher.class.php +++ b/wcfsetup/install/files/lib/system/package/PackageUpdateDispatcher.class.php @@ -33,15 +33,16 @@ class PackageUpdateDispatcher extends SingletonFactory { * Refreshes the package database. * * @param array $packageUpdateServerIDs + * @param boolean $ignoreCache */ - public function refreshPackageDatabase(array $packageUpdateServerIDs = array()) { + public function refreshPackageDatabase(array $packageUpdateServerIDs = array(), $ignoreCache = false) { // get update server data $updateServers = PackageUpdateServer::getActiveUpdateServers($packageUpdateServerIDs); // loop servers $refreshedPackageLists = false; foreach ($updateServers as $updateServer) { - if ($updateServer->lastUpdateTime < TIME_NOW - 600) { + if ($ignoreCache || $updateServer->lastUpdateTime < TIME_NOW - 600) { $errorMessage = ''; try { -- 2.20.1