From 65684cdefdbe745594a0e4502dd283c0aaa054d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Renan=20Gonc=CC=A7alves?= Date: Tue, 6 Nov 2012 01:11:01 +0100 Subject: [PATCH] Changing references from core.php to new config files. --- App/View/Pages/home.ctp | 4 +- index.php | 4 +- lib/Cake/Console/Command/BakeShell.php | 2 +- .../Console/Command/Task/DbConfigTask.php | 8 +- .../Templates/skel/View/Pages/home.ctp | 4 +- .../Controller/Component/AclComponent.php | 4 +- lib/Cake/Error/ErrorHandler.php | 4 +- lib/Cake/Error/ExceptionRenderer.php | 2 +- .../MissingDatasourceConfigException.php | 2 +- lib/Cake/Model/Model.php | 4 +- lib/Cake/Test/TestApp/View/Pages/home.ctp | 98 +++++++++++++------ .../TestApp/View/Posts/test_nocache_tags.ctp | 10 +- .../Console/Command/Task/ExtractTaskTest.php | 23 +++-- .../Console/Command/Task/ProjectTaskTest.php | 2 +- .../TestCase/Error/ExceptionRendererTest.php | 2 +- lib/Cake/View/Errors/missing_database.ctp | 2 +- .../View/Errors/missing_datasource_config.ctp | 2 +- 17 files changed, 110 insertions(+), 67 deletions(-) diff --git a/App/View/Pages/home.ctp b/App/View/Pages/home.ctp index 7a184523dd9..9dca51aa074 100644 --- a/App/View/Pages/home.ctp +++ b/App/View/Pages/home.ctp @@ -85,7 +85,7 @@ endif; $settings = Cache::settings('_cake_model_'); if (!empty($settings)): echo ''; - echo __d('cake_dev', 'The %s is being used for core caching. To change the config edit APP/Config/cache.php ', ''. $settings['engine'] . 'Engine'); + echo __d('cake_dev', 'The %s is being used for core caching. To change the config edit APP/Config/cache.php', ''. $settings['engine'] . 'Engine'); echo ''; else: echo ''; @@ -104,7 +104,7 @@ endif; echo ''; else: echo ''; - echo __d('cake_dev', 'Your datasouces configuration file is NOT present.'); + echo __d('cake_dev', 'Your datasources configuration file is NOT present.'); echo '
'; echo __d('cake_dev', 'Rename APP/Config/datasources.default.php to APP/Config/datasources.php'); echo '
'; diff --git a/index.php b/index.php index 6c71a20ba50..43e92a25ed2 100644 --- a/index.php +++ b/index.php @@ -4,8 +4,8 @@ * * This file collects requests if: * - no mod_rewrite is available or .htaccess files are not supported - * - requires App.baseUrl to be uncommented in app/Config/core.php - * - app/webroot is not set as a document root. + * - requires App.baseUrl to be uncommented in App/Config/app.php + * - App/webroot is not set as a document root. * * PHP 5 * diff --git a/lib/Cake/Console/Command/BakeShell.php b/lib/Cake/Console/Command/BakeShell.php index a733ba75963..42753fef68a 100644 --- a/lib/Cake/Console/Command/BakeShell.php +++ b/lib/Cake/Console/Command/BakeShell.php @@ -216,7 +216,7 @@ public function getOptionParser() { 'help' => __d('cake_console', 'Bake a new plugin folder in the path supplied or in current directory if no path is specified.'), 'parser' => $this->Plugin->getOptionParser() ))->addSubcommand('db_config', array( - 'help' => __d('cake_console', 'Bake a database.php file in config directory.'), + 'help' => __d('cake_console', 'Bake a datasources.php file in config directory.'), 'parser' => $this->DbConfig->getOptionParser() ))->addSubcommand('model', array( 'help' => __d('cake_console', 'Bake a model.'), diff --git a/lib/Cake/Console/Command/Task/DbConfigTask.php b/lib/Cake/Console/Command/Task/DbConfigTask.php index b1e8aec1f4f..379df77888c 100644 --- a/lib/Cake/Console/Command/Task/DbConfigTask.php +++ b/lib/Cake/Console/Command/Task/DbConfigTask.php @@ -1,6 +1,6 @@ path . 'database.php'; + $filename = $this->path . 'datasources.php'; $oldConfigs = array(); if (file_exists($filename)) { @@ -344,7 +344,7 @@ public function bake($configs) { } $out .= "}\n"; - $filename = $this->path . 'database.php'; + $filename = $this->path . 'datasources.php'; return $this->createFile($filename, $out); } diff --git a/lib/Cake/Console/Templates/skel/View/Pages/home.ctp b/lib/Cake/Console/Templates/skel/View/Pages/home.ctp index 7a184523dd9..9dca51aa074 100644 --- a/lib/Cake/Console/Templates/skel/View/Pages/home.ctp +++ b/lib/Cake/Console/Templates/skel/View/Pages/home.ctp @@ -85,7 +85,7 @@ endif; $settings = Cache::settings('_cake_model_'); if (!empty($settings)): echo ''; - echo __d('cake_dev', 'The %s is being used for core caching. To change the config edit APP/Config/cache.php ', ''. $settings['engine'] . 'Engine'); + echo __d('cake_dev', 'The %s is being used for core caching. To change the config edit APP/Config/cache.php', ''. $settings['engine'] . 'Engine'); echo ''; else: echo ''; @@ -104,7 +104,7 @@ endif; echo ''; else: echo ''; - echo __d('cake_dev', 'Your datasouces configuration file is NOT present.'); + echo __d('cake_dev', 'Your datasources configuration file is NOT present.'); echo '
'; echo __d('cake_dev', 'Rename APP/Config/datasources.default.php to APP/Config/datasources.php'); echo '
'; diff --git a/lib/Cake/Controller/Component/AclComponent.php b/lib/Cake/Controller/Component/AclComponent.php index 0fdee029b5f..ad01a67b6df 100644 --- a/lib/Cake/Controller/Component/AclComponent.php +++ b/lib/Cake/Controller/Component/AclComponent.php @@ -29,8 +29,8 @@ * Access Control List factory class. * * Uses a strategy pattern to allow custom ACL implementations to be used with the same component interface. - * You can define by changing `Configure::write('Acl.classname', 'DbAcl');` in your core.php. Concrete ACL - * implementations should extend `AclBase` and implement the methods it defines. + * You can define by changing `Configure::write('Acl.classname', 'DbAcl');` in your App/Config/acl.php. + * Concrete ACL implementations should extend `AclBase` and implement the methods it defines. * * @package Cake.Controller.Component * @link http://book.cakephp.org/2.0/en/core-libraries/components/access-control-lists.html diff --git a/lib/Cake/Error/ErrorHandler.php b/lib/Cake/Error/ErrorHandler.php index 2bb19a7db05..c5e4652116f 100644 --- a/lib/Cake/Error/ErrorHandler.php +++ b/lib/Cake/Error/ErrorHandler.php @@ -68,7 +68,7 @@ * #### Logging exceptions * * Using the built-in exception handling, you can log all the exceptions - * that are dealt with by ErrorHandler by setting `Exception.log` to true in your core.php. + * that are dealt with by ErrorHandler by setting `Exception.log` to true in your App/Config/error.php. * Enabling this will log every exception to Log and the configured loggers. * * ### PHP errors @@ -76,7 +76,7 @@ * Error handler also provides the built in features for handling php errors (trigger_error). * While in debug mode, errors will be output to the screen using debugger. While in production mode, * errors will be logged to Log. You can control which errors are logged by setting - * `Error.level` in your core.php. + * `Error.level` in your App/Config/error.php. * * #### Logging errors * diff --git a/lib/Cake/Error/ExceptionRenderer.php b/lib/Cake/Error/ExceptionRenderer.php index b8753fbf00f..158dc64460c 100644 --- a/lib/Cake/Error/ExceptionRenderer.php +++ b/lib/Cake/Error/ExceptionRenderer.php @@ -54,7 +54,7 @@ * #### Using a subclass of ExceptionRenderer * * Using a subclass of ExceptionRenderer gives you full control over how Exceptions are rendered, you - * can configure your class in your core.php, with `Configure::write('Exception.renderer', 'MyClass');` + * can configure your class in your App/Config/error.php, with `Configure::write('Exception.renderer', 'MyClass');` * You should place any custom exception renderers in `app/Lib/Error`. * * @package Cake.Error diff --git a/lib/Cake/Error/MissingDatasourceConfigException.php b/lib/Cake/Error/MissingDatasourceConfigException.php index 44504e52034..15616b945a5 100644 --- a/lib/Cake/Error/MissingDatasourceConfigException.php +++ b/lib/Cake/Error/MissingDatasourceConfigException.php @@ -25,6 +25,6 @@ */ class MissingDatasourceConfigException extends Exception { - protected $_messageTemplate = 'The datasource configuration "%s" was not found in database.php'; + protected $_messageTemplate = 'The datasource configuration "%s" was not found in datasources.php'; } diff --git a/lib/Cake/Model/Model.php b/lib/Cake/Model/Model.php index 0896330c811..3945116a70c 100644 --- a/lib/Cake/Model/Model.php +++ b/lib/Cake/Model/Model.php @@ -52,7 +52,7 @@ class Model extends Object implements EventListener { /** * The name of the DataSource connection that this Model uses * - * The value must be an attribute name that you defined in `app/Config/database.php` + * The value must be an attribute name that you defined in `App/Config/datasources.php` * or created using `ConnectionManager::create()`. * * @var string @@ -3187,7 +3187,7 @@ public function getAffectedRows() { /** * Sets the DataSource to which this model is bound. * - * @param string $dataSource The name of the DataSource, as defined in app/Config/database.php + * @param string $dataSource The name of the DataSource, as defined in App/Config/datasources.php * @return void * @throws MissingConnectionException */ diff --git a/lib/Cake/Test/TestApp/View/Pages/home.ctp b/lib/Cake/Test/TestApp/View/Pages/home.ctp index 147d6b4957e..1d87b1f792d 100644 --- a/lib/Cake/Test/TestApp/View/Pages/home.ctp +++ b/lib/Cake/Test/TestApp/View/Pages/home.ctp @@ -15,14 +15,58 @@ * @since CakePHP(tm) v 0.10.0.1076 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ -use Cake\Routing\Dispatcher, - Cake\Cache\Cache, - Cake\Model\ConnectionManager, - Cake\Utility\Validation, - Cake\Core\Configure; +use Cake\Core\Configure; +use Cake\Utility\Debugger; +use Cake\Cache\Cache; +use Cake\Model\ConnectionManager; +use Cake\Utility\Validation; +use Cake\Error; + +if (Configure::read('debug') == 0): + throw new Error\NotFoundException(); +endif; ?> +

