Changeset 613
- Timestamp:
- 04/24/07 16:15:39 (1 year ago)
- Files:
-
- trunk/config/php/config-dist.php (modified) (6 diffs)
- trunk/config/php/config.php (modified) (6 diffs)
- trunk/src/main/php/net/stubbles/star/StarClassRegistry.php (modified) (5 diffs)
- trunk/src/main/php/net/stubbles/util/stubFactory.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/config/php/config-dist.php
r566 r613 5 5 class stubConfig 6 6 { 7 /** 8 * path to libary files 9 * 10 * @var string 11 */ 12 private static $libPath = null; 13 /** 14 * path to source files 15 * 16 * @var string 17 */ 18 private static $sourcePath = null; 19 /** 20 * path to log files 21 * 22 * @var string 23 */ 24 private static $logPath = null; 25 /** 26 * path to cache files 27 * 28 * @var string 29 */ 30 private static $cachePath = null; 31 /** 32 * path to config files 33 * 34 * @var string 35 */ 36 private static $configPath = null; 37 7 38 /** 8 39 * this method should return the path to the lib directory … … 14 45 public static function getLibPath() 15 46 { 16 return realpath(dirname(__FILE__) . '/../../lib'); 47 if (null == self::$libPath) { 48 self::$libPath = realpath(dirname(__FILE__) . '/../../lib'); 49 } 50 51 return self::$libPath; 17 52 } 18 53 … … 26 61 public static function getSourcePath() 27 62 { 28 return realpath(dirname(__FILE__) . '/../../src/main'); 63 if (null == self::$sourcePath) { 64 self::$sourcePath = realpath(dirname(__FILE__) . '/../../src/main'); 65 } 66 67 return self::$sourcePath; 29 68 } 30 69 … … 38 77 public static function getLogPath() 39 78 { 40 return realpath(dirname(__FILE__) . '/../../log'); 79 if (null == self::$logPath) { 80 self::$logPath = realpath(dirname(__FILE__) . '/../../log') . '/{Y}/{M}'; 81 } 82 83 return self::$logPath; 41 84 } 42 85 … … 50 93 public static function getCachePath() 51 94 { 52 return realpath(dirname(__FILE__) . '/../../cache'); 95 if (null == self::$cachePath) { 96 self::$cachePath = realpath(dirname(__FILE__) . '/../../cache'); 97 } 98 99 return self::$cachePath; 53 100 } 54 101 … … 62 109 public static function getConfigPath() 63 110 { 64 return realpath(dirname(__FILE__) . '/../'); 111 if (null == self::$configPath) { 112 self::$configPath = realpath(dirname(__FILE__) . '/../'); 113 } 114 115 return self::$configPath; 65 116 } 66 117 trunk/config/php/config.php
r573 r613 5 5 class stubConfig 6 6 { 7 /** 8 * path to libary files 9 * 10 * @var string 11 */ 12 private static $libPath = null; 13 /** 14 * path to source files 15 * 16 * @var string 17 */ 18 private static $sourcePath = null; 19 /** 20 * path to log files 21 * 22 * @var string 23 */ 24 private static $logPath = null; 25 /** 26 * path to cache files 27 * 28 * @var string 29 */ 30 private static $cachePath = null; 31 /** 32 * path to config files 33 * 34 * @var string 35 */ 36 private static $configPath = null; 37 7 38 /** 8 39 * this method should return the path to the lib directory … … 14 45 public static function getLibPath() 15 46 { 16 return realpath(dirname(__FILE__) . '/../../lib'); 47 if (null == self::$libPath) { 48 self::$libPath = realpath(dirname(__FILE__) . '/../../lib'); 49 } 50 51 return self::$libPath; 17 52 } 18 53 … … 26 61 public static function getSourcePath() 27 62 { 28 return realpath(dirname(__FILE__) . '/../../src/main'); 63 if (null == self::$sourcePath) { 64 self::$sourcePath = realpath(dirname(__FILE__) . '/../../src/main'); 65 } 66 67 return self::$sourcePath; 29 68 } 30 69 … … 38 77 public static function getLogPath() 39 78 { 40 return realpath(dirname(__FILE__) . '/../../log'); 79 if (null == self::$logPath) { 80 self::$logPath = realpath(dirname(__FILE__) . '/../../log'); 81 } 82 83 return self::$logPath; 41 84 } 42 85 … … 50 93 public static function getCachePath() 51 94 { 52 return realpath(dirname(__FILE__) . '/../../cache'); 95 if (null == self::$cachePath) { 96 self::$cachePath = realpath(dirname(__FILE__) . '/../../cache'); 97 } 98 99 return self::$cachePath; 53 100 } 54 101 … … 62 109 public static function getConfigPath() 63 110 { 64 return realpath(dirname(__FILE__) . '/../'); 111 if (null == self::$configPath) { 112 self::$configPath = realpath(dirname(__FILE__) . '/../'); 113 } 114 115 return self::$configPath; 65 116 } 66 117 trunk/src/main/php/net/stubbles/star/StarClassRegistry.php
r553 r613 48 48 { 49 49 self::$libPathes[$libPath] = $recursive; 50 self::$initDone = false;50 self::$initDone = false; 51 51 } 52 52 … … 59 59 public static function getFileForClass($fqClassName) 60 60 { 61 self::init(); 61 if (false === self::$initDone) { 62 self::init(); 63 } 64 62 65 if (isset(self::$classes[$fqClassName]) == true) { 63 66 return self::$classes[$fqClassName]; … … 75 78 public static function getUriForClass($fqClassName) 76 79 { 77 self::init(); 80 if (false === self::$initDone) { 81 self::init(); 82 } 83 78 84 if (isset(self::$classes[$fqClassName]) == true) { 79 85 return 'star://' . self::$classes[$fqClassName] . '?' . $fqClassName; … … 91 97 public static function getUrisForResource($resource) 92 98 { 93 self::init(); 99 if (false === self::$initDone) { 100 self::init(); 101 } 102 94 103 $uris = array(); 95 104 foreach (self::$files as $file => $contents) { … … 113 122 public static function getClassNamesFromFile($file) 114 123 { 115 self::init(); 124 if (false === self::$initDone) { 125 self::init(); 126 } 127 116 128 if (isset(self::$files[$file]) == true) { 117 129 return self::$files[$file]; trunk/src/main/php/net/stubbles/util/stubFactory.php
r475 r613 22 22 */ 23 23 private static $resourcePath = null; 24 /** 25 * switch whether to use star files or not 26 * 27 * @var bool 28 */ 29 private static $useStar = null; 24 30 25 31 /** … … 28 34 public static function __static() 29 35 { 30 if (basename(__FILE__) != __CLASS__ . '.php') { 31 self::$resourcePath = realpath(str_replace('star://', '', dirname(__FILE__)) . '/../src/main/resources') . DIRECTORY_SEPARATOR; 36 self::$resourcePath = stubConfig::getSourcePath() . DIRECTORY_SEPARATOR . 'resources' . DIRECTORY_SEPARATOR; 37 if (stubConfig::useStar() == true && class_exists('StarClassRegistry', false) == true) { 38 self::$useStar = true; 32 39 } else { 33 self::$ resourcePath = realpath(dirname(__FILE__) . '/../../../../resources') . DIRECTORY_SEPARATOR;40 self::$useStar = false; 34 41 } 35 42 } … … 43 50 public static function getResourceURIs($fileName) 44 51 { 45 if ( stubConfig::useStar() == true && class_exists('StarClassRegistry', false) == true) {52 if (true == self::$useStar) { 46 53 $uris = StarClassRegistry::getUrisForResource($fileName); 47 54 } else {
