本文整理汇总了PHP中Configure::buildPaths方法的典型用法代码示例。如果您正苦于以下问题:PHP Configure::buildPaths方法的具体用法?PHP Configure::buildPaths怎么用?PHP Configure::buildPaths使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Configure
的用法示例。
在下文中一共展示了Configure::buildPaths方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __bootstrap
/**
* Initializes the environment and loads the Cake core.
*
* @return boolean Success.
* @access private
*/
function __bootstrap()
{
define('ROOT', $this->params['root']);
define('APP_DIR', $this->params['app']);
define('APP_PATH', $this->params['working'] . DS);
define('WWW_ROOT', APP_PATH . $this->params['webroot'] . DS);
$includes = array(CORE_PATH . 'cake' . DS . 'config' . DS . 'paths.php', CORE_PATH . 'cake' . DS . 'libs' . DS . 'object.php', CORE_PATH . 'cake' . DS . 'libs' . DS . 'inflector.php', CORE_PATH . 'cake' . DS . 'libs' . DS . 'configure.php', CORE_PATH . 'cake' . DS . 'libs' . DS . 'file.php', CORE_PATH . 'cake' . DS . 'libs' . DS . 'cache.php', CORE_PATH . 'cake' . DS . 'libs' . DS . 'string.php', CORE_PATH . 'cake' . DS . 'libs' . DS . 'class_registry.php', CORE_PATH . 'cake' . DS . 'console' . DS . 'error.php');
foreach ($includes as $inc) {
if (!(require $inc)) {
$this->stderr("Failed to load Cake core file {$inc}");
return false;
}
}
Configure::getInstance(file_exists(CONFIGS . 'bootstrap.php'));
if (!file_exists(APP_PATH . 'config' . DS . 'core.php')) {
include_once CORE_PATH . 'cake' . DS . 'console' . DS . 'libs' . DS . 'templates' . DS . 'skel' . DS . 'config' . DS . 'core.php';
Configure::buildPaths(array());
}
Configure::write('debug', 1);
return true;
}
示例2: testBuildPaths
/**
* testBuildPaths method
*
* @access public
* @return void
*/
function testBuildPaths()
{
Configure::buildPaths(array());
$models = Configure::read('modelPaths');
$this->assertTrue(!empty($models));
}
示例3: __loadBootstrap
/**
* Loads app/config/bootstrap.php.
* If the alternative paths are set in this file
* they will be added to the paths vars.
*
* @param boolean $boot Load application bootstrap (if true)
* @return void
* @access private
*/
function __loadBootstrap($boot)
{
$modelPaths = $behaviorPaths = $controllerPaths = $componentPaths = $viewPaths = $helperPaths = $pluginPaths = $vendorPaths = $localePaths = $shellPaths = null;
if ($boot) {
Configure::write('App', array('base' => false, 'baseUrl' => false, 'dir' => APP_DIR, 'webroot' => WEBROOT_DIR));
if (!(include CONFIGS . 'core.php')) {
trigger_error(sprintf(__("Can't find application core file. Please create %score.php, and make sure it is readable by PHP.", true), CONFIGS), E_USER_ERROR);
}
if (!(include CONFIGS . 'bootstrap.php')) {
trigger_error(sprintf(__("Can't find application bootstrap file. Please create %sbootstrap.php, and make sure it is readable by PHP.", true), CONFIGS), E_USER_ERROR);
}
if (Configure::read('Cache.disable') !== true) {
$cache = Cache::config('default');
if (empty($cache['settings'])) {
trigger_error('Cache not configured properly. Please check Cache::config(); in APP/config/core.php', E_USER_WARNING);
$cache = Cache::config('default', array('engine' => 'File'));
}
$path = $prefix = $duration = null;
if (!empty($cache['settings']['path'])) {
$path = realpath($cache['settings']['path']);
} else {
$prefix = $cache['settings']['prefix'];
}
if (Configure::read() >= 1) {
$duration = '+10 seconds';
} else {
$duration = '+999 days';
}
if (Cache::config('_cake_core_') === false) {
Cache::config('_cake_core_', array_merge($cache['settings'], array('prefix' => $prefix . 'cake_core_', 'path' => $path . DS . 'persistent' . DS, 'serialize' => true, 'duration' => $duration)));
}
if (Cache::config('_cake_model_') === false) {
Cache::config('_cake_model_', array_merge($cache['settings'], array('prefix' => $prefix . 'cake_model_', 'path' => $path . DS . 'models' . DS, 'serialize' => true, 'duration' => $duration)));
}
Cache::config('default');
}
Configure::buildPaths(compact('modelPaths', 'viewPaths', 'controllerPaths', 'helperPaths', 'componentPaths', 'behaviorPaths', 'pluginPaths', 'vendorPaths', 'localePaths', 'shellPaths'));
}
}