- + + 0): + // Debugger::checkSecurityKeys(); +endif; +?> +

+ + 1) Help me configure it + 2) I don't / can't use URL rewriting +

+

+=')): + echo ''; + echo __d('cake_dev', 'Your version of PHP is 5.4.3 or higher.'); + echo ''; + else: + echo ''; + echo __d('cake_dev', 'Your version of PHP is too low. You need PHP 5.4.3 or higher to use CakePHP.'); + echo ''; + endif; +?> +

+

+'; + echo __d('cake_dev', 'Your version of PHP has mbstring extension loaded.'); + echo ''; + else: + echo ''; + echo __d('cake_dev', 'Your version of PHP does NOT have the mbstring extension loaded.'); + echo ''; + endif; +?> +

'; - echo __d('cake_dev', 'The %s is being used for caching. To change the config edit APP/config/core.php ', ''. $settings['engine'] . 'Engine'); + echo __d('cake_dev', 'The %s is being used for core caching. To change the config edit APP/Config/cache.php', ''. $settings['engine'] . 'Engine'); echo ''; else: echo ''; - echo __d('cake_dev', 'Your cache is NOT working. Please check the settings in APP/config/core.php'); + echo __d('cake_dev', 'Your cache is NOT working. Please check the settings in APP/Config/cache.php'); echo ''; endif; ?> @@ -53,16 +97,16 @@ use Cake\Routing\Dispatcher,

