Skip to content

Commit

Permalink
Fix bare require() to use App::uses()
Browse files Browse the repository at this point in the history
Fixes #2346
  • Loading branch information
markstory committed Dec 7, 2011
1 parent a44c4aa commit e7a7e57
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 9 deletions.
4 changes: 1 addition & 3 deletions lib/Cake/Console/Command/Task/ProjectTask.php
Expand Up @@ -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)) {
Expand Down
4 changes: 1 addition & 3 deletions lib/Cake/Core/Object.php
Expand Up @@ -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);
}
Expand Down
4 changes: 1 addition & 3 deletions lib/Cake/Test/test_app/View/Posts/test_nocache_tags.ctp
Expand Up @@ -75,9 +75,7 @@
</p>
<?php
if (!empty($filePresent)):
if (!class_exists('ConnectionManager')) {
require CAKE . 'model' . DS . 'connection_manager.php';
}
App::uses('ConnectionManager', 'Model');
$connected = ConnectionManager::getDataSource('default');
?>
<p>
Expand Down

0 comments on commit e7a7e57

Please sign in to comment.