Permalink
Browse files

Merge branch '1.3' into 1.3-misc

  • Loading branch information...
markstory committed Nov 4, 2009
2 parents f5ca3ac + 12c7203 commit dc07a05fcada1c0c39aacb6ff5a40bd85453b3aa
Showing with 675 additions and 510 deletions.
  1. +1 −1 cake/VERSION.txt
  2. +1 −1 cake/config/config.php
  3. +2 −0 cake/console/libs/templates/skel/views/layouts/xml/default.ctp
  4. +6 −6 cake/libs/cake_session.php
  5. +3 −3 cake/libs/controller/components/auth.php
  6. +11 −6 cake/libs/controller/components/cookie.php
  7. +3 −0 cake/libs/controller/controller.php
  8. +2 −10 cake/libs/debugger.php
  9. +1 −1 cake/libs/folder.php
  10. +1 −1 cake/libs/http_socket.php
  11. +4 −1 cake/libs/model/behaviors/tree.php
  12. +31 −13 cake/libs/model/datasources/datasource.php
  13. +11 −1 cake/libs/model/datasources/dbo/dbo_adodb.php
  14. +8 −0 cake/libs/model/datasources/dbo/dbo_db2.php
  15. +9 −0 cake/libs/model/datasources/dbo/dbo_firebird.php
  16. +8 −0 cake/libs/model/datasources/dbo/dbo_mssql.php
  17. +42 −46 cake/libs/model/datasources/dbo/dbo_mysql.php
  18. +8 −58 cake/libs/model/datasources/dbo/dbo_mysqli.php
  19. +8 −0 cake/libs/model/datasources/dbo/dbo_odbc.php
  20. +9 −0 cake/libs/model/datasources/dbo/dbo_postgres.php
  21. +8 −0 cake/libs/model/datasources/dbo/dbo_sqlite.php
  22. +8 −0 cake/libs/model/datasources/dbo/dbo_sybase.php
  23. +3 −1 cake/libs/model/datasources/dbo_source.php
  24. +3 −0 cake/libs/string.php
  25. +13 −16 cake/libs/view/helpers/cache.php
  26. +8 −4 cake/libs/view/helpers/form.php
  27. +6 −4 cake/libs/view/helpers/paginator.php
  28. +28 −1 cake/libs/view/pages/home.ctp
  29. +1 −1 cake/tests/cases/console/libs/api.test.php
  30. +5 −6 cake/tests/cases/console/libs/tasks/model.test.php
  31. +2 −0 cake/tests/cases/libs/cake_test_case.test.php
  32. +1 −1 cake/tests/cases/libs/code_coverage_manager.test.php
  33. +15 −3 cake/tests/cases/libs/controller/component.test.php
  34. +2 −7 cake/tests/cases/libs/controller/components/email.test.php
  35. +4 −1 cake/tests/cases/libs/controller/components/request_handler.test.php
  36. +1 −0 cake/tests/cases/libs/controller/components/security.test.php
  37. +4 −1 cake/tests/cases/libs/controller/controller.test.php
  38. +8 −1 cake/tests/cases/libs/controller/controller_merge_vars.test.php
  39. +1 −0 cake/tests/cases/libs/debugger.test.php
  40. +12 −0 cake/tests/cases/libs/folder.test.php
  41. +22 −0 cake/tests/cases/libs/http_socket.test.php
  42. +3 −3 cake/tests/cases/libs/i18n.test.php
  43. +19 −0 cake/tests/cases/libs/model/behaviors/tree.test.php
  44. +30 −12 cake/tests/cases/libs/model/datasources/dbo/dbo_mysql.test.php
  45. +14 −5 cake/tests/cases/libs/model/datasources/dbo/dbo_mysqli.test.php
  46. +5 −2 cake/tests/cases/libs/model/datasources/dbo/dbo_postgres.test.php
  47. +4 −0 cake/tests/cases/libs/multibyte.test.php
  48. +5 −0 cake/tests/cases/libs/string.test.php
  49. +4 −0 cake/tests/cases/libs/validation.test.php
  50. +6 −0 cake/tests/cases/libs/view/helpers/ajax.test.php
  51. +218 −179 cake/tests/cases/libs/view/helpers/form.test.php
  52. +1 −1 cake/tests/cases/libs/view/helpers/javascript.test.php
  53. +17 −50 cake/tests/cases/libs/view/helpers/time.test.php
  54. +18 −1 cake/tests/groups/console.group.php
  55. +6 −3 cake/tests/groups/controller.group.php
  56. +1 −1 cake/tests/groups/lib.group.php
  57. +0 −58 cake/tests/groups/no_database.group.php