'; - echo __d('cake_dev', 'Your database configuration file is present.'); + echo __d('cake_dev', 'Your datasources configuration file is present.'); $filePresent = true; echo ''; else: echo ''; - echo __d('cake_dev', 'Your database configuration file is NOT present.'); + echo __d('cake_dev', 'Your datasources configuration file is NOT present.'); echo '
'; - echo __d('cake_dev', 'Rename config/database.php.default to config/database.php'); + echo __d('cake_dev', 'Rename APP/Config/datasources.default.php to APP/Config/datasources.php'); echo '
'; endif; ?> @@ -71,7 +115,7 @@ use Cake\Routing\Dispatcher, if (isset($filePresent)): try { $connected = ConnectionManager::getDataSource('default'); - } catch (Exception $e) { + } catch (Exception $connectionError) { $connected = false; } ?> @@ -84,6 +128,8 @@ if (isset($filePresent)): else: echo ''; echo __d('cake_dev', 'Cake is NOT able to connect to the database.'); + echo '

'; + echo $connectionError->getMessage(); echo '
'; endif; ?> @@ -92,17 +138,17 @@ if (isset($filePresent)): '; - __('PCRE has not been compiled with Unicode support.'); - echo '
'; - __('Recompile PCRE with Unicode support by adding --enable-unicode-properties when configuring'); + echo __d('cake_dev', 'PCRE has not been compiled with Unicode support.'); + echo '
'; + echo __d('cake_dev', 'Recompile PCRE with Unicode support by adding --enable-unicode-properties when configuring'); echo '

