<?php
namespace wcf\acp\action;
use wcf\action\AbstractAction;
+use wcf\data\package\update\server\PackageUpdateServer;
use wcf\system\cache\CacheHandler;
use wcf\system\language\LanguageFactory;
use wcf\system\request\LinkHandler;
* Clears the cache.
*
* @author Tim Duesterhus
- * @copyright 2001-2017 WoltLab GmbH
+ * @copyright 2001-2018 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package WoltLabSuite\Core\Acp\Action
*/
// get package dirs
CacheHandler::getInstance()->flushAll();
+ // reset package update servers and the package cache
+ PackageUpdateServer::resetAll();
+
$this->executed();
if (!isset($_POST['noRedirect'])) {
<?php
namespace wcf\data\package\update\server;
use wcf\data\DatabaseObject;
+use wcf\system\cache\builder\PackageUpdateCacheBuilder;
use wcf\system\io\RemoteFile;
use wcf\system\Regex;
use wcf\system\WCF;
* Represents a package update server.
*
* @author Alexander Ebert
- * @copyright 2001-2017 WoltLab GmbH
+ * @copyright 2001-2018 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package WoltLabSuite\Core\Data\Package\Update\Server
*
public function isWoltLabStoreServer() {
return Url::parse($this->serverURL)['host'] === 'store.woltlab.com';
}
+
+ /**
+ * Resets all update servers into their original state and purges
+ * the package cache.
+ */
+ public static function resetAll() {
+ // purge package cache
+ WCF::getDB()->prepareStatement("DELETE FROM wcf".WCF_N."_package_update")->execute();
+
+ PackageUpdateCacheBuilder::getInstance()->reset();
+
+ // reset servers into their original state
+ $sql = "UPDATE wcf".WCF_N."_package_update_server
+ SET lastUpdateTime = ?,
+ status = ?,
+ errorMessage = ?,
+ apiVersion = ?,
+ metaData = ?";
+ $statement = WCF::getDB()->prepareStatement($sql);
+ $statement->execute([
+ 0,
+ 'online',
+ '',
+ '2.0',
+ null
+ ]);
+ }
}