Skip to content

Commit

Permalink
Merge branch '1.2' into 1.2-merger
Browse files Browse the repository at this point in the history
Conflicts:
	app/webroot/test.php
	cake/VERSION.txt
	cake/bootstrap.php
	cake/config/config.php
	cake/console/cake.php
	cake/console/libs/schema.php
	cake/console/templates/skel/webroot/test.php
	cake/libs/configure.php
	cake/tests/cases/console/libs/schema.test.php
	cake/tests/cases/libs/debugger.test.php
	cake/tests/cases/libs/model/model_write.test.php
	cake/tests/fixtures/aco_fixture.php
  • Loading branch information
markstory committed Sep 16, 2009
2 parents 4b4f3b1 + 793c6ec commit 5717e3b
Show file tree
Hide file tree
Showing 32 changed files with 553 additions and 140 deletions.
5 changes: 5 additions & 0 deletions app/config/core.php
Expand Up @@ -225,6 +225,11 @@
*/
//date_default_timezone_set('UTC');

/**
* If you are on PHP 5.3 uncomment this line and correct your server timezone
* to fix the date & time related errors.
*/
//date_default_timezone_set('UTC');
/**
*
* Cache Engine Configuration
Expand Down
8 changes: 0 additions & 8 deletions app/webroot/test.php
Expand Up @@ -24,14 +24,6 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
*/
/**
* PHP 5.3 raises many notices in bootstrap.
*/
if (!defined('E_DEPRECATED')) {
define('E_DEPRECATED', 8192);
}
error_reporting(E_ALL & ~E_DEPRECATED);

