From: Alexander Ebert Date: Mon, 25 Nov 2013 17:07:52 +0000 (+0100) Subject: Manually searching for updates bypasses cache X-Git-Tag: 2.0.0_RC_3~8^2~2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=70e6f4e68ee52003a991a77c41aa3b629204eea1;p=GitHub%2FWoltLab%2FWCF.git Manually searching for updates bypasses cache --- 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 {