Applications now provide their own filesystem path
authorAlexander Ebert <ebert@woltlab.com>
Sun, 14 Oct 2012 19:09:57 +0000 (21:09 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Sun, 14 Oct 2012 19:09:57 +0000 (21:09 +0200)
Use IApplication::getPackageDir() to return the package directory, previously this was provided by APP_DIR (e.g. WBB_DIR).

wcfsetup/install/files/lib/system/WCF.class.php
wcfsetup/install/files/lib/system/application/AbstractApplication.class.php
wcfsetup/install/files/lib/system/application/IApplication.class.php

index f79c0d3aab4adfcd577e40656856c756c66d90ad..439e7a176cf76dd46080ae661b17b5dc362133f3 100644 (file)
@@ -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]);
index dcb0e45ef5e9e62902937babff2a3c0656769758..4b403098e384e067f5cd08d9e3a1eabdc8a28973 100644 (file)
@@ -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;
+       }
 }
index 74f4d3537ceda33fca408997570cef03504c0518..3270f8074cf93d27497d2a2ae7be4182d84976a0 100644 (file)
@@ -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();
 }