Resetting update cache once package lists have been updated
authorAlexander Ebert <ebert@woltlab.com>
Thu, 1 Aug 2013 15:55:17 +0000 (17:55 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Thu, 1 Aug 2013 15:55:17 +0000 (17:55 +0200)
wcfsetup/install/files/lib/system/package/PackageUpdateDispatcher.class.php

index 78a6bf825e193568344d9c1e42a25862e6358c7f..1af7d9cd053728fb6be8a64972959ed101b84b59 100644 (file)
@@ -7,6 +7,7 @@ use wcf\data\package\update\version\PackageUpdateVersionList;
 use wcf\data\package\update\PackageUpdateEditor;
 use wcf\data\package\update\PackageUpdateList;
 use wcf\data\package\Package;
+use wcf\system\cache\builder\PackageUpdateCacheBuilder;
 use wcf\system\database\util\PreparedStatementConditionBuilder;
 use wcf\system\exception\HTTPUnauthorizedException;
 use wcf\system\exception\SystemException;
@@ -38,10 +39,12 @@ class PackageUpdateDispatcher extends SingletonFactory {
                $updateServers = PackageUpdateServer::getActiveUpdateServers($packageUpdateServerIDs);
                
                // loop servers
+               $refreshedPackageLists = false;
                foreach ($updateServers as $updateServer) {
                        if ($updateServer->lastUpdateTime < TIME_NOW - 600) {
                                try {
                                        $this->getPackageUpdateXML($updateServer);
+                                       $refreshedPackageLists = true;
                                }
                                catch (SystemException $e) {
                                        // save error status
@@ -53,6 +56,10 @@ class PackageUpdateDispatcher extends SingletonFactory {
                                }
                        }
                }
+               
+               if ($refreshedPackageLists) {
+                       PackageUpdateCacheBuilder::getInstance()->reset();
+               }
        }
        
        /**