Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' into 2.3

Conflicts:
	lib/Cake/VERSION.txt
  • Loading branch information...
commit 6664acba79af0abef53bebed4489e717d7b0ac7f 2 parents 2895186 + 878f184
Mark Story markstory authored
1  lib/Cake/Console/Command/ConsoleShell.php
View
@@ -175,7 +175,6 @@ public function main($command = null) {
case 'quit':
case 'exit':
return true;
- break;
case 'models':
$this->out(__d('cake_console', 'Model classes:'));
$this->hr();
11 lib/Cake/Console/Command/SchemaShell.php
View
@@ -1,12 +1,5 @@
<?php
/**
- * Command-line database management utility to automate programmer chores.
- *
- * Schema is CakePHP's database management utility. This helps you maintain versions of
- * of your database.
- *
- * PHP 5
- *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
@@ -291,7 +284,9 @@ protected function _loadSchema() {
$Schema = $this->Schema->load($options);
if (!$Schema) {
- $this->err(__d('cake_console', '%s could not be loaded', $this->Schema->path . DS . $this->Schema->file));
+ $this->err(__d('cake_console', 'The chosen schema could not be loaded. Attempted to load:'));
+ $this->err(__d('cake_console', 'File: %s', $this->Schema->path . DS . $this->Schema->file));
+ $this->err(__d('cake_console', 'Name: %s', $this->Schema->name));
$this->_stop();
}
$table = null;
2  lib/Cake/Console/Command/TestShell.php
View
@@ -57,7 +57,7 @@ public function getOptionParser() {
'help' => __d('cake_console', '<file> Log test execution in JUnit XML format to file.'),
'default' => false
))->addOption('log-json', array(
- 'help' => __d('cake_console', '<file> Log test execution in TAP format to file.'),
+ 'help' => __d('cake_console', '<file> Log test execution in JSON format to file.'),
'default' => false
))->addOption('log-tap', array(
'help' => __d('cake_console', '<file> Log test execution in TAP format to file.'),
2  lib/Cake/Controller/Component/EmailComponent.php
View
@@ -305,7 +305,7 @@ public function send($content = null, $template = null, $layout = null) {
if (!empty($this->return)) {
$lib->returnPath($this->_formatAddresses((array)$this->return));
}
- if (!empty($readReceipt)) {
+ if (!empty($this->readReceipt)) {
$lib->readReceipt($this->_formatAddresses((array)$this->readReceipt));
}
1  lib/Cake/Core/Object.php
View
@@ -123,7 +123,6 @@ public function dispatchMethod($method, $params = array()) {
return $this->{$method}($params[0], $params[1], $params[2], $params[3], $params[4]);
default:
return call_user_func_array(array(&$this, $method), $params);
- break;
}
}
1  lib/Cake/Model/Datasource/Database/Mysql.php
View
@@ -533,7 +533,6 @@ public function dropSchema(CakeSchema $schema, $table = null) {
* @param string $table Table to alter parameters for.
* @param array $parameters Parameters to add & drop.
* @return array Array of table property alteration statements.
- * @todo Implement this method.
*/
protected function _alterTableParameters($table, $parameters) {
if (isset($parameters['change'])) {
3  lib/Cake/Model/Datasource/Database/Postgres.php
View
@@ -652,7 +652,6 @@ public function column($real) {
return 'float';
default:
return 'text';
- break;
}
}
@@ -894,10 +893,8 @@ public function renderStatement($type, $data) {
}
}
return "CREATE TABLE {$table} (\n\t{$columns}\n);\n{$indexes}";
- break;
default:
return parent::renderStatement($type, $data);
- break;
}
}
2  lib/Cake/Model/Datasource/Database/Sqlite.php
View
@@ -530,10 +530,8 @@ public function renderStatement($type, $data) {
$indexes = "\t" . join("\n\t", array_filter($indexes));
}
return "CREATE TABLE {$table} (\n{$columns});\n{$indexes}";
- break;
default:
return parent::renderStatement($type, $data);
- break;
}
}
2  lib/Cake/Model/Datasource/Database/Sqlserver.php
View
@@ -537,10 +537,8 @@ public function renderStatement($type, $data) {
}
}
return "CREATE TABLE {$table} (\n{$columns});\n{$indexes}";
- break;
default:
return parent::renderStatement($type, $data);
- break;
}
}
6 lib/Cake/Model/Datasource/DboSource.php
View
@@ -341,10 +341,8 @@ public function value($data, $column = null) {
switch ($column) {
case 'binary':
return $this->_connection->quote($data, PDO::PARAM_LOB);
- break;
case 'boolean':
return $this->_connection->quote($this->boolean($data, true), PDO::PARAM_BOOL);
- break;
case 'string':
case 'text':
return $this->_connection->quote($data, PDO::PARAM_STR);
@@ -362,7 +360,6 @@ public function value($data, $column = null) {
return $data;
}
return $this->_connection->quote($data);
- break;
}
}
@@ -2029,7 +2026,6 @@ public function calculate(Model $model, $func, $params = array()) {
$arg = $this->name($params[0]);
}
return strtoupper($func) . '(' . $arg . ') AS ' . $this->name($params[1]);
- break;
}
}
@@ -2633,7 +2629,7 @@ protected function _quoteFields($conditions) {
}
$conditions = str_replace(array($start, $end), '', $conditions);
$conditions = preg_replace_callback(
- '/(?:[\'\"][^\'\"\\\]*(?:\\\.[^\'\"\\\]*)*[\'\"])|([a-z0-9\\-_' . $start . $end . ']*\\.[a-z0-9_\\-' . $start . $end . ']*)/i',
+ '/(?:[\'\"][^\'\"\\\]*(?:\\\.[^\'\"\\\]*)*[\'\"])|([a-z0-9_][a-z0-9\\-_]*\\.[a-z0-9_][a-z0-9_\\-]*)/i',
array(&$this, '_quoteMatchedField'),
$conditions
);
1  lib/Cake/Model/Permission.php
View
@@ -149,7 +149,6 @@ public function check($aro, $aco, $action = "*") {
break;
case 1:
return true;
- break;
}
}
}
16 lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php
View
@@ -2028,9 +2028,25 @@ public function testQuotesInStringConditions() {
$result = $this->Dbo->conditions('Member.email = "mariano@cricava.com" AND Member.user LIKE "mariano.iglesias%"');
$expected = ' WHERE `Member`.`email` = "mariano@cricava.com" AND `Member`.`user` LIKE "mariano.iglesias%"';
$this->assertEquals($expected, $result);
+ }
+/**
+ * test that - in conditions and field names works
+ *
+ * @return void
+ */
+ public function testHypenInStringConditionsAndFieldNames() {
$result = $this->Dbo->conditions('I18n__title_pt-br.content = "test"');
$this->assertEquals(' WHERE `I18n__title_pt-br`.`content` = "test"', $result);
+
+ $result = $this->Dbo->conditions('Model.field=NOW()-3600');
+ $this->assertEquals(' WHERE `Model`.`field`=NOW()-3600', $result);
+
+ $result = $this->Dbo->conditions('NOW() - Model.created < 7200');
+ $this->assertEquals(' WHERE NOW() - `Model`.`created` < 7200', $result);
+
+ $result = $this->Dbo->conditions('NOW()-Model.created < 7200');
+ $this->assertEquals(' WHERE NOW()-`Model`.`created` < 7200', $result);
}
/**
4 lib/Cake/Test/Case/Model/ModelWriteTest.php
View
@@ -6794,6 +6794,7 @@ public function testSaveAllDeepOrderHasManyHasMany() {
*/
public function testSaveAllDeepEmptyHasManyHasMany() {
$this->skipIf(!$this->db instanceof Mysql, 'This test is only compatible with Mysql.');
+
$this->loadFixtures('Article', 'Comment', 'User', 'Attachment');
$TestModel = new Article();
$TestModel->belongsTo = $TestModel->hasAndBelongsToMany = $TestModel->Comment->belongsTo = array();
@@ -6805,9 +6806,10 @@ public function testSaveAllDeepEmptyHasManyHasMany() {
$this->db->truncate(new Attachment());
$result = $TestModel->saveAll(array(
- 'Article' => array('id' => 3, 'title' => 'Comment has no data'),
+ 'Article' => array('id' => 3, 'user_id' => 1, 'title' => 'Comment has no data'),
'Comment' => array(
array(
+ 'user_id' => 1,
'Attachment' => array(
array('attachment' => 'attachment should be created with comment_id'),
array('attachment' => 'comment should be created with article_id'),
7 lib/Cake/Test/Case/Utility/DebuggerTest.php
View
@@ -277,8 +277,11 @@ public function customFormat($error, $strings) {
* @return void
*/
public function testTrimPath() {
- $this->assertEquals(Debugger::trimPath(APP), 'APP' . DS);
- $this->assertEquals(Debugger::trimPath(CAKE_CORE_INCLUDE_PATH), 'CORE');
+ $this->assertEquals('APP' . DS, Debugger::trimPath(APP));
+ $this->assertEquals('CORE', Debugger::trimPath(CAKE_CORE_INCLUDE_PATH));
+ $this->assertEquals('ROOT', Debugger::trimPath(ROOT));
+ $this->assertEquals('CORE' . DS . 'Cake' . DS, Debugger::trimPath(CAKE));
+ $this->assertEquals('Some/Other/Path', Debugger::trimPath('Some/Other/Path'));
}
/**
28 lib/Cake/Test/Case/View/Helper/CacheHelperTest.php
View
@@ -130,7 +130,7 @@ public function testLayoutCacheParsingNoTagsInView() {
$this->assertRegExp('/php echo microtime()/', $contents);
$this->assertRegExp('/clark kent/', $result);
- @unlink($filename);
+ unlink($filename);
}
/**
@@ -156,7 +156,7 @@ public function testCacheNonLatinCharactersInRoute() {
$filename = CACHE . 'views' . DS . 'posts_view_風街ろまん.php';
$this->assertTrue(file_exists($filename));
- @unlink($filename);
+ unlink($filename);
}
/**
@@ -190,7 +190,7 @@ public function testLayoutCacheParsingWithTagsInView() {
$this->assertRegExp('/php echo microtime()/', $contents);
$this->assertNotRegExp('/cake:nocache/', $contents);
- @unlink($filename);
+ unlink($filename);
}
/**
@@ -221,7 +221,7 @@ public function testMultipleNoCacheTagsInViewfile() {
$contents = file_get_contents($filename);
$this->assertNotRegExp('/cake:nocache/', $contents);
- @unlink($filename);
+ unlink($filename);
}
/**
@@ -266,7 +266,7 @@ public function testComplexNoCache() {
$filename = CACHE . 'views' . DS . 'cachetest_cache_complex.php';
$this->assertTrue(file_exists($filename));
$contents = file_get_contents($filename);
- @unlink($filename);
+ unlink($filename);
$this->assertRegExp('/A\. Layout Before Content/', $contents);
$this->assertNotRegExp('/B\. In Plain Element/', $contents);
@@ -313,7 +313,7 @@ public function testCacheViewVars() {
$this->assertRegExp('/extract\(\$this\-\>viewVars, EXTR_SKIP\);/', $contents);
$this->assertRegExp('/php echo \$variable/', $contents);
- @unlink($filename);
+ unlink($filename);
}
/**
@@ -347,7 +347,7 @@ public function testCacheCallbacks() {
$this->assertRegExp('/\$controller->startupProcess\(\);/', $contents);
- @unlink($filename);
+ unlink($filename);
}
/**
@@ -377,7 +377,7 @@ public function testCacheActionArray() {
$filename = CACHE . 'views' . DS . 'cache_test_cache_parsing.php';
$this->assertTrue(file_exists($filename));
- @unlink($filename);
+ unlink($filename);
}
/**
@@ -406,7 +406,7 @@ public function testCacheActionArrayCamelCase() {
$filename = CACHE . 'views' . DS . 'cachetest_cache_parsing.php';
$this->assertTrue(file_exists($filename));
- @unlink($filename);
+ unlink($filename);
}
/**
@@ -440,7 +440,7 @@ public function testCacheWithNamedAndPassedArgs() {
$filename = CACHE . 'views' . DS . 'cache_test_cache_parsing_1_2_name_mark_ice_cream.php';
$this->assertTrue(file_exists($filename));
- @unlink($filename);
+ unlink($filename);
}
/**
@@ -472,7 +472,7 @@ public function testCacheWithQueryStringParams() {
$filename = CACHE . 'views' . DS . 'cache_test_cache_parsing_q_cakephp.php';
$this->assertTrue(file_exists($filename), 'Missing cache file ' . $filename);
- @unlink($filename);
+ unlink($filename);
}
/**
@@ -506,7 +506,7 @@ public function testCacheWithCustomRoutes() {
$filename = CACHE . 'views' . DS . 'en_cache_test_cache_parsing.php';
$this->assertTrue(file_exists($filename));
- @unlink($filename);
+ unlink($filename);
}
/**
@@ -541,7 +541,7 @@ public function testCacheBaseNameControllerName() {
$filename = CACHE . 'views' . DS . 'cache_cachetest_cache_name.php';
$this->assertTrue(file_exists($filename));
- @unlink($filename);
+ unlink($filename);
}
/**
@@ -645,6 +645,6 @@ public function testCacheEmptySections() {
'<\?php \$y = 1; \?>\s*' .
'<\?php echo \'cached count is: \' . \$x; \?>\s*' .
'@', $contents);
- @unlink($filename);
+ unlink($filename);
}
}
2  lib/Cake/Utility/CakeTime.php
View
@@ -112,10 +112,8 @@ public function __get($name) {
switch ($name) {
case 'niceFormat':
return self::${$name};
- break;
default:
return null;
- break;
}
}
10 lib/Cake/Utility/Debugger.php
View
@@ -250,7 +250,6 @@ public static function showError($code, $description, $file = null, $line = null
break;
default:
return;
- break;
}
$data = compact(
@@ -370,9 +369,6 @@ public static function trimPath($path) {
return str_replace(ROOT, 'ROOT', $path);
}
- if (strpos($path, CAKE) === 0) {
- return str_replace($corePath, 'CORE' . DS, $path);
- }
return $path;
}
@@ -474,29 +470,23 @@ protected static function _export($var, $depth, $indent) {
switch (self::getType($var)) {
case 'boolean':
return ($var) ? 'true' : 'false';
- break;
case 'integer':
return '(int) ' . $var;
case 'float':
return '(float) ' . $var;
- break;
case 'string':
if (trim($var) == '') {
return "''";
}
return "'" . $var . "'";
- break;
case 'array':
return self::_array($var, $depth - 1, $indent + 1);
- break;
case 'resource':
return strtolower(gettype($var));
- break;
case 'null':
return 'null';
default:
return self::_object($var, $depth - 1, $indent + 1);
- break;
}
}
3  lib/Cake/Utility/Security.php
View
@@ -49,14 +49,11 @@ public static function inactiveMins() {
switch (Configure::read('Security.level')) {
case 'high':
return 10;
- break;
case 'medium':
return 100;
- break;
case 'low':
default:
return 300;
- break;
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.