mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Adding some more colour to the project task.
Making regular expressions easier to read.
This commit is contained in:
parent
53a1663b96
commit
db6149a5e8
1 changed files with 6 additions and 6 deletions
|
@ -200,7 +200,7 @@ class ProjectTask extends Shell {
|
|||
public function securitySalt($path) {
|
||||
$File =& new File($path . 'config' . DS . 'core.php');
|
||||
$contents = $File->read();
|
||||
if (preg_match('/([\\t\\x20]*Configure::write\\(\\\'Security.salt\\\',[\\t\\x20\'A-z0-9]*\\);)/', $contents, $match)) {
|
||||
if (preg_match('/([\s]*Configure::write\(\'Security.salt\',[\s\'A-z0-9]*\);)/', $contents, $match)) {
|
||||
if (!class_exists('Security')) {
|
||||
require LIBS . 'security.php';
|
||||
}
|
||||
|
@ -223,7 +223,7 @@ class ProjectTask extends Shell {
|
|||
public function securityCipherSeed($path) {
|
||||
$File =& new File($path . 'config' . DS . 'core.php');
|
||||
$contents = $File->read();
|
||||
if (preg_match('/([\\t\\x20]*Configure::write\\(\\\'Security.cipherSeed\\\',[\\t\\x20\'A-z0-9]*\\);)/', $contents, $match)) {
|
||||
if (preg_match('/([\s]*Configure::write\(\'Security.cipherSeed\',[\s\'A-z0-9]*\);)/', $contents, $match)) {
|
||||
if (!class_exists('Security')) {
|
||||
require LIBS . 'security.php';
|
||||
}
|
||||
|
@ -247,7 +247,7 @@ class ProjectTask extends Shell {
|
|||
if (dirname($path) !== CAKE_CORE_INCLUDE_PATH) {
|
||||
$File =& new File($path . 'webroot' . DS . 'index.php');
|
||||
$contents = $File->read();
|
||||
if (preg_match('/([\\t\\x20]*define\\(\\\'CAKE_CORE_INCLUDE_PATH\\\',[\\t\\x20\'A-z0-9]*\\);)/', $contents, $match)) {
|
||||
if (preg_match('/([\s]*define\(\'CAKE_CORE_INCLUDE_PATH\',[\s\'A-z0-9]*\);)/', $contents, $match)) {
|
||||
$root = strpos(CAKE_CORE_INCLUDE_PATH, '/') === 0 ? " DS . '" : "'";
|
||||
$result = str_replace($match[0], "\t\tdefine('CAKE_CORE_INCLUDE_PATH', " . $root . str_replace(DS, "' . DS . '", trim(CAKE_CORE_INCLUDE_PATH, DS)) . "');", $contents);
|
||||
if (!$File->write($result)) {
|
||||
|
@ -259,7 +259,7 @@ class ProjectTask extends Shell {
|
|||
|
||||
$File =& new File($path . 'webroot' . DS . 'test.php');
|
||||
$contents = $File->read();
|
||||
if (preg_match('/([\\t\\x20]*define\\(\\\'CAKE_CORE_INCLUDE_PATH\\\',[\\t\\x20\'A-z0-9]*\\);)/', $contents, $match)) {
|
||||
if (preg_match('/([\s]*define\(\'CAKE_CORE_INCLUDE_PATH\',[\s\'A-z0-9]*\);)/', $contents, $match)) {
|
||||
$result = str_replace($match[0], "\t\tdefine('CAKE_CORE_INCLUDE_PATH', " . $root . str_replace(DS, "' . DS . '", trim(CAKE_CORE_INCLUDE_PATH, DS)) . "');", $contents);
|
||||
if (!$File->write($result)) {
|
||||
return false;
|
||||
|
@ -281,7 +281,7 @@ class ProjectTask extends Shell {
|
|||
$path = (empty($this->configPath)) ? CONFIGS : $this->configPath;
|
||||
$File =& new File($path . 'core.php');
|
||||
$contents = $File->read();
|
||||
if (preg_match('%([/\\t\\x20]*Configure::write\(\'Routing.prefixes\',[\\t\\x20\'a-z,\)\(]*\\);)%', $contents, $match)) {
|
||||
if (preg_match('%([/\s]*Configure::write\(\'Routing.prefixes\',[\s\'a-z,\)\(]*\);)%', $contents, $match)) {
|
||||
$result = str_replace($match[0], "\t" . 'Configure::write(\'Routing.prefixes\', array(\''.$name.'\'));', $contents);
|
||||
if ($File->write($result)) {
|
||||
Configure::write('Routing.prefixes', array($name));
|
||||
|
@ -329,7 +329,7 @@ class ProjectTask extends Shell {
|
|||
$admin = $this->in(__('Enter a routing prefix:'), null, 'admin');
|
||||
}
|
||||
if ($this->cakeAdmin($admin) !== true) {
|
||||
$this->out(__('Unable to write to /app/config/core.php.'));
|
||||
$this->out(__('<error>Unable to write to</error> /app/config/core.php.'));
|
||||
$this->out('You need to enable Configure::write(\'Routing.prefixes\',array(\'admin\')) in /app/config/core.php to use prefix routing.');
|
||||
$this->_stop();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue