Skip to content

Commit

Permalink
Merge branch '1.3-deprecation' into 1.3-misc
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Sep 1, 2009
2 parents 71e93b9 + 3dc12cb commit 1bedd84
Show file tree
Hide file tree
Showing 11 changed files with 92 additions and 117 deletions.
19 changes: 11 additions & 8 deletions cake/libs/controller/components/cookie.php
@@ -1,6 +1,4 @@
<?php
/* SVN FILE: $Id$ */

/**
* Short description for file.
*
Expand All @@ -9,20 +7,17 @@
* PHP versions 4 and 5
*
* CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org)
* Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* Copyright 2005-2009, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @copyright Copyright 2005-2009, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.libs.controller.components
* @since CakePHP(tm) v 1.2.0.4213
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/

Expand Down Expand Up @@ -276,6 +271,14 @@ function read($key = null) {
}
}

/**
* @deprecated use delete()
**/
function del($key) {
trigger_error('Deprecated method, use CookieComponent::delete instead', E_USER_WARNING);
return $this->delete($key);
}

/**
* Delete a cookie value
*
Expand All @@ -289,7 +292,7 @@ function read($key = null) {
* @return void
* @access public
*/
function del($key) {
function delete($key) {
if (empty($this->__values)) {
$this->read();
}
Expand Down
20 changes: 5 additions & 15 deletions cake/libs/controller/components/session.php
@@ -1,6 +1,4 @@
<?php
/* SVN FILE: $Id$ */

/**
* Short description for file.
*
Expand All @@ -9,20 +7,17 @@
* PHP versions 4 and 5
*
* CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org)
* Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* Copyright 2005-2009, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @copyright Copyright 2005-2009, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.libs.controller.components
* @since CakePHP(tm) v 0.10.0.1232
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
if (!class_exists('cakesession')) {
Expand Down Expand Up @@ -167,15 +162,10 @@ function read($name = null) {
}

/**
* Used to delete a session variable.
*
* In your controller: $this->Session->del('Controller.sessKey');
*
* @param string $name the name of the session key you want to delete
* @return boolean true is session variable is set and can be deleted, false is variable was not set.
* @access public
* @deprecated use delete
*/
function del($name) {
trigger_error('Deprecated method, use SessionComponent::delete instead', E_USER_WARNING);
if ($this->__active === true) {
$this->__start();
return parent::del($name);
Expand All @@ -195,7 +185,7 @@ function del($name) {
function delete($name) {
if ($this->__active === true) {
$this->__start();
return $this->del($name);
return parent::del($name);
}
return false;
}
Expand Down
21 changes: 13 additions & 8 deletions cake/libs/folder.php
@@ -1,26 +1,21 @@
<?php
/* SVN FILE: $Id$ */

/**
* Convenience class for handling directories.
*
* PHP versions 4 and 5
*
* CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org)
* Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* Copyright 2005-2009, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @copyright Copyright 2005-2009, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.libs
* @since CakePHP(tm) v 0.2.9
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/

Expand Down Expand Up @@ -627,7 +622,7 @@ function copy($options = array()) {
}

if (!is_dir($toDir)) {
$this->mkdir($toDir, $mode);
$this->create($toDir, $mode);
}

if (!is_writable($toDir)) {
Expand Down Expand Up @@ -725,49 +720,59 @@ function errors() {
* nix flavored alias
*
* @see read
* @deprecated use read
* @access public
*/
function ls($sort = true, $exceptions = false) {
trigger_error('Deprecated method, use Folder::read instead', E_USER_WARNING);
return $this->read($sort, $exceptions);
}

/**
* nix flavored alias
*
* @see create
* @deprecated use create
* @access public
*/
function mkdir($pathname, $mode = 0755) {
trigger_error('Deprecated method, use Folder::create instead', E_USER_WARNING);
return $this->create($pathname, $mode);
}

/**
* nix flavored alias
*
* @see copy
* @deprecated use copy
* @access public
*/
function cp($options) {
trigger_error('Deprecated method, use Folder::copy instead', E_USER_WARNING);
return $this->copy($options);
}

/**
* nix flavored alias
*
* @see move
* @deprecated use move
* @access public
*/
function mv($options) {
trigger_error('Deprecated method, use Folder::move instead', E_USER_WARNING);
return $this->move($options);
}

/**
* nix flavored alias
*
* @see delete
* @deprecated use delete
* @access public
*/
function rm($path) {
trigger_error('Deprecated method, use Folder::delete instead', E_USER_WARNING);
return $this->delete($path);
}

Expand Down
6 changes: 5 additions & 1 deletion cake/libs/model/model.php
Expand Up @@ -499,9 +499,10 @@ function call__($method, $params) {
* @param boolean $permanent Set to true to make the binding permanent
* @return void
* @access public
* @todo
* @deprecated Use Model::bindModel() instead.
*/
function bind($model, $options = array(), $permanent = true) {
trigger_error('Deprecated method, use Model::bindModel instead', E_USER_WARNING);
if (!is_array($model)) {
$model = array($model => $options);
}
Expand Down Expand Up @@ -1745,6 +1746,7 @@ function updateAll($fields, $conditions = true) {
* @link http://book.cakephp.org/view/691/remove
*/
function remove($id = null, $cascade = true) {
trigger_error('Deprecated method, use Model::delete instead', E_USER_WARNING);
return $this->delete($id, $cascade);
}

Expand Down Expand Up @@ -1798,6 +1800,7 @@ function delete($id = null, $cascade = true) {
* @deprecated
*/
function del($id = null, $cascade = true) {
trigger_error('Deprecated method, use Model::delete instead', E_USER_WARNING);
return $this->delete($id, $cascade);
}

Expand Down Expand Up @@ -2613,6 +2616,7 @@ function isForeignKey($field) {
* @deprecated
*/
function getDisplayField() {
trigger_error('Deprecated method, use Model::$displayField instead', E_USER_WARNING);
return $this->displayField;
}

Expand Down
7 changes: 1 addition & 6 deletions cake/libs/view/helpers/javascript.php
Expand Up @@ -609,14 +609,9 @@ function includeScript($script = "", $options = array()) {
*
* @param array $data Data to be converted
* @param array $options Set of options: block, prefix, postfix, stringKeys, quoteKeys, q
* @param string $prefix DEPRECATED, use $options['prefix'] instead. Prepends the string to the returned data
* @param string $postfix DEPRECATED, use $options['postfix'] instead. Appends the string to the returned data
* @param array $stringKeys DEPRECATED, use $options['stringKeys'] instead. A list of array keys to be treated as a string
* @param boolean $quoteKeys DEPRECATED, use $options['quoteKeys'] instead. If false, treats $stringKey as a list of keys *not* to be quoted
* @param string $q DEPRECATED, use $options['q'] instead. The type of quote to use
* @return string A JSON code block
*/
function object($data = array(), $options = array(), $prefix = null, $postfix = null, $stringKeys = null, $quoteKeys = null, $q = null) {
function object($data = array(), $options = array()) {
if (!empty($options) && !is_array($options)) {
$options = array('block' => $options);
} else if (empty($options)) {
Expand Down
23 changes: 9 additions & 14 deletions cake/tests/cases/libs/controller/components/cookie.test.php
@@ -1,6 +1,4 @@
<?php
/* SVN FILE: $Id$ */

/**
* CookieComponentTest file
*
Expand All @@ -9,20 +7,17 @@
* PHP versions 4 and 5
*
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
* Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* Copyright 2005-2009, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
*
* Licensed under The Open Group Test Suite License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @copyright Copyright 2005-2009, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake
* @subpackage cake.tests.cases.libs.controller.components
* @since CakePHP(tm) v 1.2.0.5435
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
*/
App::import('Controller', array('Component', 'Controller'), false);
Expand Down Expand Up @@ -182,9 +177,9 @@ function testWritePlainCookieArray() {
$this->assertEqual($this->Controller->Cookie->read('version'), '1.2.0.x');
$this->assertEqual($this->Controller->Cookie->read('tag'), 'CakePHP Rocks!');

$this->Controller->Cookie->del('name');
$this->Controller->Cookie->del('version');
$this->Controller->Cookie->del('tag');
$this->Controller->Cookie->delete('name');
$this->Controller->Cookie->delete('version');
$this->Controller->Cookie->delete('tag');
}

/**
Expand Down Expand Up @@ -222,22 +217,22 @@ function testReadingCookieValue() {
* @return void
*/
function testDeleteCookieValue() {
$this->Controller->Cookie->del('Encrytped_multi_cookies.name');
$this->Controller->Cookie->delete('Encrytped_multi_cookies.name');
$data = $this->Controller->Cookie->read('Encrytped_multi_cookies');
$expected = array('version' => '1.2.0.x', 'tag' =>'CakePHP Rocks!');
$this->assertEqual($data, $expected);

$this->Controller->Cookie->del('Encrytped_array');
$this->Controller->Cookie->delete('Encrytped_array');
$data = $this->Controller->Cookie->read('Encrytped_array');
$expected = array();
$this->assertEqual($data, $expected);

$this->Controller->Cookie->del('Plain_multi_cookies.name');
$this->Controller->Cookie->delete('Plain_multi_cookies.name');
$data = $this->Controller->Cookie->read('Plain_multi_cookies');
$expected = array('version' => '1.2.0.x', 'tag' =>'CakePHP Rocks!');
$this->assertEqual($data, $expected);

$this->Controller->Cookie->del('Plain_array');
$this->Controller->Cookie->delete('Plain_array');
$data = $this->Controller->Cookie->read('Plain_array');
$expected = array();
$this->assertEqual($data, $expected);
Expand Down

0 comments on commit 1bedd84

Please sign in to comment.