Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Update UpgradeShell for App classes.
Correctly move AppController and AppModel.
Fixes #2472
  • Loading branch information
markstory committed Jan 13, 2012
1 parent 4d73f4e commit b6040ae
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions lib/Cake/Console/Command/UpgradeShell.php
Expand Up @@ -169,7 +169,10 @@ public function locations() {
}
}
}

$this->_moveViewFiles();
$this->_moveAppClasses();

$sourceDirs = array(
'.' => array('recursive' => false),
'Console',
Expand Down Expand Up @@ -593,6 +596,35 @@ protected function _moveViewFiles() {
}
}

/**
* Move the AppController, and AppModel classes.
*
* @return void
*/
protected function _moveAppClasses() {
$files = array(
APP . 'app_controller.php' => APP . 'Controller' . DS . 'AppController.php',
APP . 'controllers' . DS .'app_controller.php' => APP . 'Controller' . DS . 'AppController.php',
APP . 'app_model.php' => APP . 'Model' . DS . 'AppModel.php',
APP . 'models' . DS . 'app_model.php' => APP . 'Model' . DS . 'AppModel.php',
);
foreach ($files as $old => $new) {
if (file_exists($old)) {
$this->out(__d('cake_console', 'Moving %s to %s', $old, $new));

if ($this->params['dry-run']) {
continue;
}
if ($this->params['git']) {
exec('git mv -f ' . escapeshellarg($old) . ' ' . escapeshellarg($old . '__'));
exec('git mv -f ' . escapeshellarg($old . '__') . ' ' . escapeshellarg($new));
} else {
rename($old, $new);
}
}
}
}

/**
* Move application php files to where they now should be
*
Expand Down

0 comments on commit b6040ae

Please sign in to comment.