Skip to content
Permalink
Browse files

Further optimizations to path scanning.

  • Loading branch information...
markstory committed Aug 30, 2009
1 parent ef23ecf commit 776992dc6ca3864c862beefe038d64dca289fe03
Showing with 20 additions and 12 deletions.
  1. +20 −12 cake/libs/view/view.php
@@ -850,12 +850,16 @@ function _getViewFileName($name = null) {
}
$paths = $this->_paths(Inflector::underscore($this->plugin));
foreach ($paths as $path) {
if (file_exists($path . $name . $this->ext)) {
return $path . $name . $this->ext;
} elseif ($this->ext != '.ctp' && file_exists($path . $name . '.ctp')) {
return $path . $name . '.ctp';
$exts = array($this->ext);
if ($this->ext !== '.ctp') {
array_push($exts, '.ctp');
}
foreach ($exts as $ext) {
foreach ($paths as $path) {
if (file_exists($path . $name . $ext)) {
return $path . $name . $ext;
}
}
}
$defaultPath = $paths[0];
@@ -889,12 +893,16 @@ function _getLayoutFileName($name = null) {
}
$paths = $this->_paths(Inflector::underscore($this->plugin));
$file = 'layouts' . DS . $subDir . $name;
foreach ($paths as $path) {
if (file_exists($path . $file . $this->ext)) {
return $path . $file . $this->ext;
} elseif (file_exists($path . $file . '.ctp')) {
return $path . $file . '.ctp';
$exts = array($this->ext);
if ($this->ext !== '.ctp') {
array_push($exts, '.ctp');
}
foreach ($exts as $ext) {
foreach ($paths as $path) {
if (file_exists($path . $file . $ext)) {
return $path . $file . $ext;
}
}
}
return $this->_missingView($paths[0] . $file . $this->ext, 'missingLayout');

0 comments on commit 776992d

Please sign in to comment.
You can’t perform that action at this time.