From 9f7126898b5f198bd3999cb00432e37d9037d559 Mon Sep 17 00:00:00 2001 From: Bob Fanger Date: Mon, 12 Sep 2011 12:22:59 +0200 Subject: [PATCH 1/9] Added the "locale = $locale" condition to the ON part of the query. Added "locale = $locale" to the ON part and changed the join type to an INNER join. Because adding it to the WHERE part caused the translation to be mandatory anyway. This cleans up the code and "INNER" joins are generally faster than LEFT joins. --- cake/libs/model/behaviors/translate.php | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/cake/libs/model/behaviors/translate.php b/cake/libs/model/behaviors/translate.php index 3e92c4112..9736b5a7f 100644 --- a/cake/libs/model/behaviors/translate.php +++ b/cake/libs/model/behaviors/translate.php @@ -182,27 +182,19 @@ class TranslateBehavior extends ModelBehavior { } else { $query['fields'][] = 'I18n__'.$field.'.content'; $query['joins'][] = array( - 'type' => 'LEFT', + 'type' => 'INNER', 'alias' => 'I18n__'.$field, 'table' => $db->name($tablePrefix . $RuntimeModel->useTable), 'conditions' => array( $model->alias . '.' . $model->primaryKey => $db->identifier("I18n__{$field}.foreign_key"), 'I18n__'.$field.'.model' => $model->name, - 'I18n__'.$field.'.'.$RuntimeModel->displayField => $field + 'I18n__'.$field.'.'.$RuntimeModel->displayField => $field, + 'I18n__'.$field.'.locale' => $locale ) ); - - if (is_string($query['conditions'])) { - $query['conditions'] = $db->conditions($query['conditions'], true, false, $model) . ' AND '.$db->name('I18n__'.$field.'.locale').' = \''.$locale.'\''; - } else { - $query['conditions'][$db->name("I18n__{$field}.locale")] = $locale; - } } } } - if (is_array($query['fields'])) { - $query['fields'] = array_merge($query['fields']); - } $this->runtime[$model->alias]['beforeFind'] = $addFields; return $query; } From 049d6e4c76c767bd83a9da80872d2faed583c506 Mon Sep 17 00:00:00 2001 From: mark_story Date: Tue, 11 Oct 2011 12:34:57 -0400 Subject: [PATCH 2/9] Fix issue where incorrect elements would be used. If your view is using an alternate extension and you have elements that share filenames, the incorrect element would be used. Fixes #2082 --- cake/libs/view/view.php | 3 +++ cake/tests/cases/libs/view/view.test.php | 11 +++++++++++ cake/tests/test_app/views/elements/test_element.xml | 1 + 3 files changed, 15 insertions(+) create mode 100644 cake/tests/test_app/views/elements/test_element.xml diff --git a/cake/libs/view/view.php b/cake/libs/view/view.php index f3fdcf6c8..276265515 100644 --- a/cake/libs/view/view.php +++ b/cake/libs/view/view.php @@ -380,6 +380,9 @@ class View extends Object { break; } } + if ($file) { + break; + } } if (is_file($file)) { diff --git a/cake/tests/cases/libs/view/view.test.php b/cake/tests/cases/libs/view/view.test.php index d82a405d5..eca086ea2 100644 --- a/cake/tests/cases/libs/view/view.test.php +++ b/cake/tests/cases/libs/view/view.test.php @@ -487,6 +487,17 @@ class ViewTest extends CakeTestCase { $this->assertPattern('/non_existant_element/', $result); } +/** + * Test that alternate extensions work with duplicated elements. + * + * @return void + */ + function testElementExtensions() { + $this->View->ext = '.xml'; + $result = $this->View->element('test_element'); + $this->assertEqual(trim($result), '

test element

'); + } + /** * test that additional element viewVars don't get overwritten with helpers. * diff --git a/cake/tests/test_app/views/elements/test_element.xml b/cake/tests/test_app/views/elements/test_element.xml new file mode 100644 index 000000000..f7f3cbe68 --- /dev/null +++ b/cake/tests/test_app/views/elements/test_element.xml @@ -0,0 +1 @@ +

test element

From 6fe24a436922ed32aecc23c2a4ecd0cfa1aefc30 Mon Sep 17 00:00:00 2001 From: mark_story Date: Tue, 11 Oct 2011 21:00:56 -0400 Subject: [PATCH 3/9] Adding Opera mobi to mobile browser list. Fixes #2087 --- cake/libs/controller/components/request_handler.php | 1 + 1 file changed, 1 insertion(+) diff --git a/cake/libs/controller/components/request_handler.php b/cake/libs/controller/components/request_handler.php index 32cf6391d..3d9323eed 100644 --- a/cake/libs/controller/components/request_handler.php +++ b/cake/libs/controller/components/request_handler.php @@ -120,6 +120,7 @@ class RequestHandlerComponent extends Object { 'NetFront', 'Nokia', 'Opera Mini', + 'Opera Mobi', 'PalmOS', 'PalmSource', 'portalmmm', From b4e3c8a77664b7f4b1ae6318a7ba44c401396e6d Mon Sep 17 00:00:00 2001 From: 0x20h Date: Tue, 11 Oct 2011 22:28:46 -0400 Subject: [PATCH 4/9] Set umask when creating cache file Fixes #2080 --- cake/libs/cache/file.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cake/libs/cache/file.php b/cake/libs/cache/file.php index 087ba0aa1..a77c56266 100644 --- a/cake/libs/cache/file.php +++ b/cake/libs/cache/file.php @@ -138,9 +138,12 @@ class FileEngine extends CacheEngine { $expires = time() + $duration; $contents = $expires . $lineBreak . $data . $lineBreak; + $old = umask(0); + $handle = fopen($this->_File->path, 'a'); + umask($old); - if (!$handle = fopen($this->_File->path, 'a')) { - return false; + if (!$handle) { + return false; } if ($this->settings['lock']) { From 3b8ca964284b8c629faf0b8c948ae9bd232cece6 Mon Sep 17 00:00:00 2001 From: Thomas Ploch Date: Fri, 7 Oct 2011 13:54:53 +0200 Subject: [PATCH 5/9] 1.3: Added resolution of symbolic links in cake CLI bash script. Removing newlines from end of file. --- cake/console/cake | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/cake/console/cake b/cake/console/cake index 6faf816da..cbb4fcf12 100755 --- a/cake/console/cake +++ b/cake/console/cake @@ -10,15 +10,24 @@ # Licensed under The MIT License # Redistributions of files must retain the above copyright notice. # -# @copyright Copyright 2005-2011, Cake Software Foundation, Inc. -# @link http://cakephp.org CakePHP(tm) Project -# @package cake -# @subpackage cake.cake.console -# @since CakePHP(tm) v 1.2.0.5012 -# @license MIT License (http://www.opensource.org/licenses/mit-license.php) +# @copyright Copyright 2005-2011, Cake Software Foundation, Inc. +# @link http://cakephp.org CakePHP(tm) Project +# @package Cake +# @subpackage Cake.Console +# @since CakePHP(tm) v 1.2.0.5012 +# @license MIT License (http://www.opensource.org/licenses/mit-license.php) # ################################################################################ -LIB=${0/%cake/} +LIB=${0} +SYM=$(readlink "$0") + +if [ ! -n "$SYM" ] + then + LIB=${LIB%/*}"/" + else + LIB=${SYM%/*}"/" +fi + APP=`pwd` exec php -q ${LIB}cake.php -working "${APP}" "$@" From 856b34f9f52ce2e7845bf740defe876d03a02aad Mon Sep 17 00:00:00 2001 From: Jose Lorenzo Rodriguez Date: Fri, 14 Oct 2011 22:05:43 -0430 Subject: [PATCH 6/9] Correctly interpreting symlinks --- cake/console/cake | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/cake/console/cake b/cake/console/cake index cbb4fcf12..c3d8567e1 100755 --- a/cake/console/cake +++ b/cake/console/cake @@ -18,16 +18,15 @@ # @license MIT License (http://www.opensource.org/licenses/mit-license.php) # ################################################################################ -LIB=${0} -SYM=$(readlink "$0") +LIB=$(cd -P -- "$(dirname -- "$0")" && pwd -P) && LIB=$LIB/$(basename -- "$0") -if [ ! -n "$SYM" ] - then - LIB=${LIB%/*}"/" - else - LIB=${SYM%/*}"/" -fi +while [ -h $LIB ]; do + DIR=$(dirname -- "$LIB") + SYM=$(readlink $LIB) + LIB=$(cd $DIR && cd $(dirname -- "$SYM") && pwd)/$(basename -- "$SYM") +done +LIB=$(dirname -- "$LIB")/ APP=`pwd` exec php -q ${LIB}cake.php -working "${APP}" "$@" From 08247a921fc1322353aa164bc86f8100ab5f1c86 Mon Sep 17 00:00:00 2001 From: mark_story Date: Sat, 15 Oct 2011 11:04:03 -0400 Subject: [PATCH 7/9] Fixing failing test. --- cake/tests/cases/libs/view/helpers/html.test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cake/tests/cases/libs/view/helpers/html.test.php b/cake/tests/cases/libs/view/helpers/html.test.php index 2a95427b2..b4e3b831d 100644 --- a/cake/tests/cases/libs/view/helpers/html.test.php +++ b/cake/tests/cases/libs/view/helpers/html.test.php @@ -594,7 +594,7 @@ class HtmlHelperTest extends CakeTestCase { $result = $this->Html->script('http://example.com/test.json'); $expected = array( - 'script' => array('type' => 'text/javascript', 'src' => 'http://example.com/test.json.js') + 'script' => array('type' => 'text/javascript', 'src' => 'http://example.com/test.json') ); $this->assertTags($result, $expected); From ad7db4cc541e2258178d4d76d145d81388eae544 Mon Sep 17 00:00:00 2001 From: mark_story Date: Sat, 15 Oct 2011 15:11:54 -0400 Subject: [PATCH 8/9] Fix failing test. --- cake/tests/cases/libs/view/view.test.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cake/tests/cases/libs/view/view.test.php b/cake/tests/cases/libs/view/view.test.php index eca086ea2..5b3d1cf5c 100644 --- a/cake/tests/cases/libs/view/view.test.php +++ b/cake/tests/cases/libs/view/view.test.php @@ -762,13 +762,12 @@ class ViewTest extends CakeTestCase { Configure::write('Cache.check', true); $Controller =& new ViewPostsController(); - $Controller->cacheAction = '1 day'; + $Controller->cacheAction = '+1 day'; $View =& new View($Controller); $View->loaded['cache'] = new ViewTestMockCacheHelper(); $View->loaded['cache']->expectCallCount('cache', 2); - $result = $View->render('index'); - $this->assertPattern('/posts index/', $result); + $View->render('index'); Configure::write('Cache.check', $_check); } From 924fb6f304d1103108f3328af4407de5c9d4aef6 Mon Sep 17 00:00:00 2001 From: mark_story Date: Sat, 15 Oct 2011 16:02:01 -0400 Subject: [PATCH 9/9] Updating version numbers to 1.3.13 --- cake/VERSION.txt | 3 ++- cake/config/config.php | 2 +- cake/libs/view/pages/home.ctp | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cake/VERSION.txt b/cake/VERSION.txt index 494caed50..3944ea0f4 100644 --- a/cake/VERSION.txt +++ b/cake/VERSION.txt @@ -18,7 +18,8 @@ // @license MIT License (http://www.opensource.org/licenses/mit-license.php) // +--------------------------------------------------------------------------------------------+ // //////////////////////////////////////////////////////////////////////////////////////////////////// -1.3.12 +1.3.13 + diff --git a/cake/config/config.php b/cake/config/config.php index 0dad0fcce..52cfb9183 100644 --- a/cake/config/config.php +++ b/cake/config/config.php @@ -17,4 +17,4 @@ * @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.12'; +return $config['Cake.version'] = '1.3.13'; diff --git a/cake/libs/view/pages/home.ctp b/cake/libs/view/pages/home.ctp index 2c2895cb6..19cc37075 100644 --- a/cake/libs/view/pages/home.ctp +++ b/cake/libs/view/pages/home.ctp @@ -24,7 +24,7 @@ endif;

For updates and important announcements, visit http://cakefest.org

- + 0): Debugger::checkSecurityKeys();