private static function setUpAutoLoader() { \Jackbooted\Util\AutoLoader::init(); \Jackbooted\Time\Stopwatch::init(); \Jackbooted\Util\ClassLocator::init(self::get('class_path')); }
public static function cleanup($numDays = 5) { $oneDay = 60 * 60 * 24; time() - $numDays * $oneDay; DB::exec(DB::DEF, 'DELETE FROM ' . self::$dao->tableName . ' WHERE fldTimeStamp<?', Stopwatch::timeToDB(time() - $numDays * $oneDay)); }
/** * This is the method that you call to locate the class. * @param string $className Name of the class that youb are trying to locate * @return string The name of the file that it is contained in otherwise FALSE */ public function getClassLocation($className) { if (!isset($this->locationArray)) { $this->loadArrayFromDisk(); } //echo '<pre>'; //print_r ( $this->locationArray ); //echo '<pre>'; // If the class location exists then send it back if (isset($this->locationArray[$className]) && file_exists($this->locationArray[$className])) { return $this->locationArray[$className]; } else { if (substr($className, 0, 1) == '\\') { $relativeClassName = substr($className, 1); if (isset($this->locationArray[$relativeClassName]) && file_exists($this->locationArray[$relativeClassName])) { return $this->locationArray[$relativeClassName]; } } } // If made it to here then regenerate the array $this->locationArray = []; $timer = new Stopwatch('ClassLocator Regen'); if (is_string($this->classesDir)) { $cDir = $this->classesDir; } else { if (is_array($this->classesDir)) { $cDir = join(', ', $this->classesDir); } } self::$log->info("Regenerating class locator array ({$cDir})"); if (is_string($this->classesDir)) { $this->regenerateLocationArray($this->classesDir); } else { if (is_array($this->classesDir)) { foreach ($this->classesDir as $dir) { $this->regenerateLocationArray($dir); } } } $this->saveLocationArray(); $timer->logLoadTime(); if (isset($this->locationArray[$className])) { return $this->locationArray[$className]; } self::$log->error("{$className} not found. Continual calls to this class will affect system performance"); return false; }