Permalink
Browse files

Merge branch '2.1' into 2.2

  • Loading branch information...
2 parents 8161195 + 8b94d9e commit 03e2263b69e4608640a84c954fad0a8c696986ca @ceeram ceeram committed Jun 19, 2012
View
9 lib/Cake/Controller/CakeErrorController.php
@@ -54,12 +54,15 @@ public function __construct($request = null, $response = null) {
$this->components[] = 'RequestHandler';
}
$this->constructClasses();
+ if ($this->Components->enabled('Auth')) {
+ $this->Components->disable('Auth');
+ }
+ if ($this->Components->enabled('Security')) {
+ $this->Components->disable('Security');
+ }
$this->startupProcess();
$this->_set(array('cacheAction' => false, 'viewPath' => 'Errors'));
- if (isset($this->RequestHandler)) {
- $this->RequestHandler->startup($this);
- }
}
/**
View
4 lib/Cake/Controller/Component/AuthComponent.php
@@ -264,10 +264,6 @@ public function initialize(Controller $controller) {
* @return boolean
*/
public function startup(Controller $controller) {
- if ($controller->name == 'CakeError') {
- return true;
- }
-
$methods = array_flip(array_map('strtolower', $controller->methods));
$action = strtolower($controller->request->params['action']);
View
4 lib/Cake/Controller/Component/SecurityComponent.php
@@ -206,10 +206,6 @@ class SecurityComponent extends Component {
* @return void
*/
public function startup(Controller $controller) {
- if ($controller->name == 'CakeError') {
- return true;
- }
-
$this->request = $controller->request;
$this->_action = $this->request->params['action'];
$this->_methodsRequired($controller);
View
15 lib/Cake/Model/Model.php
@@ -2370,13 +2370,14 @@ public function delete($id = null, $cascade = true) {
break;
}
}
-
- $keys = $this->find('first', array(
- 'fields' => $this->_collectForeignKeys(),
- 'conditions' => array($this->alias . '.' . $this->primaryKey => $id),
- 'recursive' => -1,
- 'callbacks' => false
- ));
+ if ($updateCounterCache) {
+ $keys = $this->find('first', array(
+ 'fields' => $this->_collectForeignKeys(),
+ 'conditions' => array($this->alias . '.' . $this->primaryKey => $id),
+ 'recursive' => -1,
+ 'callbacks' => false
+ ));
+ }
}
if ($db->delete($this, array($this->alias . '.' . $this->primaryKey => $id))) {
View
6 lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php
@@ -147,8 +147,8 @@ public function testQuoting() {
public function testLocalizedFloats() {
$this->skipIf(DS === '\\', 'The locale is not supported in Windows and affect the others tests.');
- $restore = setlocale(LC_ALL, 0);
- setlocale(LC_ALL, 'de_DE');
+ $restore = setlocale(LC_NUMERIC, 0);
+ setlocale(LC_NUMERIC, 'de_DE');
$result = $this->Dbo->value(3.141593);
$this->assertEquals('3.141593', $result);
@@ -171,7 +171,7 @@ public function testLocalizedFloats() {
$result = $this->db->value(2.2E-54);
$this->assertEquals('2.2E-54', (string)$result);
- setlocale(LC_ALL, $restore);
+ setlocale(LC_NUMERIC, $restore);
}
/**
View
16 lib/Cake/Test/Case/Utility/CakeNumberTest.php
@@ -485,6 +485,22 @@ public function testToReadableSize() {
}
/**
+ * test toReadableSize() with locales
+ *
+ * @return void
+ */
+ public function testReadableSizeLocalized() {
+ $restore = setlocale(LC_ALL, 0);
+ setlocale(LC_ALL, 'de_DE');
+ $result = $this->Number->toReadableSize(1321205);
+ $this->assertRegExp('/1[,.]26 MB/', $result);
+
+ $result = $this->Number->toReadableSize(1024 * 1024 * 1024 * 512);
+ $this->assertRegExp('/512[,.]00 GB/', $result);
+ setlocale(LC_ALL, $restore);
+ }
+
+/**
* testToPercentage method
*
* @return void
View
4 lib/Cake/Utility/CakeNumber.php
@@ -70,13 +70,13 @@ class CakeNumber {
/**
* Formats a number with a level of precision.
*
- * @param float $number A floating point number.
+ * @param float $number A floating point number.
* @param integer $precision The precision of the returned number.
* @return float Formatted float.
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/number.html#NumberHelper::precision
*/
public static function precision($number, $precision = 3) {
- return sprintf("%01.{$precision}f", $number);
+ return sprintf("%01.{$precision}F", $number);
}
/**

0 comments on commit 03e2263

Please sign in to comment.