/** * Get the locations of our class files for the autoloader */ function getFiles() { global $files; $files = array(); // Map files in reverse of this order $searchPaths = array('../Base/', '../Site/'); foreach ($searchPaths as $searchPath) { mapFiles(realpath($searchPath)); } }
/** * Get the locations of our class files for the autoloader * * @param bool Can use cache? * @param bool Clear the cache? */ function getFiles($useCache = true, $clearCache = false) { global $files; // Decide to use cache based upon what is passed in and our global define $useCache = $useCache && FILE_CACHING_ENABLED !== false; // If cache is enabled and we don't want to clear the cache, get the cached value if ($useCache == true && $clearCache == false) { $files = unserialize(apc_fetch('/tmp/indexFileMap')); } // If we don't have the array, map it and store it if cache is enabled if (!is_array($files) || count($files) == 0) { $files = array(); // Map files in reverse of this order $searchPaths = array('../Base/', '../Site/'); foreach ($searchPaths as $searchPath) { mapFiles(realpath($searchPath)); } if ($useCache === true) { apc_store('/tmp/indexFileMap', serialize($files), 86400); } } }