From e9cb0be0edd3b5c6ed8f5137dc72f0b5d12cfeac Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Mon, 28 Jan 2013 16:34:10 +0100 Subject: [PATCH] Fixed broken application installation Fixes #1114 --- .../lib/data/package/PackageEditor.class.php | 13 +++++++++++-- wcfsetup/install/files/lib/system/WCF.class.php | 17 ++++++++++++++++- 2 files changed, 27 insertions(+), 3 deletions(-) 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/'; -- 2.20.1