Permalink
Browse files

Merge branch '2.0' into 2.1

Conflicts:
	lib/Cake/Test/Case/Model/ModelReadTest.php
	lib/Cake/Utility/Debugger.php
  • Loading branch information...
2 parents c8fd7c0 + 7339640 commit 389072708a9d507ff16d15cf40cd5796633a612e @ADmad ADmad committed Dec 21, 2011
Showing with 533 additions and 431 deletions.
  1. +2 −2 lib/Cake/Cache/Engine/FileEngine.php
  2. +1 −1 lib/Cake/Cache/Engine/MemcacheEngine.php
  3. +2 −2 lib/Cake/Console/Command/ApiShell.php
  4. +3 −3 lib/Cake/Console/Command/Task/ProjectTask.php
  5. +1 −0 lib/Cake/Console/Command/UpgradeShell.php
  6. +4 −4 lib/Cake/Controller/Component/AclComponent.php
  7. +1 −1 lib/Cake/Controller/Component/AuthComponent.php
  8. +3 −3 lib/Cake/Controller/Controller.php
  9. +1 −1 lib/Cake/Core/App.php
  10. +3 −3 lib/Cake/I18n/I18n.php
  11. +1 −1 lib/Cake/I18n/Multibyte.php
  12. +1 −1 lib/Cake/Model/AclNode.php
  13. +1 −0 lib/Cake/Model/Aco.php
  14. +1 −0 lib/Cake/Model/Aro.php
  15. +2 −2 lib/Cake/Model/Behavior/ContainableBehavior.php
  16. +20 −20 lib/Cake/Model/Behavior/TranslateBehavior.php
  17. +8 −9 lib/Cake/Model/Behavior/TreeBehavior.php
  18. +2 −2 lib/Cake/Model/Datasource/CakeSession.php
  19. +8 −8 lib/Cake/Model/Datasource/Database/Postgres.php
  20. +1 −1 lib/Cake/Model/Datasource/Database/Sqlite.php
  21. +1 −1 lib/Cake/Model/Datasource/Database/Sqlserver.php
  22. +1 −1 lib/Cake/Model/Datasource/DboSource.php
  23. +4 −11 lib/Cake/Model/Model.php
  24. +1 −1 lib/Cake/Network/CakeResponse.php
  25. +2 −2 lib/Cake/Network/CakeSocket.php
  26. +3 −3 lib/Cake/Routing/Dispatcher.php
  27. +11 −11 lib/Cake/Test/Case/Cache/Engine/MemcacheEngineTest.php
  28. +3 −3 lib/Cake/Test/Case/Console/Command/AclShellTest.php
  29. +4 −4 lib/Cake/Test/Case/Console/Command/Task/ExtractTaskTest.php
  30. +2 −2 lib/Cake/Test/Case/Console/Command/Task/ModelTaskTest.php
  31. +1 −1 lib/Cake/Test/Case/Console/Command/Task/ProjectTaskTest.php
  32. +2 −2 lib/Cake/Test/Case/Console/ShellTest.php
  33. +7 −24 lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php
  34. +6 −6 lib/Cake/Test/Case/Controller/ScaffoldTest.php
  35. +5 −5 lib/Cake/Test/Case/Core/AppTest.php
  36. +3 −3 lib/Cake/Test/Case/Model/Behavior/ContainableBehaviorTest.php
  37. +1 −1 lib/Cake/Test/Case/Model/Behavior/TranslateBehaviorTest.php
  38. +51 −0 lib/Cake/Test/Case/Model/Behavior/TreeBehaviorNumberTest.php
  39. +1 −1 lib/Cake/Test/Case/Model/ConnectionManagerTest.php
  40. +1 −1 lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php
  41. +4 −4 lib/Cake/Test/Case/Model/Datasource/Database/PostgresTest.php
  42. +1 −1 lib/Cake/Test/Case/Model/DbAclTest.php
  43. +7 −7 lib/Cake/Test/Case/Model/ModelDeleteTest.php
  44. +25 −2 lib/Cake/Test/Case/Model/ModelIntegrationTest.php
  45. +1 −1 lib/Cake/Test/Case/Model/ModelReadTest.php
  46. +11 −11 lib/Cake/Test/Case/Model/ModelWriteTest.php
  47. +5 −5 lib/Cake/Test/Case/Model/models.php
  48. +14 −14 lib/Cake/Test/Case/Network/Email/CakeEmailTest.php
  49. +4 −2 lib/Cake/Test/Case/Routing/DispatcherTest.php
  50. +6 −6 lib/Cake/Test/Case/Utility/DebuggerTest.php
  51. +2 −2 lib/Cake/Test/Case/Utility/FileTest.php
  52. +0 −1 lib/Cake/Test/Case/Utility/FolderTest.php
  53. +2 −2 lib/Cake/Test/Case/Utility/InflectorTest.php
  54. +43 −43 lib/Cake/Test/Case/Utility/SetTest.php
  55. +1 −1 lib/Cake/Test/Case/Utility/ValidationTest.php
  56. +33 −14 lib/Cake/Test/Case/View/Helper/CacheHelperTest.php
  57. +14 −2 lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php
  58. +2 −2 lib/Cake/Test/Case/View/Helper/JsHelperTest.php
  59. +6 −6 lib/Cake/Test/Case/View/Helper/NumberHelperTest.php
  60. +3 −3 lib/Cake/Test/Case/View/Helper/TextHelperTest.php
  61. +2 −2 lib/Cake/Test/Fixture/CounterCachePostFixture.php
  62. +2 −2 lib/Cake/Test/Fixture/CounterCachePostNonstandardPrimaryKeyFixture.php
  63. +30 −26 lib/Cake/Test/Fixture/GroupUpdateAllFixture.php
  64. +33 −30 lib/Cake/Test/Fixture/ProductUpdateAllFixture.php
  65. +1 −1 lib/Cake/Test/test_app/View/Pages/home.ctp
  66. +3 −0 lib/Cake/TestSuite/CakeTestCase.php
  67. +1 −1 lib/Cake/TestSuite/CakeTestRunner.php
  68. +9 −11 lib/Cake/TestSuite/CakeTestSuiteCommand.php
  69. +1 −1 lib/Cake/TestSuite/Reporter/CakeHtmlReporter.php
  70. +1 −1 lib/Cake/TestSuite/Reporter/CakeTextReporter.php
  71. +8 −8 lib/Cake/Utility/Debugger.php
  72. +1 −1 lib/Cake/Utility/File.php
  73. +20 −8 lib/Cake/Utility/Folder.php
  74. +1 −1 lib/Cake/Utility/Inflector.php
  75. +2 −2 lib/Cake/Utility/Set.php
  76. +1 −1 lib/Cake/Utility/String.php
  77. +17 −15 lib/Cake/Utility/Validation.php
  78. +2 −2 lib/Cake/View/Helper/CacheHelper.php
  79. +0 −4 lib/Cake/View/Helper/FormHelper.php
  80. +9 −9 lib/Cake/View/Helper/HtmlHelper.php
  81. +9 −9 lib/Cake/View/Helper/JsBaseEngineHelper.php
  82. +1 −1 lib/Cake/View/Helper/TextHelper.php
  83. +4 −4 lib/Cake/View/Helper/TimeHelper.php
  84. +4 −4 lib/Cake/View/Scaffolds/view.ctp
  85. +11 −11 lib/Cake/bootstrap.php
