From e7a7e57ba608a6e4e690b18ea2baee680a82a2b4 Mon Sep 17 00:00:00 2001 From: mark_story Date: Tue, 6 Dec 2011 20:09:05 -0500 Subject: [PATCH] Fix bare require() to use App::uses() Fixes #2346 --- lib/Cake/Console/Command/Task/ProjectTask.php | 4 +--- lib/Cake/Core/Object.php | 4 +--- lib/Cake/Test/test_app/View/Posts/test_nocache_tags.ctp | 4 +--- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/lib/Cake/Console/Command/Task/ProjectTask.php b/lib/Cake/Console/Command/Task/ProjectTask.php index b4ea713d7f5..17c87be436f 100644 --- a/lib/Cake/Console/Command/Task/ProjectTask.php +++ b/lib/Cake/Console/Command/Task/ProjectTask.php @@ -288,9 +288,7 @@ public function securityCipherSeed($path) { $File = new File($path . 'Config' . DS . 'core.php'); $contents = $File->read(); if (preg_match('/([\s]*Configure::write\(\'Security.cipherSeed\',[\s\'A-z0-9]*\);)/', $contents, $match)) { - if (!class_exists('Security')) { - require CAKE . 'Utility' . DS . 'security.php'; - } + App::uses('Security', 'Utility'); $string = substr(bin2hex(Security::generateAuthKey()), 0, 30); $result = str_replace($match[0], "\t" . 'Configure::write(\'Security.cipherSeed\', \''.$string.'\');', $contents); if ($File->write($result)) { diff --git a/lib/Cake/Core/Object.php b/lib/Cake/Core/Object.php index 985dd43edaf..20d60884a28 100644 --- a/lib/Cake/Core/Object.php +++ b/lib/Cake/Core/Object.php @@ -152,9 +152,7 @@ protected function _stop($status = 0) { * @return boolean Success of log write */ public function log($msg, $type = LOG_ERROR) { - if (!class_exists('CakeLog')) { - require CAKE . 'cake_log.php'; - } + App::uses('CakeLog', 'Log'); if (!is_string($msg)) { $msg = print_r($msg, true); } diff --git a/lib/Cake/Test/test_app/View/Posts/test_nocache_tags.ctp b/lib/Cake/Test/test_app/View/Posts/test_nocache_tags.ctp index f4b3df9877b..d6e36365a65 100644 --- a/lib/Cake/Test/test_app/View/Posts/test_nocache_tags.ctp +++ b/lib/Cake/Test/test_app/View/Posts/test_nocache_tags.ctp @@ -75,9 +75,7 @@