mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Revert "mend"
This reverts commit a0f42640cc10342f96effe4d08be188bb51bd0db.
This commit is contained in:
parent
96cebeede9
commit
9d1e556486
5 changed files with 43 additions and 78 deletions
0
app/tmp/cache/persistent/empty
vendored
Executable file
0
app/tmp/cache/persistent/empty
vendored
Executable file
|
@ -27,7 +27,6 @@
|
|||
if (!defined('E_DEPRECATED')) {
|
||||
define('E_DEPRECATED', 8192);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shell dispatcher
|
||||
*
|
||||
|
@ -403,7 +402,6 @@ class ShellDispatcher {
|
|||
$this->stderr($title . "\n" . $message . "\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get shell to use, either plugin shell or application shell
|
||||
*
|
||||
|
@ -608,56 +606,26 @@ class ShellDispatcher {
|
|||
$this->stdout("Example: -app relative/path/to/myapp or -app /absolute/path/to/myapp");
|
||||
|
||||
$this->stdout("\nAvailable Shells:");
|
||||
$shellList = array();
|
||||
$_shells = array();
|
||||
foreach ($this->shellPaths as $path) {
|
||||
if (!is_dir($path)) {
|
||||
continue;
|
||||
}
|
||||
if (is_dir($path)) {
|
||||
$shells = App::objects('file', $path);
|
||||
$path = str_replace(CAKE_CORE_INCLUDE_PATH . DS . 'cake' . DS, 'CORE' . DS, $path);
|
||||
$path = str_replace(APP, 'APP' . DS, $path);
|
||||
$path = str_replace(ROOT, 'ROOT', $path);
|
||||
$path = rtrim($path, DS);
|
||||
$this->stdout("\n " . $path . ":");
|
||||
if (empty($shells)) {
|
||||
continue;
|
||||
}
|
||||
if (preg_match('@plugins[\\\/]([^\\\/]*)@', $path, $matches)) {
|
||||
$type = Inflector::camelize($matches[1]);
|
||||
} elseif (preg_match('@([^\\\/]*)[\\\/]vendors[\\\/]@', $path, $matches)) {
|
||||
$type = $matches[1];
|
||||
} elseif (strpos($path, CAKE_CORE_INCLUDE_PATH . DS . 'cake') === 0) {
|
||||
$type = 'CORE';
|
||||
$this->stdout("\t - none");
|
||||
} else {
|
||||
$type = 'app';
|
||||
}
|
||||
sort($shells);
|
||||
foreach ($shells as $shell) {
|
||||
if ($shell !== 'shell.php') {
|
||||
$shell = str_replace('.php', '', $shell);
|
||||
$shellList[$shell][$type] = $type;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($shellList) {
|
||||
ksort($shellList);
|
||||
if (DS === '/') {
|
||||
$width = exec('tput cols') - 2;
|
||||
}
|
||||
if (empty($width)) {
|
||||
$width = 80;
|
||||
}
|
||||
$columns = max(1, floor($width / 30));
|
||||
$rows = ceil(count($shellList) / $columns);
|
||||
|
||||
foreach($shellList as $shell => $types) {
|
||||
sort($types);
|
||||
$shellList[$shell] = str_pad($shell . ' [' . implode ($types, ', ') . ']', $width / $columns);
|
||||
if ($shell !== 'shell.php') {
|
||||
$this->stdout("\t " . str_replace('.php', '', $shell));
|
||||
}
|
||||
$out = array_chunk($shellList, $rows);
|
||||
for($i = 0; $i < $rows; $i++) {
|
||||
$row = '';
|
||||
for($j = 0; $j < $columns; $j++) {
|
||||
if (!isset($out[$j][$i])) {
|
||||
continue;
|
||||
}
|
||||
$row .= $out[$j][$i];
|
||||
}
|
||||
$this->stdout(" " . $row);
|
||||
}
|
||||
}
|
||||
$this->stdout("\nTo run a command, type 'cake shell_name [args]'");
|
||||
|
|
|
@ -36,8 +36,8 @@ if (!class_exists('ShellDispatcher')) {
|
|||
ob_end_clean();
|
||||
}
|
||||
|
||||
require_once CONSOLE_LIBS . 'shell.php';
|
||||
|
||||
require_once CONSOLE_LIBS . 'shell.php';
|
||||
/**
|
||||
* TestShellDispatcher class
|
||||
*
|
||||
|
@ -85,7 +85,6 @@ class TestShellDispatcher extends ShellDispatcher {
|
|||
* @access public
|
||||
*/
|
||||
var $TestShell;
|
||||
|
||||
/**
|
||||
* _initEnvironment method
|
||||
*
|
||||
|
@ -139,7 +138,6 @@ class TestShellDispatcher extends ShellDispatcher {
|
|||
$this->stopped = 'Stopped with status: ' . $status;
|
||||
return $status;
|
||||
}
|
||||
|
||||
/**
|
||||
* getShell
|
||||
*
|
||||
|
@ -150,7 +148,6 @@ class TestShellDispatcher extends ShellDispatcher {
|
|||
function getShell($plugin = null) {
|
||||
return $this->_getShell($plugin);
|
||||
}
|
||||
|
||||
/**
|
||||
* _getShell
|
||||
*
|
||||
|
@ -442,6 +439,7 @@ class ShellDispatcherTest extends CakeTestCase {
|
|||
$Dispatcher->parseParams($params);
|
||||
$this->assertEqual($expected, $Dispatcher->params);
|
||||
|
||||
|
||||
$params = array(
|
||||
'cake.php',
|
||||
'-working',
|
||||
|
@ -512,7 +510,6 @@ class ShellDispatcherTest extends CakeTestCase {
|
|||
$result = $Dispatcher->getShell('test_plugin');
|
||||
$this->assertIsA($result, 'ExampleShell');
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify correct dispatch of Shell subclasses with a main method
|
||||
*
|
||||
|
@ -603,7 +600,6 @@ class ShellDispatcherTest extends CakeTestCase {
|
|||
$result = $Dispatcher->dispatch();
|
||||
$this->assertFalse($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify correct dispatch of Shell subclasses without a main method
|
||||
*
|
||||
|
@ -675,7 +671,6 @@ class ShellDispatcherTest extends CakeTestCase {
|
|||
$result = $Dispatcher->dispatch();
|
||||
$this->assertFalse($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify correct dispatch of custom classes with a main method
|
||||
*
|
||||
|
@ -755,7 +750,6 @@ class ShellDispatcherTest extends CakeTestCase {
|
|||
$result = $Dispatcher->dispatch();
|
||||
$this->assertFalse($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify correct dispatch of custom classes without a main method
|
||||
*
|
||||
|
@ -825,7 +819,6 @@ class ShellDispatcherTest extends CakeTestCase {
|
|||
$result = $Dispatcher->dispatch();
|
||||
$this->assertFalse($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify that a task is called instead of the shell if the first arg equals
|
||||
* the name of the task
|
||||
|
@ -874,7 +867,6 @@ class ShellDispatcherTest extends CakeTestCase {
|
|||
$result = $Dispatcher->dispatch();
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify shifting of arguments
|
||||
*
|
||||
|
@ -914,34 +906,39 @@ class ShellDispatcherTest extends CakeTestCase {
|
|||
function testHelpCommand() {
|
||||
$Dispatcher =& new TestShellDispatcher();
|
||||
|
||||
$expected = "/example \[.*TestPlugin, TestPluginTwo.*\]/";
|
||||
$expected = "/ CORE(\\\|\/)tests(\\\|\/)test_app(\\\|\/)plugins(\\\|\/)test_plugin(\\\|\/)vendors(\\\|\/)shells:";
|
||||
$expected .= "\n\t example";
|
||||
$expected .= "\n/";
|
||||
$this->assertPattern($expected, $Dispatcher->stdout);
|
||||
|
||||
$expected = "/welcome \[.*TestPluginTwo.*\]/";
|
||||
$expected = "/ CORE(\\\|\/)tests(\\\|\/)test_app(\\\|\/)plugins(\\\|\/)test_plugin_two(\\\|\/)vendors(\\\|\/)shells:";
|
||||
$expected .= "\n\t example";
|
||||
$expected .= "\n\t welcome";
|
||||
$expected .= "\n/";
|
||||
$this->assertPattern($expected, $Dispatcher->stdout);
|
||||
|
||||
$expected = "/acl \[.*CORE.*\]/";
|
||||
$expected = "/ APP(\\\|\/)vendors(\\\|\/)shells:";
|
||||
$expected .= "\n/";
|
||||
$this->assertPattern($expected, $Dispatcher->stdout);
|
||||
|
||||
$expected = "/api \[.*CORE.*\]/";
|
||||
$expected = "/ ROOT(\\\|\/)vendors(\\\|\/)shells:";
|
||||
$expected .= "\n/";
|
||||
$this->assertPattern($expected, $Dispatcher->stdout);
|
||||
|
||||
$expected = "/bake \[.*CORE.*\]/";
|
||||
$expected = "/ CORE(\\\|\/)console(\\\|\/)libs:";
|
||||
$expected .= "\n\t acl";
|
||||
$expected .= "\n\t api";
|
||||
$expected .= "\n\t bake";
|
||||
$expected .= "\n\t console";
|
||||
$expected .= "\n\t i18n";
|
||||
$expected .= "\n\t schema";
|
||||
$expected .= "\n\t testsuite";
|
||||
$expected .= "\n/";
|
||||
$this->assertPattern($expected, $Dispatcher->stdout);
|
||||
|
||||
$expected = "/console \[.*CORE.*\]/";
|
||||
$this->assertPattern($expected, $Dispatcher->stdout);
|
||||
|
||||
$expected = "/i18n \[.*CORE.*\]/";
|
||||
$this->assertPattern($expected, $Dispatcher->stdout);
|
||||
|
||||
$expected = "/schema \[.*CORE.*\]/";
|
||||
$this->assertPattern($expected, $Dispatcher->stdout);
|
||||
|
||||
$expected = "/testsuite \[.*CORE.*\]/";
|
||||
$this->assertPattern($expected, $Dispatcher->stdout);
|
||||
|
||||
$expected = "/sample \[.*test_app.*\]/";
|
||||
$expected = "/ CORE(\\\|\/)tests(\\\|\/)test_app(\\\|\/)vendors(\\\|\/)shells:";
|
||||
$expected .= "\n\t sample";
|
||||
$expected .= "\n/";
|
||||
$this->assertPattern($expected, $Dispatcher->stdout);
|
||||
}
|
||||
}
|
||||
|
|
0
vendors/css/empty
vendored
Normal file
0
vendors/css/empty
vendored
Normal file
0
vendors/js/empty
vendored
Normal file
0
vendors/js/empty
vendored
Normal file
Loading…
Reference in a new issue