@@ -129,14 +129,14 @@ public function write($key, $data, $duration) {
$contents = $expires . $lineBreak . $data . $lineBreak;
if ($this->settings['lock']) {
- $this->_File->flock(LOCK_EX);
+ $this->_File->flock(LOCK_EX);
}
$this->_File->rewind();
$success = $this->_File->ftruncate(0) && $this->_File->fwrite($contents) && $this->_File->fflush();
if ($this->settings['lock']) {
- $this->_File->flock(LOCK_UN);
+ $this->_File->flock(LOCK_UN);
}
return $success;
@@ -104,7 +104,7 @@ protected function _parseServerString($server) {
$position++;
}
} else {
- $position = strpos($server, ':');
+ $position = strpos($server, ':');
}
$port = 11211;
$host = $server;
@@ -101,7 +101,7 @@ public function main() {
$this->_stop();
}
$method = $parsed[$this->params['method']];
- $this->out($class .'::'.$method['method'] . $method['parameters']);
+ $this->out($class . '::' . $method['method'] . $method['parameters']);
$this->hr();
$this->out($method['comment'], true);
} else {
@@ -127,7 +127,7 @@ public function main() {
if (isset($methods[--$number])) {
$method = $parsed[$methods[$number]];
$this->hr();
- $this->out($class .'::'.$method['method'] . $method['parameters']);
+ $this->out($class . '::' . $method['method'] . $method['parameters']);
$this->hr();
$this->out($method['comment'], true);
}
@@ -269,7 +269,7 @@ public function securitySalt($path) {
$contents = $File->read();
if (preg_match('/([\s]*Configure::write\(\'Security.salt\',[\s\'A-z0-9]*\);)/', $contents, $match)) {
$string = Security::generateAuthKey();
- $result = str_replace($match[0], "\t" . 'Configure::write(\'Security.salt\', \''.$string.'\');', $contents);
+ $result = str_replace($match[0], "\t" . 'Configure::write(\'Security.salt\', \'' . $string . '\');', $contents);
if ($File->write($result)) {
return true;
}
@@ -290,7 +290,7 @@ public function securityCipherSeed($path) {
if (preg_match('/([\s]*Configure::write\(\'Security.cipherSeed\',[\s\'A-z0-9]*\);)/', $contents, $match)) {
App::uses('Security', 'Utility');
$string = substr(bin2hex(Security::generateAuthKey()), 0, 30);
- $result = str_replace($match[0], "\t" . 'Configure::write(\'Security.cipherSeed\', \''.$string.'\');', $contents);
+ $result = str_replace($match[0], "\t" . 'Configure::write(\'Security.cipherSeed\', \'' . $string . '\');', $contents);
if ($File->write($result)) {
return true;
}
@@ -357,7 +357,7 @@ public function cakeAdmin($name) {
$File = new File($path . 'core.php');
$contents = $File->read();
if (preg_match('%(\s*[/]*Configure::write\(\'Routing.prefixes\',[\s\'a-z,\)\(]*\);)%', $contents, $match)) {
- $result = str_replace($match[0], "\n" . 'Configure::write(\'Routing.prefixes\', array(\''.$name.'\'));', $contents);
+ $result = str_replace($match[0], "\n" . 'Configure::write(\'Routing.prefixes\', array(\'' . $name . '\'));', $contents);
if ($File->write($result)) {
Configure::write('Routing.prefixes', array($name));
return true;
@@ -222,6 +222,7 @@ public function helpers() {
$plugins = App::objects('plugin');
$pluginHelpers = array();
foreach ($plugins as $plugin) {
+ CakePlugin::load($plugin);
$pluginHelpers = array_merge(
$pluginHelpers,
App::objects('helper', App::pluginPath($plugin) . DS . 'views' . DS . 'helpers' . DS, false)
@@ -488,11 +488,11 @@ public function getAclLink($aro, $aco) {
}
return array(
- 'aro' => Set::extract($obj, 'Aro.0.'.$this->Aro->alias.'.id'),
- 'aco' => Set::extract($obj, 'Aco.0.'.$this->Aco->alias.'.id'),
+ 'aro' => Set::extract($obj, 'Aro.0.' . $this->Aro->alias . '.id'),
+ 'aco' => Set::extract($obj, 'Aco.0.' . $this->Aco->alias . '.id'),
'link' => $this->Aro->Permission->find('all', array('conditions' => array(
- $this->Aro->Permission->alias . '.aro_id' => Set::extract($obj, 'Aro.0.'.$this->Aro->alias.'.id'),
- $this->Aro->Permission->alias . '.aco_id' => Set::extract($obj, 'Aco.0.'.$this->Aco->alias.'.id')
+ $this->Aro->Permission->alias . '.aro_id' => Set::extract($obj, 'Aro.0.' . $this->Aro->alias . '.id'),
+ $this->Aro->Permission->alias . '.aco_id' => Set::extract($obj, 'Aco.0.' . $this->Aco->alias . '.id')
)))
);
}
@@ -314,7 +314,7 @@ public function startup($controller) {
if (!$this->_getUser()) {
if (!$request->is('ajax')) {
$this->flash($this->authError);
- $this->Session->write('Auth.redirect', Router::reverse($request));
+ $this->Session->write('Auth.redirect', $request->here());
$controller->redirect($loginAction);
return false;
} elseif (!empty($this->ajaxLogin)) {
@@ -981,7 +981,7 @@ public function postConditions($data = array(), $op = null, $bool = 'AND', $excl
$arrayOp = is_array($op);
foreach ($data as $model => $fields) {
foreach ($fields as $field => $value) {
- $key = $model.'.'.$field;
+ $key = $model . '.' . $field;
$fieldOp = $op;
if ($arrayOp) {
if (array_key_exists($key, $op)) {
@@ -998,9 +998,9 @@ public function postConditions($data = array(), $op = null, $bool = 'AND', $excl
$fieldOp = strtoupper(trim($fieldOp));
if ($fieldOp === 'LIKE') {
$key = $key.' LIKE';
- $value = '%'.$value.'%';
+ $value = '%' . $value . '%';
} elseif ($fieldOp && $fieldOp != '=') {
- $key = $key.' '.$fieldOp;
+ $key = $key.' ' . $fieldOp;
}
$cond[$key] = $value;
}
View
@@ -681,7 +681,7 @@ protected static function _loadClass($name, $plugin, $type, $originalType, $pare
}
App::uses($extends, $extendType);
if ($plugin && in_array($originalType, array('controller', 'model'))) {
- App::uses($plugin . $extends, $plugin . '.' .$type);
+ App::uses($plugin . $extends, $plugin . '.' . $type);
}
}
if ($plugin) {
View
@@ -164,7 +164,7 @@ public static function translate($singular, $plural = null, $domain = null, $cat
}
if ($_this->category == 'LC_TIME') {
- return $_this->_translateTime($singular,$domain);
+ return $_this->_translateTime($singular, $domain);
}
if (!isset($count)) {
@@ -466,7 +466,7 @@ protected function _loadPo($file, $domain) {
} while (!feof($file));
fclose($file);
$merge[""] = $header;
- return $this->_domains[$domain][$this->_lang][$this->category] = array_merge($merge ,$translations);
+ return $this->_domains[$domain][$this->_lang][$this->category] = array_merge($merge, $translations);
}
/**
@@ -486,7 +486,7 @@ protected function _loadLocaleDefinition($file, $domain = null) {
if (empty($line) || $line[0] === $comment) {
continue;
}
- $parts = preg_split("/[[:space:]]+/",$line);
+ $parts = preg_split("/[[:space:]]+/", $line);
if ($parts[0] === 'comment_char') {
$comment = $parts[1];
continue;
@@ -893,7 +893,7 @@ public static function strtoupper($string) {
* @param string $haystack The string being checked.
* @param string $needle The string being found.
* @return integer The number of times the $needle substring occurs in the $haystack string.
- */
+ */
public static function substrCount($haystack, $needle) {
$count = 0;
$haystack = Multibyte::utf8($haystack);
@@ -95,7 +95,7 @@ public function node($ref = null) {
$queryData['joins'][] = array(
'table' => $table,
'alias' => "{$type}{$i}",
- 'type' => 'LEFT',
+ 'type' => 'LEFT',
'conditions' => array(
$db->name("{$type}{$i}.lft") . ' > ' . $db->name("{$type}{$j}.lft"),
$db->name("{$type}{$i}.rght") . ' < ' . $db->name("{$type}{$j}.rght"),
View
@@ -17,6 +17,7 @@
*/
App::uses('AppModel', 'Model');
+App::uses('AclNode', 'Model');
/**
* Access Control Object
View
@@ -17,6 +17,7 @@
*/
App::uses('AppModel', 'Model');
+App::uses('AclNode', 'Model');
/**
* Access Request Object
@@ -308,10 +308,10 @@ public function containments($Model, $contain, $containments = array(), $throwEr
$val = preg_split('/\s*,\s*/', substr(substr($key, 1), 0, -1));
} elseif (preg_match('/ASC|DESC$/', $key)) {
$option = 'order';
- $val = $Model->{$name}->alias.'.'.$key;
+ $val = $Model->{$name}->alias . '.' . $key;
} elseif (preg_match('/[ =!]/', $key)) {
$option = 'conditions';
- $val = $Model->{$name}->alias.'.'.$key;
+ $val = $Model->{$name}->alias . '.' . $key;
}
$children[$option] = is_array($val) ? $val : array($val);
$newChildren = null;
@@ -104,8 +104,8 @@ public function beforeFind($model, $query) {
$joinTable->table = $RuntimeModel->table;
$joinTable->schemaName = $RuntimeModel->getDataSource()->getSchemaName();
- if (is_string($query['fields']) && 'COUNT(*) AS '.$db->name('count') == $query['fields']) {
- $query['fields'] = 'COUNT(DISTINCT('.$db->name($model->alias . '.' . $model->primaryKey) . ')) ' . $db->alias . 'count';
+ if (is_string($query['fields']) && 'COUNT(*) AS ' . $db->name('count') == $query['fields']) {
+ $query['fields'] = 'COUNT(DISTINCT(' . $db->name($model->alias . '.' . $model->primaryKey) . ')) ' . $db->alias . 'count';
$query['joins'][] = array(
'type' => 'INNER',
'alias' => $RuntimeModel->alias,
@@ -127,7 +127,7 @@ public function beforeFind($model, $query) {
foreach ($fields as $key => $value) {
$field = (is_numeric($key)) ? $value : $key;
- if (in_array($model->alias.'.*', $query['fields']) || in_array($model->alias.'.'.$field, $query['fields']) || in_array($field, $query['fields'])) {
+ if (in_array($model->alias.'.*', $query['fields']) || in_array($model->alias.'.' . $field, $query['fields']) || in_array($field, $query['fields'])) {
$addFields[] = $field;
}
}
@@ -138,7 +138,7 @@ public function beforeFind($model, $query) {
foreach ($addFields as $_f => $field) {
$aliasField = is_numeric($_f) ? $field : $_f;
- foreach (array($aliasField, $model->alias.'.'.$aliasField) as $_field) {
+ foreach (array($aliasField, $model->alias . '.' . $aliasField) as $_field) {
$key = array_search($_field, (array)$query['fields']);
if ($key !== false) {
@@ -148,36 +148,36 @@ public function beforeFind($model, $query) {
if (is_array($locale)) {
foreach ($locale as $_locale) {
- $model->virtualFields['i18n_'.$field.'_'.$_locale] = 'I18n__'.$field.'__'.$_locale.'.content';
+ $model->virtualFields['i18n_' . $field . '_' . $_locale] = 'I18n__' . $field . '__' . $_locale . '.content';
if (!empty($query['fields'])) {
- $query['fields'][] = 'i18n_'.$field.'_'.$_locale;
+ $query['fields'][] = 'i18n_' . $field . '_' . $_locale;
}
$query['joins'][] = array(
'type' => 'LEFT',
- 'alias' => 'I18n__'.$field.'__'.$_locale,
+ 'alias' => 'I18n__' . $field . '__' . $_locale,
'table' => $joinTable,
'conditions' => array(
$model->alias . '.' . $model->primaryKey => $db->identifier("I18n__{$field}__{$_locale}.foreign_key"),
- 'I18n__'.$field.'__'.$_locale.'.model' => $model->name,
- 'I18n__'.$field.'__'.$_locale.'.'.$RuntimeModel->displayField => $aliasField,
- 'I18n__'.$field.'__'.$_locale.'.locale' => $_locale
+ 'I18n__' . $field . '__' . $_locale . '.model' => $model->name,
+ 'I18n__' . $field . '__' . $_locale . '.' . $RuntimeModel->displayField => $aliasField,
+ 'I18n__' . $field . '__' . $_locale . '.locale' => $_locale
)
);
}
} else {
- $model->virtualFields['i18n_'.$field] = 'I18n__'.$field.'.content';
+ $model->virtualFields['i18n_' . $field] = 'I18n__' . $field . '.content';
if (!empty($query['fields'])) {
- $query['fields'][] = 'i18n_'.$field;
+ $query['fields'][] = 'i18n_' . $field;
}
$query['joins'][] = array(
'type' => 'INNER',
- 'alias' => 'I18n__'.$field,
+ 'alias' => 'I18n__' . $field,
'table' => $joinTable,
'conditions' => array(
$model->alias . '.' . $model->primaryKey => $db->identifier("I18n__{$field}.foreign_key"),
- 'I18n__'.$field.'.model' => $model->name,
- 'I18n__'.$field.'.'.$RuntimeModel->displayField => $aliasField,
- 'I18n__'.$field.'.locale' => $locale
+ 'I18n__' . $field . '.model' => $model->name,
+ 'I18n__' . $field . '.' . $RuntimeModel->displayField => $aliasField,
+ 'I18n__' . $field . '.locale' => $locale
)
);
}
@@ -212,11 +212,11 @@ public function afterFind($model, $results, $primary) {
if (is_array($locale)) {
foreach ($locale as $_locale) {
- if (!isset($row[$model->alias][$aliasField]) && !empty($row[$model->alias]['i18n_'.$field.'_'.$_locale])) {
- $row[$model->alias][$aliasField] = $row[$model->alias]['i18n_'.$field.'_'.$_locale];
+ if (!isset($row[$model->alias][$aliasField]) && !empty($row[$model->alias]['i18n_' . $field . '_' . $_locale])) {
+ $row[$model->alias][$aliasField] = $row[$model->alias]['i18n_' . $field . '_' . $_locale];
$row[$model->alias]['locale'] = $_locale;
}
- unset($row[$model->alias]['i18n_'.$field.'_'.$_locale]);
+ unset($row[$model->alias]['i18n_' . $field . '_' . $_locale]);
}
if (!isset($row[$model->alias][$aliasField])) {
@@ -421,7 +421,7 @@ public function bindTranslation($model, $fields, $reset = true) {
foreach (array('hasOne', 'hasMany', 'belongsTo', 'hasAndBelongsToMany') as $type) {
if (isset($model->{$type}[$association]) || isset($model->__backAssociation[$type][$association])) {
trigger_error(
- __d('cake_dev', 'Association %s is already binded to model %s', $association, $model->alias),
+ __d('cake_dev', 'Association %s is already bound to model %s', $association, $model->alias),
E_USER_ERROR
);
return false;
@@ -163,8 +163,8 @@ public function beforeSave($Model) {
$this->_addToWhitelist($Model, $parent);
} else {
$values = $Model->find('first', array(
- 'conditions' => array($scope,$Model->escapeField() => $Model->id),
- 'fields' => array($Model->primaryKey, $parent, $left, $right ), 'recursive' => $recursive)
+ 'conditions' => array($scope, $Model->escapeField() => $Model->id),
+ 'fields' => array($Model->primaryKey, $parent, $left, $right), 'recursive' => $recursive)
);
if ($values === false) {
@@ -503,7 +503,7 @@ public function moveUp($Model, $id = null, $number = 1) {
extract($this->settings[$Model->alias]);
list($node) = array_values($Model->find('first', array(
'conditions' => array($scope, $Model->escapeField() => $id),
- 'fields' => array($Model->primaryKey, $left, $right, $parent ), 'recursive' => $recursive
+ 'fields' => array($Model->primaryKey, $left, $right, $parent), 'recursive' => $recursive
)));
if ($node[$parent]) {
list($parentNode) = array_values($Model->find('first', array(
@@ -527,7 +527,7 @@ public function moveUp($Model, $id = null, $number = 1) {
}
$edge = $this->_getMax($Model, $scope, $right, $recursive);
$this->_sync($Model, $edge - $previousNode[$left] +1, '+', 'BETWEEN ' . $previousNode[$left] . ' AND ' . $previousNode[$right]);
- $this->_sync($Model, $node[$left] - $previousNode[$left], '-', 'BETWEEN ' .$node[$left] . ' AND ' . $node[$right]);
+ $this->_sync($Model, $node[$left] - $previousNode[$left], '-', 'BETWEEN ' . $node[$left] . ' AND ' . $node[$right]);
$this->_sync($Model, $edge - $previousNode[$left] - ($node[$right] - $node[$left]), '-', '> ' . $edge);
if (is_int($number)) {
$number--;
@@ -577,7 +577,6 @@ public function recover($Model, $mode = 'parent', $missingParentAction = null) {
if ($missingParentAction == 'return') {
foreach ($missingParents as $id => $display) {
$this->errors[] = 'cannot find the parent for ' . $Model->alias . ' with id ' . $id . '(' . $display . ')';
-
}
return false;
} elseif ($missingParentAction == 'delete') {
@@ -588,13 +587,14 @@ public function recover($Model, $mode = 'parent', $missingParentAction = null) {
}
$count = 1;
foreach ($Model->find('all', array('conditions' => $scope, 'fields' => array($Model->primaryKey), 'order' => $left)) as $array) {
- $Model->id = $array[$Model->alias][$Model->primaryKey];
$lft = $count++;
$rght = $count++;
+ $Model->create(false);
+ $Model->id = $array[$Model->alias][$Model->primaryKey];
$Model->save(array($left => $lft, $right => $rght), array('callbacks' => false));
}
foreach ($Model->find('all', array('conditions' => $scope, 'fields' => array($Model->primaryKey, $parent), 'order' => $left)) as $array) {
- $Model->create();
+ $Model->create(false);
$Model->id = $array[$Model->alias][$Model->primaryKey];
$this->_setParent($Model, $array[$Model->alias][$parent]);
}
@@ -846,11 +846,10 @@ protected function _setParent($Model, $parentId = null, $created = false) {
if (($Model->id == $parentId)) {
return false;
-
} elseif (($node[$left] < $parentNode[$left]) && ($parentNode[$right] < $node[$right])) {
return false;
}
- if (empty ($node[$left]) && empty ($node[$right])) {
+ if (empty($node[$left]) && empty($node[$right])) {
$this->_sync($Model, 2, '+', '>= ' . $parentNode[$right], $created);
$result = $Model->save(
array($left => $parentNode[$right], $right => $parentNode[$right] + 1, $parent => $parentId),
@@ -158,10 +158,10 @@ protected static function _setPath($base = null) {
return;
}
if (strpos($base, 'index.php') !== false) {
- $base = str_replace('index.php', '', $base);
+ $base = str_replace('index.php', '', $base);
}
if (strpos($base, '?') !== false) {
- $base = str_replace('?', '', $base);
+ $base = str_replace('?', '', $base);
}
self::$path = $base;
}
Oops, something went wrong.

0 comments on commit 3890727

Please sign in to comment.