View
@@ -17,4 +17,4 @@
// @license MIT License (http://www.opensource.org/licenses/mit-license.php)
// +--------------------------------------------------------------------------------------------+ //
////////////////////////////////////////////////////////////////////////////////////////////////////
-1.3.0.0
+1.3.0-alpha
View
@@ -19,5 +19,5 @@
* @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.0';
+return $config['Cake.version'] = '1.3.0-alpha';
?>
@@ -0,0 +1,2 @@
+<?php echo $xml->header(); ?>
+<?php echo $content_for_layout; ?>
View
@@ -641,15 +641,15 @@ function _checkValid() {
function __regenerateId() {
$oldSessionId = session_id();
if ($oldSessionId) {
- $sessionpath = session_save_path();
- if (empty($sessionpath)) {
- $sessionpath = "/tmp";
- }
- if (session_id() != "" || isset($_COOKIE[session_name()])) {
+ if (session_id() != ''|| isset($_COOKIE[session_name()])) {
setcookie(Configure::read('Session.cookie'), '', time() - 42000, $this->path);
}
session_regenerate_id(true);
if (PHP_VERSION < 5.1) {
+ $sessionPath = session_save_path();
+ if (empty($sessionPath)) {
+ $sessionPath = '/tmp';
+ }
$newSessid = session_id();
if (function_exists('session_write_close')) {
@@ -659,7 +659,7 @@ function __regenerateId() {
session_id($oldSessionId);
session_start();
session_destroy();
- $file = $sessionpath . DS . "sess_$oldSessionId";
+ $file = $sessionPath . DS . 'sess_' . $oldSessionId;
@unlink($file);
$this->__initSession();
session_id($newSessid);
@@ -450,10 +450,10 @@ function __setDefaults() {
return false;
}
$defaults = array(
- 'loginAction' => Router::normalize(array(
- 'controller'=> Inflector::underscore(Inflector::pluralize($this->userModel)),
+ 'loginAction' => array(
+ 'controller' => Inflector::underscore(Inflector::pluralize($this->userModel)),
'action' => 'login'
- )),
+ ),
'sessionKey' => 'Auth.' . $this->userModel,
'logoutRedirect' => $this->loginAction,
'loginError' => __('Login failed. Invalid username or password.', true),
@@ -215,15 +215,15 @@ function write($key, $value = null, $encrypt = true, $expires = null) {
foreach ($key as $name => $value) {
if (strpos($name, '.') === false) {
$this->__values[$name] = $value;
- $this->__write(".$name", $value);
+ $this->__write("[$name]", $value);
} else {
$names = explode('.', $name, 2);
if (!isset($this->__values[$names[0]])) {
$this->__values[$names[0]] = array();
}
$this->__values[$names[0]] = Set::insert($this->__values[$names[0]], $names[1], $value);
- $this->__write("." . implode('.', $names), $value);
+ $this->__write('[' . implode('][', $names) . ']', $value);
}
}
$this->__encrypted = true;
@@ -289,12 +289,12 @@ function delete($key) {
}
if (strpos($key, '.') === false) {
unset($this->__values[$key]);
- $this->__delete(".$key");
+ $this->__delete("[$key]");
return;
}
$names = explode('.', $key, 2);
$this->__values[$names[0]] = Set::remove($this->__values[$names[0]], $names[1]);
- $this->__delete("." . implode('.', $names));
+ $this->__delete('[' . implode('][', $names) . ']');
}
/**
@@ -315,11 +315,11 @@ function destroy() {
if (is_array($value)) {
foreach ($value as $key => $val) {
unset($this->__values[$name][$key]);
- $this->__delete(".$name.$key");
+ $this->__delete("[$name][$key]");
}
}
unset($this->__values[$name]);
- $this->__delete(".$name");
+ $this->__delete("[$name]");
}
}
@@ -354,6 +354,11 @@ function __expire($expires = null) {
return $this->__expires;
}
$this->__reset = $this->__expires;
+
+ if ($expires == 0) {
+ return $this->__expires = 0;
+ }
+
if (is_integer($expires) || is_numeric($expires)) {
return $this->__expires = $now + intval($expires);
}
@@ -74,6 +74,9 @@ class Controller extends Object {
*
* Example: var $uses = array('Product', 'Post', 'Comment');
*
+ * Can be set to array() to use no models. Can be set to false to
+ * use no models and prevent the merging of $uses with AppController
+ *
* @var mixed A single name as a string or a list of names as an array.
* @access protected
* @link http://book.cakephp.org/view/53/components-helpers-and-uses
View
@@ -229,16 +229,8 @@ function dump($var) {
*/
function log($var, $level = LOG_DEBUG) {
$_this = Debugger::getInstance();
- $trace = $_this->trace(array('start' => 1, 'depth' => 2, 'format' => 'array'));
- $source = null;
-
- if (is_object($trace[0]['object']) && isset($trace[0]['object']->_reporter->_test_stack)) {
- $stack = $trace[0]['object']->_reporter->_test_stack;
- $source = sprintf('[%1$s, %3$s::%2$s()]' . "\n",
- array_shift($stack), array_pop($stack), array_pop($stack));
- }
-
- CakeLog::write($level, $source . $_this->exportVar($var));
+ $source = $_this->trace(array('start' => 1)) . "\n";
+ CakeLog::write($level, "\n" . $source . $_this->exportVar($var));
}
/**
View
@@ -326,7 +326,7 @@ function slashTerm($path) {
* @static
*/
function addPathElement($path, $element) {
- return Folder::slashTerm($path) . $element;
+ return rtrim($path, DS) . DS . $element;
}
/**
@@ -693,7 +693,7 @@ function _parseQuery($query) {
foreach ($items as $item) {
if (strpos($item, '=') !== false) {
- list($key, $value) = explode('=', $item);
+ list($key, $value) = explode('=', $item, 2);
} else {
$key = $item;
$value = null;
@@ -474,7 +474,7 @@ function movedown(&$Model, $id = null, $number = 1) {
'fields' => array($Model->primaryKey, $left, $right), 'recursive' => $recursive)
);
if ($nextNode) {
- list($nextNode)= array_values($nextNode);
+ list($nextNode) = array_values($nextNode);
} else {
return false;
}
@@ -657,6 +657,8 @@ function reorder(&$Model, $options = array()) {
$sort = $field . ' ' . $order;
$nodes = $this->children($Model, $id, true, $fields, $sort, null, null, $recursive);
+ $cacheQueries = $Model->cacheQueries;
+ $Model->cacheQueries = false;
if ($nodes) {
foreach ($nodes as $node) {
$id = $node[$Model->alias][$Model->primaryKey];
@@ -666,6 +668,7 @@ function reorder(&$Model, $options = array()) {
}
}
}
+ $Model->cacheQueries = $cacheQueries;
return true;
}
@@ -320,45 +320,53 @@ function column($real) {
}
/**
+ * Used to create new records. The "C" CRUD.
+ *
* To-be-overridden in subclasses.
*
- * @param unknown_type $model
- * @param unknown_type $fields
- * @param unknown_type $values
- * @return unknown
+ * @param Model $model The Model to be created.
+ * @param array $fields An Array of fields to be saved.
+ * @param array $values An Array of values to save.
+ * @return boolean success
*/
function create(&$model, $fields = null, $values = null) {
return false;
}
/**
+ * Used to read records from the Datasource. The "R" in CRUD
+ *
* To-be-overridden in subclasses.
*
- * @param unknown_type $model
- * @param unknown_type $queryData
- * @return unknown
+ * @param Model $model The model being read.
+ * @param array $queryData An array of query data used to find the data you want
+ * @return mixed
*/
function read(&$model, $queryData = array()) {
return false;
}
/**
+ * Update a record(s) in the datasource.
+ *
* To-be-overridden in subclasses.
*
- * @param unknown_type $model
- * @param unknown_type $fields
- * @param unknown_type $values
- * @return unknown
+ * @param Model $model Instance of the model class being updated
+ * @param array $fields Array of fields to be updated
+ * @param array $values Array of values to be update $fields to.
+ * @return boolean Success
*/
function update(&$model, $fields = null, $values = null) {
return false;
}
/**
+ * Delete a record(s) in the datasource.
+ *
* To-be-overridden in subclasses.
*
- * @param unknown_type $model
- * @param unknown_type $id
+ * @param Model $model The model class having record(s) deleted
+ * @param mixed $id Primary key of the model
*/
function delete(&$model, $id = null) {
if ($id == null) {
@@ -396,6 +404,16 @@ function lastAffected($source = null) {
return false;
}
+/**
+ * Check whether the conditions for the Datasource being available
+ * are satisfied. Often used from connect() to check for support
+ * before establishing a connection.
+ *
+ * @return boolean Whether or not the Datasources conditions for use are met.
+ **/
+ function enabled() {
+ return true;
+ }
/**
* Returns true if the DataSource supports the given interface (method)
*
@@ -110,7 +110,9 @@ function connect() {
$adodb_driver = substr($config['connect'], 0, $persistent);
$connect = 'PConnect';
}
-
+ if (!$this->enabled()) {
+ return false;
+ }
$this->_adodb = NewADOConnection($adodb_driver);
$this->_adodbDataDict = NewDataDictionary($this->_adodb, $adodb_driver);
@@ -123,6 +125,14 @@ function connect() {
return $this->connected;
}
+/**
+ * Check that AdoDB is available.
+ *
+ * @return boolean
+ **/
+ function enabled() {
+ return function_exists('NewADOConnection');
+ }
/**
* Disconnects from database.
*
@@ -146,6 +146,14 @@ function connect() {
return $this->connected;
}
+/**
+ * Check that the DB2 extension is installed/loaded
+ *
+ * @return boolean
+ **/
+ function enabled() {
+ return extension_loaded('ibm_db2');
+ }
/**
* Disconnects from database.
*
@@ -140,10 +140,19 @@ function connect() {
$connect = $config['connect'];
$this->connected = false;
+
$this->connection = $connect($config['host'] . ':' . $config['database'], $config['login'], $config['password']);
$this->connected = true;
}
+/**
+ * Check that the interbase extension is loaded
+ *
+ * @return boolean
+ **/
+ function enabled() {
+ return extension_loaded('interbase');
+ }
/**
* Disconnects from database.
*
@@ -164,6 +164,14 @@ function connect() {
return $this->connected;
}
+/**
+ * Check that MsSQL is installed/loaded
+ *
+ * @return boolean
+ **/
+ function enabled() {
+ return extension_loaded('mssql');
+ }
/**
* Disconnects from database.
*
Oops, something went wrong.

0 comments on commit dc07a05

Please sign in to comment.