Skip to content

Commit

Permalink
Dont lie when not modifying bootstrap
Browse files Browse the repository at this point in the history
  • Loading branch information
dereuromark committed Nov 27, 2016
1 parent 27dc4bf commit 5a26e4c
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/Shell/Task/UnloadTask.php
Expand Up @@ -66,12 +66,16 @@ protected function _modifyBootstrap($plugin)
$finder = "@\nPlugin::load\((.|.\n|\n\s\s|\n\t|)+'$plugin'(.|.\n|)+\);\n@";

$bootstrap = new File($this->bootstrap, false);
$contents = $bootstrap->read();
$content = $bootstrap->read();

if (!preg_match("@\n\s*Plugin::loadAll@", $contents)) {
$contents = preg_replace($finder, "", $contents);
if (!preg_match("@\n\s*Plugin::loadAll@", $content)) {
$newContent = preg_replace($finder, "", $content);

$bootstrap->write($contents);
if ($newContent === $content) {
return false;
}

$bootstrap->write($newContent);

$this->out('');
$this->out(sprintf('%s modified', $this->bootstrap));
Expand Down

0 comments on commit 5a26e4c

Please sign in to comment.