diff --git a/.travis.yml b/.travis.yml index 48b3383e2..834007621 100644 --- a/.travis.yml +++ b/.travis.yml @@ -111,7 +111,7 @@ before_script: }" > app/Config/database.php script: - - sh -c "if [ '$PHPCS' != '1' ]; then ./lib/Cake/Console/cake test core AllTests --stderr; else phpcs -p --extensions=php --standard=CakePHP ./lib/Cake; fi" + - sh -c "if [ '$PHPCS' = '1' ]; then phpcs -p --extensions=php --standard=CakePHP ./lib/Cake; elif [ '$DB' = 'mysql' ]; then ./lib/Cake/Console/cake test core AllTests --stderr; else ./lib/Cake/Console/cake test core AllDbRelated --stderr; fi" notifications: email: false diff --git a/lib/Cake/Cache/Engine/FileEngine.php b/lib/Cake/Cache/Engine/FileEngine.php index 9433dad4f..f3d84989d 100644 --- a/lib/Cake/Cache/Engine/FileEngine.php +++ b/lib/Cake/Cache/Engine/FileEngine.php @@ -223,6 +223,8 @@ class FileEngine extends CacheEngine { if (!$this->_init) { return false; } + $this->_File = null; + $threshold = $now = false; if ($check) { $now = time(); @@ -233,11 +235,17 @@ class FileEngine extends CacheEngine { $directory = new RecursiveDirectoryIterator($this->settings['path']); $contents = new RecursiveIteratorIterator($directory, RecursiveIteratorIterator::SELF_FIRST); + $cleared = array(); foreach ($contents as $path) { if ($path->isFile()) { continue; } - $this->_clearDirectory($path->getRealPath() . DS, $now, $threshold); + + $path = $path->getRealPath() . DS; + if (!in_array($path, $cleared)) { + $this->_clearDirectory($path, $now, $threshold); + $cleared[] = $path; + } } return true; } @@ -263,7 +271,7 @@ class FileEngine extends CacheEngine { continue; } $filePath = $path . $entry; - if (is_dir($filePath)) { + if (!file_exists($filePath) || is_dir($filePath)) { continue; } $file = new SplFileObject($path . $entry, 'r'); @@ -281,7 +289,9 @@ class FileEngine extends CacheEngine { } } if ($file->isFile()) { - unlink($file->getRealPath()); + $_path = $file->getRealPath(); + $file = null; + unlink($_path); } } } @@ -394,6 +404,7 @@ class FileEngine extends CacheEngine { * @return boolean success */ public function clearGroup($group) { + $this->_File = null; $directoryIterator = new RecursiveDirectoryIterator($this->settings['path']); $contents = new RecursiveIteratorIterator($directoryIterator, RecursiveIteratorIterator::CHILD_FIRST); foreach ($contents as $object) { @@ -403,7 +414,6 @@ class FileEngine extends CacheEngine { unlink($object->getPathName()); } } - $this->_File = null; return true; } } diff --git a/lib/Cake/Console/Command/BakeShell.php b/lib/Cake/Console/Command/BakeShell.php index f8bafb1dd..4c06c74f4 100644 --- a/lib/Cake/Console/Command/BakeShell.php +++ b/lib/Cake/Console/Command/BakeShell.php @@ -66,6 +66,9 @@ class BakeShell extends AppShell { $this->{$task}->connection = $this->params['connection']; } } + if (isset($this->params['connection'])) { + $this->connection = $this->params['connection']; + } } /** diff --git a/lib/Cake/Console/Command/ServerShell.php b/lib/Cake/Console/Command/ServerShell.php index b850a6d31..492b7d48b 100644 --- a/lib/Cake/Console/Command/ServerShell.php +++ b/lib/Cake/Console/Command/ServerShell.php @@ -129,8 +129,8 @@ class ServerShell extends AppShell { $command = sprintf("php -S %s:%d -t %s %s", $this->_host, $this->_port, - $this->_documentRoot, - $this->_documentRoot . '/index.php' + escapeshellarg($this->_documentRoot), + escapeshellarg($this->_documentRoot . '/index.php') ); $port = ($this->_port == self::DEFAULT_PORT) ? '' : ':' . $this->_port; diff --git a/lib/Cake/Console/ShellDispatcher.php b/lib/Cake/Console/ShellDispatcher.php index 2d50cd46d..4b99c5e6f 100644 --- a/lib/Cake/Console/ShellDispatcher.php +++ b/lib/Cake/Console/ShellDispatcher.php @@ -122,8 +122,10 @@ class ShellDispatcher { define('ROOT', $this->params['root']); define('APP_DIR', $this->params['app']); define('APP', $this->params['working'] . DS); - define('WWW_ROOT', APP . $this->params['webroot'] . DS); - if (!is_dir(ROOT . DS . APP_DIR . DS . 'tmp') && !defined('TMP')) { + if (!defined('WWW_ROOT')) { + define('WWW_ROOT', APP . $this->params['webroot'] . DS); + } + if (!defined('TMP') && !is_dir(APP . 'tmp')) { define('TMP', CAKE_CORE_INCLUDE_PATH . DS . 'Cake' . DS . 'Console' . DS . 'Templates' . DS . 'skel' . DS . 'tmp' . DS); } $boot = file_exists(ROOT . DS . APP_DIR . DS . 'Config' . DS . 'bootstrap.php'); diff --git a/lib/Cake/Console/Templates/skel/View/Pages/home.ctp b/lib/Cake/Console/Templates/skel/View/Pages/home.ctp index e6990b3a3..673bb4c49 100644 --- a/lib/Cake/Console/Templates/skel/View/Pages/home.ctp +++ b/lib/Cake/Console/Templates/skel/View/Pages/home.ctp @@ -198,7 +198,7 @@ You can also add some CSS styles for your pages at: APP/webroot/css.');