Fix bare require() to use App::uses()

Fixes #2346
This commit is contained in:
mark_story 2011-12-06 20:09:05 -05:00
parent a44c4aa291
commit e7a7e57ba6
3 changed files with 3 additions and 9 deletions

View file

@ -288,9 +288,7 @@ class ProjectTask extends AppShell {
$File = new File($path . 'Config' . DS . 'core.php'); $File = new File($path . 'Config' . DS . 'core.php');
$contents = $File->read(); $contents = $File->read();
if (preg_match('/([\s]*Configure::write\(\'Security.cipherSeed\',[\s\'A-z0-9]*\);)/', $contents, $match)) { if (preg_match('/([\s]*Configure::write\(\'Security.cipherSeed\',[\s\'A-z0-9]*\);)/', $contents, $match)) {
if (!class_exists('Security')) { App::uses('Security', 'Utility');
require CAKE . 'Utility' . DS . 'security.php';
}
$string = substr(bin2hex(Security::generateAuthKey()), 0, 30); $string = substr(bin2hex(Security::generateAuthKey()), 0, 30);
$result = str_replace($match[0], "\t" . 'Configure::write(\'Security.cipherSeed\', \''.$string.'\');', $contents); $result = str_replace($match[0], "\t" . 'Configure::write(\'Security.cipherSeed\', \''.$string.'\');', $contents);
if ($File->write($result)) { if ($File->write($result)) {

View file

@ -152,9 +152,7 @@ class Object {
* @return boolean Success of log write * @return boolean Success of log write
*/ */
public function log($msg, $type = LOG_ERROR) { public function log($msg, $type = LOG_ERROR) {
if (!class_exists('CakeLog')) { App::uses('CakeLog', 'Log');
require CAKE . 'cake_log.php';
}
if (!is_string($msg)) { if (!is_string($msg)) {
$msg = print_r($msg, true); $msg = print_r($msg, true);
} }

View file

@ -75,9 +75,7 @@
</p> </p>
<?php <?php
if (!empty($filePresent)): if (!empty($filePresent)):
if (!class_exists('ConnectionManager')) { App::uses('ConnectionManager', 'Model');
require CAKE . 'model' . DS . 'connection_manager.php';
}
$connected = ConnectionManager::getDataSource('default'); $connected = ConnectionManager::getDataSource('default');
?> ?>
<p> <p>