set_time_limit(0);
ini_set('memory_limit','128M');
ini_set('display_errors', 1);
Expand Down
87 changes: 41 additions & 46 deletions cake/basics.php
Expand Up @@ -54,9 +54,8 @@ function clone($object)
* Loads configuration files. Receives a set of configuration files
* to load.
* Example:
* <code>
* config('config1', 'config2');
* </code>
*
* `config('config1', 'config2');`
*
* @return boolean Success
*/
Expand Down Expand Up @@ -84,9 +83,8 @@ function config() {
* Loads component/components from LIBS. Takes optional number of parameters.
*
* Example:
* <code>
* uses('flay', 'time');
* </code>
*
* `uses('flay', 'time');`
*
* @param string $name Filename without the .php part
* @deprecated
Expand Down Expand Up @@ -224,14 +222,12 @@ function h($text, $charset = null) {
* Returns an array of all the given parameters.
*
* Example:
* <code>
* a('a', 'b')
* </code>
*
* `a('a', 'b')`
*
* Would return:
* <code>
* array('a', 'b')
* </code>
*
* `array('a', 'b')`
*
* @return array Array of given parameters
* @link http://book.cakephp.org/view/694/a
Expand All @@ -245,14 +241,12 @@ function a() {
* Constructs associative array from pairs of arguments.
*
* Example:
* <code>
* aa('a','b')
* </code>
*
* `aa('a','b')`
*
* Would return:
* <code>
* array('a'=>'b')
* </code>
*
* `array('a'=>'b')`
*
* @return array Associative array
* @link http://book.cakephp.org/view/695/aa
Expand Down Expand Up @@ -531,10 +525,9 @@ function cache($path, $data = null, $expires = '+1 day', $target = 'cache') {
/**
* Used to delete files in the cache directories, or clear contents of cache directories
*
* @param mixed $params As String name to be searched for deletion, if name is a directory all files in directory will be deleted.
* If array, names to be searched for deletion.
* If clearCache() without params, all files in app/tmp/cache/views will be deleted
*
* @param mixed $params As String name to be searched for deletion, if name is a directory all files in
* directory will be deleted. If array, names to be searched for deletion. If clearCache() without params,
* all files in app/tmp/cache/views will be deleted
* @param string $type Directory in tmp/cache defaults to view directory
* @param string $ext The file extension you are deleting
* @return true if files found and deleted false otherwise
Expand Down Expand Up @@ -715,13 +708,14 @@ function __dn($domain, $singular, $plural, $count, $return = false) {
* Valid categories are: LC_CTYPE, LC_NUMERIC, LC_TIME, LC_COLLATE, LC_MONETARY, LC_MESSAGES and LC_ALL.
*
* Note that the category must be specified with a numeric value, instead of the constant name. The values are:
* LC_CTYPE 0
* LC_NUMERIC 1
* LC_TIME 2
* LC_COLLATE 3
* LC_MONETARY 4
* LC_MESSAGES 5
* LC_ALL 6
*
* - LC_ALL 0
* - LC_COLLATE 1
* - LC_CTYPE 2
* - LC_MONETARY 3
* - LC_NUMERIC 4
* - LC_TIME 5
* - LC_MESSAGES 6
*
* @param string $domain Domain
* @param string $msg Message to translate
Expand Down Expand Up @@ -754,13 +748,14 @@ function __dc($domain, $msg, $category, $return = false) {
* Valid categories are: LC_CTYPE, LC_NUMERIC, LC_TIME, LC_COLLATE, LC_MONETARY, LC_MESSAGES and LC_ALL.
*
* Note that the category must be specified with a numeric value, instead of the constant name. The values are:
* LC_ALL 0
* LC_COLLATE 1
* LC_CTYPE 2
* LC_MONETARY 3
* LC_NUMERIC 4
* LC_TIME 5
* LC_MESSAGES 6
*
* - LC_ALL 0
* - LC_COLLATE 1
* - LC_CTYPE 2
* - LC_MONETARY 3
* - LC_NUMERIC 4
* - LC_TIME 5
* - LC_MESSAGES 6
*
* @param string $domain Domain
* @param string $singular Singular string to translate
Expand Down Expand Up @@ -790,13 +785,14 @@ function __dcn($domain, $singular, $plural, $count, $category, $return = false)
* Valid categories are: LC_CTYPE, LC_NUMERIC, LC_TIME, LC_COLLATE, LC_MONETARY, LC_MESSAGES and LC_ALL.
*
* Note that the category must be specified with a numeric value, instead of the constant name. The values are:
* LC_CTYPE 0
* LC_NUMERIC 1
* LC_TIME 2
* LC_COLLATE 3
* LC_MONETARY 4
* LC_MESSAGES 5
* LC_ALL 6
*
* - LC_ALL 0
* - LC_COLLATE 1
* - LC_CTYPE 2
* - LC_MONETARY 3
* - LC_NUMERIC 4
* - LC_TIME 5
* - LC_MESSAGES 6
*
* @param string $msg String to translate
* @param integer $category Category
Expand Down Expand Up @@ -965,9 +961,8 @@ function http_build_query($data, $prefix = null, $argSep = null, $baseKey = null
* Wraps ternary operations. If $condition is a non-empty value, $val1 is returned, otherwise $val2.
* Don't use for isset() conditions, or wrap your variable with @ operator:
* Example:
* <code>
* ife(isset($variable), @$variable, 'default');
* </code>
*
* `ife(isset($variable), @$variable, 'default');`
*
* @param mixed $condition Conditional expression
* @param mixed $val1 Value to return in case condition matches
Expand Down
4 changes: 2 additions & 2 deletions cake/config/config.php
Expand Up @@ -19,5 +19,5 @@
* @since CakePHP(tm) v 1.1.11.4062
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
return $config['Cake.version'] = '1.3.0.0';
?>
return $config['Cake.version'] = '1.3.0';
?>
5 changes: 2 additions & 3 deletions cake/console/cake.php
Expand Up @@ -27,7 +27,6 @@
if (!defined('E_DEPRECATED')) {
define('E_DEPRECATED', 8192);
}

/**
* Shell dispatcher
*
Expand Down Expand Up @@ -161,7 +160,7 @@ function __construct($args = array()) {
function __initConstants() {
if (function_exists('ini_set')) {
ini_set('display_errors', '1');
ini_set('error_reporting', E_ALL);
ini_set('error_reporting', E_ALL & ~E_DEPRECATED);
ini_set('html_errors', false);
ini_set('implicit_flush', true);
ini_set('max_execution_time', 0);
Expand Down Expand Up @@ -228,7 +227,7 @@ function __buildPaths() {
require LIBS . 'folder.php';
}
foreach ($pluginPaths as $pluginPath) {
$Folder =& new Folder($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;
Expand Down
22 changes: 12 additions & 10 deletions cake/console/libs/schema.php
Expand Up @@ -8,20 +8,17 @@
* PHP versions 4 and 5
*
* CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org)
* Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* Copyright 2005-2009, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @copyright Copyright 2005-2009, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.console.libs
* @since CakePHP(tm) v 1.2.0.5550
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
App::import('Core', 'File', false);
Expand Down Expand Up @@ -208,6 +205,7 @@ function dump() {
$db =& ConnectionManager::getDataSource($this->Schema->connection);
$contents = "#" . $Schema->name . " sql generated on: " . date('Y-m-d H:i:s') . " : " . time() . "\n\n";
$contents .= $db->dropSchema($Schema) . "\n\n". $db->createSchema($Schema);

if ($write) {
if (strpos($write, '.sql') === false) {
$write .= '.sql';
Expand Down Expand Up @@ -290,7 +288,7 @@ function run() {
*
* @access private
*/
function __create($Schema, $table = null) {
function __create(&$Schema, $table = null) {
$db =& ConnectionManager::getDataSource($this->Schema->connection);

$drop = $create = array();
Expand Down Expand Up @@ -334,11 +332,15 @@ function __create($Schema, $table = null) {
*
* @access private
*/
function __update($Schema, $table = null) {
function __update(&$Schema, $table = null) {
$db =& ConnectionManager::getDataSource($this->Schema->connection);

$this->out(__('Comparing Database to Schema...', true));
$Old = $this->Schema->read();
$options = array();
if (isset($this->params['f'])) {
$options['models'] = false;
}
$Old = $this->Schema->read($options);
$compare = $this->Schema->compare($Old, $Schema);

$contents = array();
Expand Down Expand Up @@ -372,15 +374,15 @@ function __update($Schema, $table = null) {
*
* @access private
*/
function __run($contents, $event, $Schema) {
function __run($contents, $event, &$Schema) {
if (empty($contents)) {
$this->err(__('Sql could not be run', true));
return;
}
Configure::write('debug', 2);
$db =& ConnectionManager::getDataSource($this->Schema->connection);
$db->fullDebug = true;

foreach ($contents as $table => $sql) {
if (empty($sql)) {
$this->out(sprintf(__('%s is up to date.', true), $table));
Expand Down
5 changes: 5 additions & 0 deletions cake/console/templates/skel/config/core.php
Expand Up @@ -225,6 +225,11 @@
*/
//date_default_timezone_set('UTC');

/**
* If you are on PHP 5.3 uncomment this line and correct your server timezone
* to fix the date & time related errors.
*/
//date_default_timezone_set('UTC');
/**
*
* Cache Engine Configuration
Expand Down
10 changes: 0 additions & 10 deletions cake/console/templates/skel/webroot/test.php
Expand Up @@ -25,25 +25,15 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
*/
/**
* PHP 5.3 raises many notices in bootstrap.
*/
if (!defined('E_DEPRECATED')) {
define('E_DEPRECATED', 8192);
}
error_reporting(E_ALL & ~E_DEPRECATED);

set_time_limit(0);
ini_set('memory_limit','128M');
ini_set('display_errors', 1);

/**
* Use the DS to separate the directories in other defines
*/
if (!defined('DS')) {
define('DS', DIRECTORY_SEPARATOR);
}

/**
* These defines should only be edited if you have cake installed in
* a directory layout other than the way it is distributed.
Expand Down
6 changes: 5 additions & 1 deletion cake/libs/controller/components/email.php
Expand Up @@ -725,10 +725,14 @@ function __smtp() {
return false;
}

$httpHost = env('HTTP_HOST');

if (isset($this->smtpOptions['client'])) {
$host = $this->smtpOptions['client'];
} elseif (!empty($httpHost)) {
$host = $httpHost;
} else {
$host = env('HTTP_HOST');
$host = 'localhost';
}

if (!$this->__smtpSend("HELO {$host}", '250')) {
Expand Down
1 change: 1 addition & 0 deletions cake/libs/model/cake_schema.php
Expand Up @@ -186,6 +186,7 @@ function load($options = array()) {
* - 'connection' - the db connection to use
* - 'name' - name of the schema
* - 'models' - a list of models to use, or false to ignore models
*
* @param array $options schema object properties
* @return array Array indexed by name and tables
* @access public
Expand Down
9 changes: 6 additions & 3 deletions cake/libs/model/datasources/dbo/dbo_mssql.php
Expand Up @@ -275,6 +275,9 @@ function value($data, $column = null, $safe = false) {
if ($data === null) {
return 'NULL';
}
if (in_array($column, array('integer', 'float', 'binary')) && $data === '') {
return 'NULL';
}
if ($data === '') {
return "''";
}
Expand Down Expand Up @@ -737,8 +740,8 @@ function buildIndex($indexes, $table = null) {

foreach ($indexes as $name => $value) {
if ($name == 'PRIMARY') {
$out = 'PRIMARY KEY (' . $this->name($value['column']) . ')';
} else {
$join[] = 'PRIMARY KEY (' . $this->name($value['column']) . ')';
} else if (isset($value['unique']) && $value['unique']) {
$out = "ALTER TABLE {$table} ADD CONSTRAINT {$name} UNIQUE";

if (is_array($value['column'])) {
Expand All @@ -747,8 +750,8 @@ function buildIndex($indexes, $table = null) {
$value['column'] = $this->name($value['column']);
}
$out .= "({$value['column']});";
$join[] = $out;
}
$join[] = $out;
}
return $join;
}
Expand Down
2 changes: 1 addition & 1 deletion cake/libs/model/datasources/dbo_source.php
Expand Up @@ -1563,7 +1563,7 @@ function _getJoins($model) {
'alias' => $assoc,
'type' => isset($assocData['type']) ? $assocData['type'] : 'LEFT',
'conditions' => trim($this->conditions(
$this->getConstraint($assocData['association'], $model, $model->{$assoc}, $assoc, $assocData),
$this->__mergeConditions($assocData['conditions'], $this->getConstraint($assocData['association'], $model, $model->{$assoc}, $assoc, $assocData)),
true, false, $model
))
));
Expand Down

0 comments on commit 5717e3b

Please sign in to comment.