Skip to content

Commit

Permalink
Merge master in 1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
gwoo committed Mar 19, 2009
1 parent 6cb8b3d commit 643651f
Show file tree
Hide file tree
Showing 250 changed files with 2,585 additions and 2,015 deletions.
2 changes: 1 addition & 1 deletion cake/VERSION.txt
Expand Up @@ -6,4 +6,4 @@
// +---------------------------------------------------------------------------------------------------+ //
///////////////////////////////////////////////////////////////////////////////////////////////////////////

1.2.1.8004
1.2.2.8120
14 changes: 10 additions & 4 deletions cake/console/cake.php
Expand Up @@ -198,10 +198,14 @@ function _initEnvironment() {
*/
function __buildPaths() {
$paths = array();

$pluginPaths = Configure::read('pluginPaths');
if (!class_exists('Folder')) {
require LIBS . 'folder.php';
}

foreach ($pluginPaths as $pluginPath) {
$plugins = Configure::listObjects('plugin', $pluginPath);
$Folder =& new Folder($pluginPath);
list($plugins,) = $Folder->read(false, true);
foreach ((array)$plugins as $plugin) {
$path = $pluginPath . Inflector::underscore($plugin) . DS . 'vendors' . DS . 'shells' . DS;
if (file_exists($path)) {
Expand Down Expand Up @@ -262,7 +266,6 @@ function __bootstrap() {
Configure::write('debug', 1);
return true;
}

/**
* Dispatches a CLI request
*
Expand Down Expand Up @@ -542,16 +545,19 @@ function help() {

$this->stdout("\nAvailable Shells:");
$_shells = array();

foreach ($this->shellPaths as $path) {
if (is_dir($path)) {
$shells = Configure::listObjects('file', $path);
$path = str_replace(CORE_PATH, 'CORE/', $path);
$path = str_replace(CAKE_CORE_INCLUDE_PATH . DS . 'cake' . DS, 'CORE' . DS, $path);
$path = str_replace(APP, 'APP' . DS, $path);
$path = str_replace(ROOT, 'ROOT', $path);
$path = rtrim($path, DS);
$this->stdout("\n " . $path . ":");
if (empty($shells)) {
$this->stdout("\t - none");
} else {
sort($shells);
foreach ($shells as $shell) {
if ($shell !== 'shell.php') {
$this->stdout("\t " . str_replace('.php', '', $shell));
Expand Down
2 changes: 1 addition & 1 deletion cake/console/libs/acl.php
Expand Up @@ -36,7 +36,7 @@ class AclShell extends Shell {
/**
* Contains instance of AclComponent
*
* @var object
* @var AclComponent
* @access public
*/
var $Acl;
Expand Down
4 changes: 2 additions & 2 deletions cake/console/libs/shell.php
Expand Up @@ -34,7 +34,7 @@ class Shell extends Object {
/**
* An instance of the ShellDispatcher object that loaded this script
*
* @var object
* @var ShellDispatcher
* @access public
*/
var $Dispatch = null;
Expand All @@ -49,7 +49,7 @@ class Shell extends Object {
* Holds the DATABASE_CONFIG object for the app. Null if database.php could not be found,
* or the app does not exist.
*
* @var object
* @var DATABASE_CONFIG
* @access public
*/
var $DbConfig = null;
Expand Down
2 changes: 1 addition & 1 deletion cake/console/libs/tasks/extract.php
Expand Up @@ -135,7 +135,7 @@ function execute() {
} else {
$response = '';
while ($response == '') {
$response = $this->in("What is the full path you would like to extract?\nExample: " . $this->params['root'] . DS . "myapp\n[Q]uit", null, 'Q');
$response = $this->in("What is the full path you would like to extract?\nExample: " . $this->params['root'] . DS . "myapp\n[Q]uit", null, $this->params['working']);
if (strtoupper($response) === 'Q') {
$this->out('Extract Aborted');
$this->_stop();
Expand Down
2 changes: 1 addition & 1 deletion cake/libs/cache.php
Expand Up @@ -33,7 +33,7 @@ class Cache extends Object {
/**
* Cache engine to use
*
* @var object
* @var CacheEngine
* @access protected
*/
var $_Engine = null;
Expand Down
2 changes: 1 addition & 1 deletion cake/libs/cache/file.php
Expand Up @@ -34,7 +34,7 @@ class FileEngine extends CacheEngine {
/**
* Instance of File class
*
* @var object
* @var File
* @access private
*/
var $__File = null;
Expand Down
2 changes: 1 addition & 1 deletion cake/libs/cache/memcache.php
Expand Up @@ -33,7 +33,7 @@ class MemcacheEngine extends CacheEngine {
/**
* Memcache wrapper.
*
* @var object
* @var Memcache
* @access private
*/
var $__Memcache = null;
Expand Down
26 changes: 26 additions & 0 deletions cake/libs/controller/controller.php
Expand Up @@ -291,6 +291,32 @@ class Controller extends Object {
* @link
*/
var $methods = array();
/**
* This controller's primary model class name, the Inflector::classify()'ed version of
* the controller's $name property.
*
* Example: For a controller named 'Comments', the modelClass would be 'Comment'
*
* @var string
* @access public
*/
var $modelClass = null;
/**
* This controller's model key name, an underscored version of the controller's $modelClass property.
*
* Example: For a controller named 'ArticleComments', the modelKey would be 'article_comment'
*
* @var string
* @access public
*/
var $modelKey = null;
/**
* Holds any validation errors produced by the last call of the validateErrors() method/
*
* @var array Validation errors, or false if none
* @access public
*/
var $validationErrors = null;
/**
* Constructor.
*
Expand Down
2 changes: 1 addition & 1 deletion cake/libs/controller/scaffold.php
Expand Up @@ -39,7 +39,7 @@ class Scaffold extends Object {
/**
* Controller object
*
* @var object
* @var Controller
* @access public
*/
var $controller = null;
Expand Down
2 changes: 1 addition & 1 deletion cake/libs/error.php
Expand Up @@ -70,7 +70,7 @@ class ErrorHandler extends Object {
/**
* Controller instance.
*
* @var object
* @var Controller
* @access public
*/
var $controller = null;
Expand Down
4 changes: 2 additions & 2 deletions cake/libs/file.php
Expand Up @@ -42,7 +42,7 @@ class File extends Object {
/**
* Folder object of the File
*
* @var object
* @var Folder
* @access public
*/
var $Folder = null;
Expand Down Expand Up @@ -376,7 +376,7 @@ function md5($maxsize = 5) {
}
/**
* Returns the full path of the File.
*
*
* @return string Full path to file
* @access public
*/
Expand Down
5 changes: 3 additions & 2 deletions cake/libs/folder.php
Expand Up @@ -212,17 +212,18 @@ function findRecursive($pattern = '.*', $sort = false) {
*/
function _findRecursive($pattern, $sort = false) {
list($dirs, $files) = $this->read($sort);

$found = array();

foreach ($files as $file) {
if (preg_match('/^' . $pattern . '$/i', $file)) {
$found[] = Folder::addPathElement($this->path, $file);
}
}
$start = $this->path;

foreach ($dirs as $dir) {
$this->cd(Folder::addPathElement($start, $dir));
$found = array_merge($found, $this->findRecursive($pattern));
$found = array_merge($found, $this->findRecursive($pattern, $sort));
}
return $found;
}
Expand Down
2 changes: 1 addition & 1 deletion cake/libs/i18n.php
Expand Up @@ -40,7 +40,7 @@ class I18n extends Object {
/**
* Instance of the I10n class for localization
*
* @var object
* @var I10n
* @access public
*/
var $l10n = null;
Expand Down
4 changes: 2 additions & 2 deletions cake/libs/model/behavior.php
Expand Up @@ -205,11 +205,11 @@ function _addToWhitelist(&$model, $field) {
* @subpackage cake.cake.libs.model
*/
class BehaviorCollection extends Object {

/**
* Stores a reference to the attached name
*
* @var object
* @var string
* @access public
*/
var $modelName = null;
/**
Expand Down
15 changes: 8 additions & 7 deletions cake/libs/model/connection_manager.php
@@ -1,9 +1,9 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
* Datasource connection manager
*
* Long description for file
* Provides an interface for loading and enumerating connections defined in app/config/database.php
*
* PHP versions 4 and 5
*
Expand Down Expand Up @@ -39,7 +39,7 @@ class ConnectionManager extends Object {
/**
* Holds a loaded instance of the Connections object
*
* @var object
* @var DATABASE_CONFIG
* @access public
*/
var $config = null;
Expand Down Expand Up @@ -85,7 +85,7 @@ function &getInstance() {
/**
* Gets a reference to a DataSource object
*
* @param string $name The name of the DataSource, as defined in app/config/connections
* @param string $name The name of the DataSource, as defined in app/config/database.php
* @return object Instance
* @access public
* @static
Expand Down Expand Up @@ -145,8 +145,9 @@ function getSourceName(&$source) {
/**
* Loads the DataSource class for the given connection name
*
* @param mixed $connName A string name of the connection, as defined in Connections config,
* or an array containing the file and class name of the object.
* @param mixed $connName A string name of the connection, as defined in app/config/database.php,
* or an array containing the filename (without extension) and class name of the object,
* to be found in app/models/datasources/ or cake/libs/model/datasources/.
* @return boolean True on success, null on failure or false if the class is already loaded
* @access public
* @static
Expand Down Expand Up @@ -259,4 +260,4 @@ function __destruct() {
}
}
}
?>
?>
12 changes: 9 additions & 3 deletions cake/libs/model/model.php
Expand Up @@ -221,7 +221,7 @@ class Model extends Overloadable {
/**
* Holds the Behavior objects currently bound to this model.
*
* @var object
* @var BehaviorCollection
* @access public
*/
var $Behaviors = null;
Expand Down Expand Up @@ -2343,9 +2343,15 @@ function invalidFields($options = array()) {
$this->exists();

$_validate = $this->validate;
if (array_key_exists('fieldList', $options) && is_array($options['fieldList']) && !empty($options['fieldList'])) {
$whitelist = $this->whitelist;

if (array_key_exists('fieldList', $options)) {
$whitelist = $options['fieldList'];
}

if (!empty($whitelist)) {
$validate = array();
foreach ($options['fieldList'] as $f) {
foreach ((array)$whitelist as $f) {
if (!empty($this->validate[$f])) {
$validate[$f] = $this->validate[$f];
}
Expand Down
18 changes: 12 additions & 6 deletions cake/libs/object.php
Expand Up @@ -38,7 +38,7 @@ class Object {
/**
* Log object
*
* @var object
* @var CakeLog
* @access protected
*/
var $_log = null;
Expand Down Expand Up @@ -248,7 +248,11 @@ function _savePersistent($name, &$object) {
$objectArray = array(&$object);
$data = str_replace('\\', '\\\\', serialize($objectArray));
$data = '<?php $' . $name . ' = \'' . str_replace('\'', '\\\'', $data) . '\' ?>';
cache($file, $data, '+1 day');
$duration = '+999 days';
if (Configure::read() >= 1) {
$duration = '+10 seconds';
}
cache($file, $data, $duration);
}
/**
* Open the persistent class file for reading
Expand All @@ -267,14 +271,16 @@ function __openPersistent($name, $type = null) {
case 'registry':
$vars = unserialize(${$name});
foreach ($vars['0'] as $key => $value) {
App::import('Model', Inflector::classify($key));
if (strpos($key, '_behavior') !== false) {
App::import('Behavior', Inflector::classify(substr($key, 0, -9)));
} else {
App::import('Model', Inflector::classify($key));
}
unset ($value);
}
unset($vars);
$vars = unserialize(${$name});
foreach ($vars['0'] as $key => $value) {
foreach ($vars['0'][$key]->Behaviors->_attached as $behavior) {
App::import('Behavior', $behavior);
}
ClassRegistry::addObject($key, $value);
unset ($value);
}
Expand Down
6 changes: 3 additions & 3 deletions cake/libs/session.php
Expand Up @@ -349,7 +349,9 @@ function watch($var) {
if (empty($var)) {
return false;
}
$this->watchKeys[] = $var;
if (!in_array($var, $this->watchKeys, true)) {
$this->watchKeys[] = $var;
}
}
/**
* Tells Session to stop watching a given key path
Expand Down Expand Up @@ -571,10 +573,8 @@ function _checkValid() {
$this->__setError(1, 'Session Highjacking Attempted !!!');
}
} else {
srand ((double)microtime() * 1000000);
$this->write('Config.userAgent', $this->_userAgent);
$this->write('Config.time', $this->sessionTime);
$this->write('Config.rand', mt_rand());
$this->write('Config.timeout', 10);
$this->valid = true;
$this->__setError(1, 'Session is valid');
Expand Down
6 changes: 3 additions & 3 deletions cake/libs/set.php
Expand Up @@ -374,12 +374,12 @@ function extract($path, $data = null, $options = array()) {
$data = $path;
$path = $tmp;
}
if (empty($data)) {
return array();
}
if (strpos($path, '/') === false) {
return Set::classicExtract($data, $path);
}
if (empty($data)) {
return array();
}
if ($path === '/') {
return $data;
}
Expand Down

0 comments on commit 643651f

Please sign in to comment.