From: Alexander Ebert Date: Mon, 28 Jan 2013 15:34:10 +0000 (+0100) Subject: Fixed broken application installation X-Git-Tag: 2.0.0_Beta_1~531^2~5 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e9cb0be0edd3b5c6ed8f5137dc72f0b5d12cfeac;p=GitHub%2FWoltLab%2FWCF.git Fixed broken application installation Fixes #1114 --- diff --git a/wcfsetup/install/files/lib/data/package/PackageEditor.class.php b/wcfsetup/install/files/lib/data/package/PackageEditor.class.php index 78dc03e1e8..b1e2f09b83 100644 --- a/wcfsetup/install/files/lib/data/package/PackageEditor.class.php +++ b/wcfsetup/install/files/lib/data/package/PackageEditor.class.php @@ -1,20 +1,29 @@ * @package com.woltlab.wcf * @subpackage data.package * @category Community Framework */ -class PackageEditor extends DatabaseObjectEditor { +class PackageEditor extends DatabaseObjectEditor implements IEditableCachedObject { /** * @see wcf\data\DatabaseObjectDecorator::$baseClass */ protected static $baseClass = 'wcf\data\package\Package'; + + /** + * @see wcf\data\IEditableCachedObject::resetCache() + */ + public static function resetCache() { + CacheHandler::getInstance()->clear(WCF_DIR.'cache/', 'cache.package.php'); + } } diff --git a/wcfsetup/install/files/lib/system/WCF.class.php b/wcfsetup/install/files/lib/system/WCF.class.php index 03bad1d060..8b667e2eee 100644 --- a/wcfsetup/install/files/lib/system/WCF.class.php +++ b/wcfsetup/install/files/lib/system/WCF.class.php @@ -2,7 +2,9 @@ namespace wcf\system; use wcf\data\application\Application; use wcf\data\option\OptionEditor; +use wcf\data\package\Package; use wcf\data\package\PackageCache; +use wcf\data\package\PackageEditor; use wcf\system\application\ApplicationHandler; use wcf\system\cache\CacheHandler; use wcf\system\cronjob\CronjobScheduler; @@ -455,7 +457,20 @@ class WCF { protected function loadApplication(Application $application, $isDependentApplication = false) { $applicationObject = null; $package = PackageCache::getInstance()->getPackage($application->packageID); - + // package cache might be outdated + if ($package === null) { + $package = new Package($application->packageID); + + // package cache is outdated, discard cache + if ($package->packageID) { + PackageEditor::resetCache(); + } + else { + // package id is invalid + throw new SystemException("application identified by package id '".$application->packageID."' is unknown"); + } + } + $abbreviation = ApplicationHandler::getInstance()->getAbbreviation($application->packageID); $packageDir = FileUtil::getRealPath(WCF_DIR.$package->packageDir); self::$autoloadDirectories[$abbreviation] = $packageDir . 'lib/';