From db6f2cec96962fdcce842e2fcd43ad7d3e4862b6 Mon Sep 17 00:00:00 2001 From: AD7six Date: Sun, 2 Aug 2009 23:26:15 +0200 Subject: [PATCH] Revert "Changing folder create logic to use Folder->tree" This reverts commit a60677070d41f3a1c7841e4ca24f6ee2658f3067. --- cake/console/libs/tasks/plugin.php | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/cake/console/libs/tasks/plugin.php b/cake/console/libs/tasks/plugin.php index c4dfd893a3e..5fcf45840ca 100644 --- a/cake/console/libs/tasks/plugin.php +++ b/cake/console/libs/tasks/plugin.php @@ -60,8 +60,8 @@ function initialize() { function execute() { if (empty($this->params['skel'])) { $this->params['skel'] = ''; - if (is_dir(CAKE . 'console' . DS . 'templates' . DS . 'skel') === true) { - $this->params['skel'] = CAKE . 'console' . DS . 'templates' . DS . 'skel'; + if (is_dir(CAKE_CORE_INCLUDE_PATH . DS . CAKE . 'console' . DS . 'templates' . DS . 'skel') === true) { + $this->params['skel'] = CAKE_CORE_INCLUDE_PATH . DS . CAKE . 'console' . DS . 'templates' . DS . 'skel'; } } $plugin = null; @@ -139,15 +139,20 @@ function bake($plugin) { if (strtolower($looksGood) == 'y') { $verbose = $this->in(__('Do you want verbose output?', true), array('y', 'n'), 'n'); - $skel = CAKE_CORE_INCLUDE_PATH . DS . 'cake' . DS . 'console' . DS . 'templates' . DS . 'skel'; + $skel = CAKE_CORE_INCLUDE_PATH . DS . dirname(CONSOLE_LIBS) . DS . 'templates' . DS . 'skel'; $Skel =& new Folder($skel); - $Folder =& new Folder($this->path . $pluginPath, true); - $dirs = array_reverse($Folder->tree($skel, array('plugin', 'tmp'), 'dir')); - foreach ($dirs as $dir) { - $dir = str_replace($skel, $this->path . $pluginPath, $dir); - if (!is_dir($dir)) { - new File($dir . DS . 'empty', true); + $Folder =& new Folder($this->path . $pluginPath); + $allFiles = $Skel->findRecursive(); + $directories = array(); + foreach($allFiles as $file) { + $dir = ltrim(str_replace($skel, '', dirname($file)), DS); + if (!$dir || preg_match('@^(tmp|plugins)@', $dir) || in_array($dir, $directories)) { + continue; } + $dirPath = $this->path . $pluginPath . DS . $dir; + $Folder->create($dirPath); + $File =& new File($dirPath . DS . 'empty', true); + $directories[] = $dir; } if (strtolower($verbose) == 'y') {