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
This commit is contained in:
Jose Lorenzo Rodriguez 2011-07-25 14:44:23 -04:30
commit febf28f34b
9 changed files with 33 additions and 7 deletions

View file

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

View file

@ -1,4 +1,8 @@
<?php <?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 = "<h2>Sweet, \"" . Inflector::humanize($app) . "\" got Baked by CakePHP!</h2>\n";
$output .=" $output .="
<?php <?php

View file

@ -76,6 +76,20 @@ class ApcEngineTest extends CakeTestCase {
Cache::delete('test', 'apc'); Cache::delete('test', 'apc');
} }
/**
* 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 * testExpiry method
* *

View file

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

View file

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

View file

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

View file

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

View file

@ -459,7 +459,8 @@ class FormHelper extends AppHelper {
if ($model !== false) { if ($model !== false) {
$this->setEntity($model, true); $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;
} }
/** /**

View file

@ -20,6 +20,9 @@ if (Configure::read('debug') == 0):
endif; endif;
App::uses('Debugger', 'Utility'); 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> <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> <a href="http://cakephp.org/changelogs/2.0.0-alpha"><?php __d('cake_dev', 'Read the changelog'); ?> </a>
<?php <?php