Fixing greedy regexp in project task.

This commit is contained in:
mark_story 2011-02-23 11:26:43 -05:00
parent d4cdc118d2
commit 30c7b954ec

View file

@ -316,8 +316,8 @@ class ProjectTask extends Shell {
$path = (empty($this->configPath)) ? CONFIGS : $this->configPath;
$File = new File($path . 'core.php');
$contents = $File->read();
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 (preg_match('%(\s*[/]*Configure::write\(\'Routing.prefixes\',[\s\'a-z,\)\(]*\);)%', $contents, $match)) {
$result = str_replace($match[0], "\n" . 'Configure::write(\'Routing.prefixes\', array(\''.$name.'\'));', $contents);
if ($File->write($result)) {
Configure::write('Routing.prefixes', array($name));
return true;