mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Changing folder create logic to use Folder->tree
This commit is contained in:
parent
189480e499
commit
38e48e5f7f
1 changed files with 9 additions and 14 deletions
|
@ -60,8 +60,8 @@ class PluginTask extends Shell {
|
||||||
function execute() {
|
function execute() {
|
||||||
if (empty($this->params['skel'])) {
|
if (empty($this->params['skel'])) {
|
||||||
$this->params['skel'] = '';
|
$this->params['skel'] = '';
|
||||||
if (is_dir(CAKE_CORE_INCLUDE_PATH . DS . CAKE . 'console' . DS . 'templates' . DS . 'skel') === true) {
|
if (is_dir(CAKE . 'console' . DS . 'templates' . DS . 'skel') === true) {
|
||||||
$this->params['skel'] = CAKE_CORE_INCLUDE_PATH . DS . CAKE . 'console' . DS . 'templates' . DS . 'skel';
|
$this->params['skel'] = CAKE . 'console' . DS . 'templates' . DS . 'skel';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$plugin = null;
|
$plugin = null;
|
||||||
|
@ -139,20 +139,15 @@ class PluginTask extends Shell {
|
||||||
if (strtolower($looksGood) == 'y') {
|
if (strtolower($looksGood) == 'y') {
|
||||||
$verbose = $this->in(__('Do you want verbose output?', true), array('y', 'n'), 'n');
|
$verbose = $this->in(__('Do you want verbose output?', true), array('y', 'n'), 'n');
|
||||||
|
|
||||||
$skel = CAKE_CORE_INCLUDE_PATH . DS . dirname(CONSOLE_LIBS) . DS . 'templates' . DS . 'skel';
|
$skel = CAKE_CORE_INCLUDE_PATH . DS . 'cake' . DS . 'console' . DS . 'templates' . DS . 'skel';
|
||||||
$Skel =& new Folder($skel);
|
$Skel =& new Folder($skel);
|
||||||
$Folder =& new Folder($this->path . $pluginPath);
|
$Folder =& new Folder($this->path . $pluginPath, true);
|
||||||
$allFiles = $Skel->findRecursive();
|
$dirs = array_reverse($Folder->tree($skel, array('plugin', 'tmp'), 'dir'));
|
||||||
$directories = array();
|
foreach ($dirs as $dir) {
|
||||||
foreach($allFiles as $file) {
|
$dir = str_replace($skel, $this->path . $pluginPath, $dir);
|
||||||
$dir = ltrim(str_replace($skel, '', dirname($file)), DS);
|
if (!is_dir($dir)) {
|
||||||
if (!$dir || preg_match('@^(tmp|plugins)@', $dir) || in_array($dir, $directories)) {
|
new File($dir . DS . 'empty', true);
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
$dirPath = $this->path . $pluginPath . DS . $dir;
|
|
||||||
$Folder->create($dirPath);
|
|
||||||
$File =& new File($dirPath . DS . 'empty', true);
|
|
||||||
$directories[] = $dir;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strtolower($verbose) == 'y') {
|
if (strtolower($verbose) == 'y') {
|
||||||
|
|
Loading…
Reference in a new issue