'; } ?>

-To change its layout, create: APP/views/layouts/default.ctp.
+echo __d('cake_dev', 'To change the content of this page, edit: APP/View/Pages/home.ctp.
+To change its layout, edit: APP/View/Layouts/default.ctp.
You can also add some CSS styles for your pages at: APP/webroot/css.'); ?>

@@ -111,8 +157,8 @@ You can also add some CSS styles for your pages at: APP/webroot/css.');

Html->link( - sprintf('%s %s', __d('cake_dev', 'New'), __d('cake_dev', 'CakePHP 1.3 Docs')), - 'http://book.cakephp.org/view/875/x1-3-Collection', + sprintf('%s %s', __d('cake_dev', 'New'), __d('cake_dev', 'CakePHP 2.0 Docs')), + 'http://book.cakephp.org/2.0/en/', array('target' => '_blank', 'escape' => false) ); ?> @@ -121,7 +167,7 @@ You can also add some CSS styles for your pages at: APP/webroot/css.'); Html->link( __d('cake_dev', 'The 15 min Blog Tutorial'), - 'http://book.cakephp.org/view/1528/Blog', + 'http://book.cakephp.org/2.0/en/tutorials-and-examples/blog/blog.html', array('target' => '_blank', 'escape' => false) ); ?> @@ -142,7 +188,7 @@ You can also add some CSS styles for your pages at: APP/webroot/css.');

  • -
  • +
  • @@ -156,10 +202,4 @@ You can also add some CSS styles for your pages at: APP/webroot/css.');
  • -
  • -
  • -
  • -
  • -
  • -
  • diff --git a/lib/Cake/Test/TestApp/View/Posts/test_nocache_tags.ctp b/lib/Cake/Test/TestApp/View/Posts/test_nocache_tags.ctp index 5d172744706..5cf108c536c 100644 --- a/lib/Cake/Test/TestApp/View/Posts/test_nocache_tags.ctp +++ b/lib/Cake/Test/TestApp/View/Posts/test_nocache_tags.ctp @@ -41,7 +41,7 @@ use Cake\Core\Configure; echo __d('cake', 'set up and initialized properly.'); $settings = Cache::settings(); echo '

    ' . $settings['engine']; - echo __d('cake', ' is being used to cache, to change this edit config/core.php '); + echo __d('cake', ' is being used to cache, to change this edit App/Config/cache.php '); echo '

    '; echo 'Settings: