Browse Source

Merge remote-tracking branch 'origin/1.3' into 2.0

Conflicts:
	cake/console/templates/default/views/home.ctp
	cake/libs/controller/controller.php
	cake/libs/model/datasources/dbo/dbo_mysqli.php
	cake/libs/view/pages/home.ctp
	cake/tests/cases/libs/view/media.test.php
	cake/tests/lib/cake_test_case.php
	cake/tests/lib/code_coverage_manager.php
	cake/tests/test_app/views/pages/home.ctp
	lib/Cake/Cache/Engine/ApcEngine.php
	lib/Cake/Model/Datasource/Database/Mysql.php
	lib/Cake/View/Helper/FormHelper.php
Jose Lorenzo Rodriguez 14 years ago
parent
commit
febf28f34b

+ 6 - 2
lib/Cake/Cache/Engine/ApcEngine.php

@@ -49,7 +49,11 @@ class ApcEngine extends CacheEngine {
  * @return boolean True if the data was successfully cached, false on failure
  */
 	public function write($key, $value, $duration) {
-		$expires = time() + $duration;
+		if ($duration == 0) {
+			$expires = 0;
+		} else {
+			$expires = time() + $duration;
+		}
 		apc_store($key.'_expires', $expires, $duration);
 		return apc_store($key, $value, $duration);
 	}
@@ -63,7 +67,7 @@ class ApcEngine extends CacheEngine {
 	public function read($key) {
 		$time = time();
 		$cachetime = intval(apc_fetch($key.'_expires'));
-		if ($cachetime < $time || ($time + $this->settings['duration']) < $cachetime) {
+		if ($cachetime !== 0 && ($cachetime < $time || ($time + $this->settings['duration']) < $cachetime)) {
 			return false;
 		}
 		return apc_fetch($key);

+ 4 - 0
lib/Cake/Console/Templates/default/views/home.ctp

@@ -1,4 +1,8 @@
 <?php
+$output = "
+<iframe src=\"http://cakephp.org/bake-banner\" width=\"830\" height=\"160\" style=\"overflow:hidden; border:none;\">
+	<p>For updates and important announcements, visit http://cakefest.org</p>
+</iframe>\n";
 $output = "<h2>Sweet, \"" . Inflector::humanize($app) . "\" got Baked by CakePHP!</h2>\n";
 $output .="
 <?php

+ 14 - 0
lib/Cake/Test/Case/Cache/Engine/ApcEngineTest.php

@@ -77,6 +77,20 @@ class ApcEngineTest extends CakeTestCase {
 	}
 
 /**
+ * Writing cache entries with duration = 0 (forever) should work.
+ *
+ * @return void
+ */
+	function testReadWriteDurationZero() {
+		Cache::config('apc', array('engine' => 'Apc', 'duration' => 0, 'prefix' => 'cake_'));
+		Cache::write('zero', 'Should save', 'apc');
+		sleep(1);
+
+		$result = Cache::read('zero', 'apc');
+		$this->assertEqual('Should save', $result);
+	}
+
+/**
  * testExpiry method
  *
  * @access public

+ 1 - 1
lib/Cake/TestSuite/Fixture/CakeFixtureManager.php

@@ -206,7 +206,7 @@ class CakeFixtureManager {
  */
 	public function unload(CakeTestCase $test) {
 		$fixtures = !empty($test->fixtures) ? $test->fixtures : array();
-		foreach ($fixtures as $f) {
+		foreach (array_reverse($fixtures) as $f) {
 			if (isset($this->_loaded[$f])) {
 				$fixture = $this->_loaded[$f];
 				if (!empty($fixture->created)) {

+ 1 - 0
lib/Cake/TestSuite/templates/menu.php

@@ -40,6 +40,7 @@ if (!empty($plugins)):
 				</li>
 			</ul>
 	<?php endforeach; ?>
+	</li>
 <?php endif;?>
 	<li style="padding-top: 10px">
 		<span style="font-size: 18px">Core</span>

+ 1 - 1
lib/Cake/Utility/Folder.php

@@ -568,7 +568,7 @@ class Folder {
  *
  * - `to` The directory to copy to.
  * - `from` The directory to copy from, this will cause a cd() to occur, changing the results of pwd().
- * - `chmod` The mode to copy the files/directories with.
+ * - `mode` The mode to copy the files/directories with.
  * - `skip` Files/directories to skip.
  *
  * @param mixed $options Either an array of options (see above) or a string of the destination directory.

+ 1 - 2
lib/Cake/Utility/Sanitize.php

@@ -232,7 +232,7 @@ class Sanitize {
 			return $data;
 		} else {
 			if ($options['odd_spaces']) {
-				$data = str_replace(chr(0xCA), '', str_replace(' ', ' ', $data));
+				$data = str_replace(chr(0xCA), '', $data);
 			}
 			if ($options['encode']) {
 				$data = Sanitize::html($data, array('remove' => $options['remove_html']));
@@ -243,7 +243,6 @@ class Sanitize {
 			if ($options['carriage']) {
 				$data = str_replace("\r", "", $data);
 			}
-
 			if ($options['unicode']) {
 				$data = preg_replace("/&amp;#([0-9]+);/s", "&#\\1;", $data);
 			}

+ 2 - 1
lib/Cake/View/Helper/FormHelper.php

@@ -459,7 +459,8 @@ class FormHelper extends AppHelper {
 		if ($model !== false) {
 			$this->setEntity($model, true);
 		}
-		return $this->Html->useTag('form', $action, $htmlAttributes) . $append;
+		$attributes = sprintf('action="%s" ', $action) . $this->_parseAttributes($htmlAttributes, null, '');
+		return $this->Html->useTag('form', $action, $attributes) . $append;
 	}
 
 /**

+ 3 - 0
lib/Cake/View/Pages/home.ctp

@@ -20,6 +20,9 @@ if (Configure::read('debug') == 0):
 endif;
 App::uses('Debugger', 'Utility');
 ?>
+<iframe src="http://cakephp.org/bake-banner" width="830" height="160" style="overflow:hidden; border:none;">
+	<p>For updates and important announcements, visit http://cakefest.org</p>
+</iframe>
 <h2><?php echo __d('cake_dev', 'Release Notes for CakePHP %s.', Configure::version()); ?></h2>
 <a href="http://cakephp.org/changelogs/2.0.0-alpha"><?php __d('cake_dev', 'Read the changelog'); ?> </a>
 <?php