From 9fc8a8989f6070a1bfd1cc724114e94b66884f50 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Sun, 14 Oct 2012 21:09:57 +0200 Subject: [PATCH] Applications now provide their own filesystem path Use IApplication::getPackageDir() to return the package directory, previously this was provided by APP_DIR (e.g. WBB_DIR). --- .../install/files/lib/system/WCF.class.php | 3 +++ .../application/AbstractApplication.class.php | 20 +++++++++++++++++++ .../system/application/IApplication.class.php | 14 +++++++++++++ 3 files changed, 37 insertions(+) diff --git a/wcfsetup/install/files/lib/system/WCF.class.php b/wcfsetup/install/files/lib/system/WCF.class.php index f79c0d3aab..439e7a176c 100644 --- a/wcfsetup/install/files/lib/system/WCF.class.php +++ b/wcfsetup/install/files/lib/system/WCF.class.php @@ -440,6 +440,9 @@ class WCF { if (!class_exists('wcf\system\WCFACP', false)) { call_user_func(array($className, 'getInstance')); } + + // set package dir + call_user_func(array($className, 'setPackageDir'), $packageDir); } else { unset(self::$autoloadDirectories[$abbreviation]); diff --git a/wcfsetup/install/files/lib/system/application/AbstractApplication.class.php b/wcfsetup/install/files/lib/system/application/AbstractApplication.class.php index dcb0e45ef5..4b403098e3 100644 --- a/wcfsetup/install/files/lib/system/application/AbstractApplication.class.php +++ b/wcfsetup/install/files/lib/system/application/AbstractApplication.class.php @@ -13,10 +13,30 @@ use wcf\system\SingletonFactory; * @category Community Framework */ abstract class AbstractApplication extends SingletonFactory implements IApplication { + /** + * application's package dir + * @var string + */ + protected static $packageDir = ''; + /** * @see wcf\system\application\IApplication::__callStatic() */ public static function __callStatic($method, array $arguments) { return call_user_func_array(array('wcf\system\WCF', $method), $arguments); } + + /** + * @see wcf\system\application\IApplication::setPackageDir() + */ + public static function setPackageDir($packageDir) { + self::$packageDir = $packageDir; + } + + /** + * @see wcf\system\application\IApplication::setPackageDir() + */ + public function getPackageDir() { + return self::$packageDir; + } } diff --git a/wcfsetup/install/files/lib/system/application/IApplication.class.php b/wcfsetup/install/files/lib/system/application/IApplication.class.php index 74f4d3537c..3270f8074c 100644 --- a/wcfsetup/install/files/lib/system/application/IApplication.class.php +++ b/wcfsetup/install/files/lib/system/application/IApplication.class.php @@ -20,4 +20,18 @@ interface IApplication { * @return mixed */ public static function __callStatic($method, array $arguments); + + /** + * Sets application's package dir. + * + * @param string $packageDir + */ + public static function setPackageDir($packageDir); + + /** + * Returns application's package dir. + * + * @return string + */ + public static function getPackageDir(); } -- 2.20.1