protected function _base()
{
$dir = $webroot = null;
$config = Configure::read('App');
extract($config);
if (!isset($base)) {
$base = $this->base;
}
if ($base !== false) {
$this->webroot = $base . '/';
return $this->base = $base;
}
if (!$baseUrl) {
$base = dirname(env('PHP_SELF'));
// Clean up additional / which cause following code to fail..
$base = preg_replace('#/+#', '/', $base);
$indexPos = strpos($base, '/webroot/index.php');
if ($indexPos !== false) {
$base = substr($base, 0, $indexPos) . '/webroot';
}
if ($webroot === 'webroot' && $webroot === basename($base)) {
$base = dirname($base);
}
if ($dir === 'app' && $dir === basename($base)) {
$base = dirname($base);
}
if ($base === DS || $base === '.') {
$base = '';
}
$base = implode('/', array_map('rawurlencode', explode('/', $base)));
$this->webroot = $base . '/';
return $this->base = $base;
}
$file = '/' . basename($baseUrl);
$base = dirname($baseUrl);
if ($base === DS || $base === '.') {
$base = '';
}
$this->webroot = $base . '/';
$docRoot = env('DOCUMENT_ROOT');
$docRootContainsWebroot = strpos($docRoot, $dir . DS . $webroot);
// CUSTOMIZE MODIFY 2013/11/25 ryuring
// BC_DEPLOY_PATTERN が 2 の場合は、上位階層に、app/webroot/ という階層を持たない為、
// $this->webroot に、 app/webroot/ を付加しない
// >>>
//if (!empty($base) || !$docRootContainsWebroot) {
// ---
if ((!empty($base) || !$docRootContainsWebroot) && BC_DEPLOY_PATTERN != 2) {
// <<<
if (strpos($this->webroot, '/' . $dir . '/') === false) {
$this->webroot .= $dir . '/';
}
if (strpos($this->webroot, '/' . $webroot . '/') === false) {
$this->webroot .= $webroot . '/';
}
}
return $this->base = $base . $file;
}