From 9b0cb851d67c52720839f6315b21773f5fd7930a Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Thu, 11 Jul 2013 11:33:58 -0400 Subject: [PATCH] renamed autoload to classmap. --- build/controllers/AutoloadController.php | 89 -------------------------------- build/controllers/ClassmapController.php | 89 ++++++++++++++++++++++++++++++++ framework/yii/classes.php | 2 +- 3 files changed, 90 insertions(+), 90 deletions(-) delete mode 100644 build/controllers/AutoloadController.php create mode 100644 build/controllers/ClassmapController.php diff --git a/build/controllers/AutoloadController.php b/build/controllers/AutoloadController.php deleted file mode 100644 index 08a81b3..0000000 --- a/build/controllers/AutoloadController.php +++ /dev/null @@ -1,89 +0,0 @@ - - * @since 2.0 - */ -class AutoloadController extends Controller -{ - public $defaultAction = 'create'; - - /** - * Creates a class map for the core Yii classes. - * @param string $root the root path of Yii framework. Defaults to YII_PATH. - * @param string $mapFile the file to contain the class map. Defaults to YII_PATH . '/classes.php'. - */ - public function actionCreate($root = null, $mapFile = null) - { - if ($root === null) { - $root = YII_PATH; - } - $root = FileHelper::normalizePath($root); - if ($mapFile === null) { - $mapFile = YII_PATH . '/classes.php'; - } - $options = array( - 'filter' => function($path) { - if (is_file($path)) { - $file = basename($path); - if ($file[0] < 'A' || $file[0] > 'Z') { - return false; - } - } - return null; - }, - 'only' => array('.php'), - 'except' => array( - 'Yii.php', - 'YiiBase.php', - '/debug/', - '/console/', - '/test/', - ), - ); - $files = FileHelper::findFiles($root, $options); - $map = array(); - foreach ($files as $file) { - if (($pos = strpos($file, $root)) !== 0) { - die("Something wrong: $file"); - } - $path = str_replace('\\', '/', substr($file, strlen($root))); - $map[] = "\t'yii" . substr(str_replace('/', '\\', $path), 0, -4) . "' => YII_PATH . '$path',"; - } - $map = implode("\n", $map); - $output = << + * @since 2.0 + */ +class ClassmapController extends Controller +{ + public $defaultAction = 'create'; + + /** + * Creates a class map for the core Yii classes. + * @param string $root the root path of Yii framework. Defaults to YII_PATH. + * @param string $mapFile the file to contain the class map. Defaults to YII_PATH . '/classes.php'. + */ + public function actionCreate($root = null, $mapFile = null) + { + if ($root === null) { + $root = YII_PATH; + } + $root = FileHelper::normalizePath($root); + if ($mapFile === null) { + $mapFile = YII_PATH . '/classes.php'; + } + $options = array( + 'filter' => function($path) { + if (is_file($path)) { + $file = basename($path); + if ($file[0] < 'A' || $file[0] > 'Z') { + return false; + } + } + return null; + }, + 'only' => array('.php'), + 'except' => array( + 'Yii.php', + 'YiiBase.php', + '/debug/', + '/console/', + '/test/', + ), + ); + $files = FileHelper::findFiles($root, $options); + $map = array(); + foreach ($files as $file) { + if (($pos = strpos($file, $root)) !== 0) { + die("Something wrong: $file"); + } + $path = str_replace('\\', '/', substr($file, strlen($root))); + $map[] = "\t'yii" . substr(str_replace('/', '\\', $path), 0, -4) . "' => YII_PATH . '$path',"; + } + $map = implode("\n", $map); + $output = <<