From ae9a3ef479316ac4f00c9f7a3462f25e3fe95c23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Armando?= Date: Sat, 2 Jul 2011 17:49:29 +0200 Subject: [PATCH] Update component task, make components extend Component instead of Object. --- lib/Cake/Console/Command/UpgradeShell.php | 27 +++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/lib/Cake/Console/Command/UpgradeShell.php b/lib/Cake/Console/Command/UpgradeShell.php index 1ff68b3aa..c9d650e35 100644 --- a/lib/Cake/Console/Command/UpgradeShell.php +++ b/lib/Cake/Console/Command/UpgradeShell.php @@ -421,6 +421,29 @@ class UpgradeShell extends Shell { $this->_filesRegexpUpdate($patterns); } +/** + * Update components. + * + * - Make components that extend Object to extend Component. + * + * @return void + */ + public function components() { + $this->_paths = App::Path('Controller/Component'); + if (!empty($this->params['plugin'])) { + $this->_paths = App::Path('Controller/Component', $this->params['plugin']); + } + $patterns = array( + array( + '*Component extents Object to *Component extends Component', + '/([a-zA-Z]*Component extends) Object/', + '\1 Component' + ), + ); + + $this->_filesRegexpUpdate($patterns); + } + /** * Move application php files to where they now should be * @@ -636,6 +659,10 @@ class UpgradeShell extends Shell { ->addSubcommand('constants', array( 'help' => "Replace Obsolete constants", 'parser' => $subcommandParser + )) + ->addSubcommand('components', array( + 'help' => 'Update components to extend Component class.', + 'parser' => $subcommandParser )); } }