mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Merge branch 'master' into 2.3
Conflicts: lib/Cake/Console/Command/ConsoleShell.php lib/Cake/Network/CakeSocket.php lib/Cake/Network/Http/HttpResponse.php lib/Cake/Utility/Folder.php lib/Cake/View/MediaView.php lib/Cake/basics.php
This commit is contained in:
commit
27d7e2865e
42 changed files with 156 additions and 53 deletions
|
@ -197,7 +197,7 @@
|
||||||
<!--
|
<!--
|
||||||
Upload to pirum pear channel.
|
Upload to pirum pear channel.
|
||||||
-->
|
-->
|
||||||
<target name="distribute" depends="prepare">
|
<target name="distribute" depends="prepare" description="Upload pear packages to pear.cakephp.org">
|
||||||
<echo msg="Uploading tgz file to cakephp.org" />
|
<echo msg="Uploading tgz file to cakephp.org" />
|
||||||
<exec command="scp ${dist.dir}/${pear.package}.tgz cakephp@cakephp.org:${pirum.dir}" dir="." checkreturn="true" />
|
<exec command="scp ${dist.dir}/${pear.package}.tgz cakephp@cakephp.org:${pirum.dir}" dir="." checkreturn="true" />
|
||||||
|
|
||||||
|
@ -208,7 +208,7 @@
|
||||||
<!--
|
<!--
|
||||||
Top level easy to type targets
|
Top level easy to type targets
|
||||||
-->
|
-->
|
||||||
<target name="build" depends="generate-package" />
|
<target name="build" depends="generate-package" description="Generate a pear package" />
|
||||||
<target name="release" depends="release-commit,build,distribute" />
|
<target name="release" depends="release-commit,build,distribute" description="Release a new version of CakePHP" />
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -238,7 +238,9 @@ class ConsoleShell extends AppShell {
|
||||||
|
|
||||||
if ($this->_isValidModel($modelToCheck)) {
|
if ($this->_isValidModel($modelToCheck)) {
|
||||||
$findCommand = "\$data = \$this->$command;";
|
$findCommand = "\$data = \$this->$command;";
|
||||||
|
//@codingStandardsIgnoreStart
|
||||||
@eval($findCommand);
|
@eval($findCommand);
|
||||||
|
//@codingStandardsIgnoreEnd
|
||||||
|
|
||||||
if (is_array($data)) {
|
if (is_array($data)) {
|
||||||
foreach ($data as $idx => $results) {
|
foreach ($data as $idx => $results) {
|
||||||
|
@ -294,7 +296,9 @@ class ConsoleShell extends AppShell {
|
||||||
list($foo, $data) = explode("->save", $command);
|
list($foo, $data) = explode("->save", $command);
|
||||||
$data = preg_replace('/^\(*(array)?\(*(.+?)\)*$/i', '\\2', $data);
|
$data = preg_replace('/^\(*(array)?\(*(.+?)\)*$/i', '\\2', $data);
|
||||||
$saveCommand = "\$this->{$modelToSave}->save(array('{$modelToSave}' => array({$data})));";
|
$saveCommand = "\$this->{$modelToSave}->save(array('{$modelToSave}' => array({$data})));";
|
||||||
|
//@codingStandardsIgnoreStart
|
||||||
@eval($saveCommand);
|
@eval($saveCommand);
|
||||||
|
//@codingStandardsIgnoreEnd
|
||||||
$this->out(__d('cake_console', 'Saved record for %s', $modelToSave));
|
$this->out(__d('cake_console', 'Saved record for %s', $modelToSave));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -304,7 +308,9 @@ class ConsoleShell extends AppShell {
|
||||||
if ($this->_isValidModel($modelToCheck)) {
|
if ($this->_isValidModel($modelToCheck)) {
|
||||||
// Get the column info for this model
|
// Get the column info for this model
|
||||||
$fieldsCommand = "\$data = \$this->{$modelToCheck}->getColumnTypes();";
|
$fieldsCommand = "\$data = \$this->{$modelToCheck}->getColumnTypes();";
|
||||||
|
//@codingStandardsIgnoreStart
|
||||||
@eval($fieldsCommand);
|
@eval($fieldsCommand);
|
||||||
|
//@codingStandardsIgnoreEnd
|
||||||
|
|
||||||
if (is_array($data)) {
|
if (is_array($data)) {
|
||||||
foreach ($data as $field => $type) {
|
foreach ($data as $field => $type) {
|
||||||
|
@ -325,8 +331,10 @@ class ConsoleShell extends AppShell {
|
||||||
case preg_match("/^routes\s+show/i", $command, $tmp):
|
case preg_match("/^routes\s+show/i", $command, $tmp):
|
||||||
$this->out(print_r(Hash::combine(Router::$routes, '{n}.template', '{n}.defaults'), true));
|
$this->out(print_r(Hash::combine(Router::$routes, '{n}.template', '{n}.defaults'), true));
|
||||||
break;
|
break;
|
||||||
case preg_match("/^route\s+(\(.*\))$/i", $command, $tmp):
|
case (preg_match("/^route\s+(\(.*\))$/i", $command, $tmp) == true):
|
||||||
|
//@codingStandardsIgnoreStart
|
||||||
if ($url = eval('return array' . $tmp[1] . ';')) {
|
if ($url = eval('return array' . $tmp[1] . ';')) {
|
||||||
|
//@codingStandardsIgnoreEnd
|
||||||
$this->out(Router::url($url));
|
$this->out(Router::url($url));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -362,7 +370,9 @@ class ConsoleShell extends AppShell {
|
||||||
Router::reload();
|
Router::reload();
|
||||||
extract(Router::getNamedExpressions());
|
extract(Router::getNamedExpressions());
|
||||||
|
|
||||||
|
//@codingStandardsIgnoreStart
|
||||||
if (!@include APP . 'Config' . DS . 'routes.php') {
|
if (!@include APP . 'Config' . DS . 'routes.php') {
|
||||||
|
//@codingStandardsIgnoreEnd
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
CakePlugin::routes();
|
CakePlugin::routes();
|
||||||
|
|
|
@ -78,7 +78,6 @@ class TemplateTask extends AppShell {
|
||||||
|
|
||||||
$paths[] = $core;
|
$paths[] = $core;
|
||||||
|
|
||||||
// TEMPORARY TODO remove when all paths are DS terminated
|
|
||||||
foreach ($paths as $i => $path) {
|
foreach ($paths as $i => $path) {
|
||||||
$paths[$i] = rtrim($path, DS) . DS;
|
$paths[$i] = rtrim($path, DS) . DS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -345,6 +345,7 @@ class ConsoleOptionParser {
|
||||||
$arg = new ConsoleInputArgument($options);
|
$arg = new ConsoleInputArgument($options);
|
||||||
}
|
}
|
||||||
$this->_args[$index] = $arg;
|
$this->_args[$index] = $arg;
|
||||||
|
ksort($this->_args);
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -686,7 +686,9 @@ class Shell extends Object {
|
||||||
protected function _checkUnitTest() {
|
protected function _checkUnitTest() {
|
||||||
if (class_exists('PHPUnit_Framework_TestCase')) {
|
if (class_exists('PHPUnit_Framework_TestCase')) {
|
||||||
return true;
|
return true;
|
||||||
|
//@codingStandardsIgnoreStart
|
||||||
} elseif (@include 'PHPUnit' . DS . 'Autoload.php') {
|
} elseif (@include 'PHPUnit' . DS . 'Autoload.php') {
|
||||||
|
//@codingStandardsIgnoreEnd
|
||||||
return true;
|
return true;
|
||||||
} elseif (App::import('Vendor', 'phpunit', array('file' => 'PHPUnit' . DS . 'Autoload.php'))) {
|
} elseif (App::import('Vendor', 'phpunit', array('file' => 'PHPUnit' . DS . 'Autoload.php'))) {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -755,7 +755,7 @@ class Controller extends Object implements CakeEventListener {
|
||||||
extract($status, EXTR_OVERWRITE);
|
extract($status, EXTR_OVERWRITE);
|
||||||
}
|
}
|
||||||
$event = new CakeEvent('Controller.beforeRedirect', $this, array($url, $status, $exit));
|
$event = new CakeEvent('Controller.beforeRedirect', $this, array($url, $status, $exit));
|
||||||
//TODO: Remove the following line when the events are fully migrated to the CakeEventManager
|
|
||||||
list($event->break, $event->breakOn, $event->collectReturn) = array(true, false, true);
|
list($event->break, $event->breakOn, $event->collectReturn) = array(true, false, true);
|
||||||
$this->getEventManager()->dispatch($event);
|
$this->getEventManager()->dispatch($event);
|
||||||
|
|
||||||
|
|
|
@ -261,9 +261,11 @@ class MissingControllerException extends CakeException {
|
||||||
|
|
||||||
protected $_messageTemplate = 'Controller class %s could not be found.';
|
protected $_messageTemplate = 'Controller class %s could not be found.';
|
||||||
|
|
||||||
|
//@codingStandardsIgnoreStart
|
||||||
public function __construct($message, $code = 404) {
|
public function __construct($message, $code = 404) {
|
||||||
parent::__construct($message, $code);
|
parent::__construct($message, $code);
|
||||||
}
|
}
|
||||||
|
//@codingStandardsIgnoreEnd
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,9 +279,11 @@ class MissingActionException extends CakeException {
|
||||||
|
|
||||||
protected $_messageTemplate = 'Action %s::%s() could not be found.';
|
protected $_messageTemplate = 'Action %s::%s() could not be found.';
|
||||||
|
|
||||||
|
//@codingStandardsIgnoreStart
|
||||||
public function __construct($message, $code = 404) {
|
public function __construct($message, $code = 404) {
|
||||||
parent::__construct($message, $code);
|
parent::__construct($message, $code);
|
||||||
}
|
}
|
||||||
|
//@codingStandardsIgnoreEnd
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -293,9 +297,11 @@ class PrivateActionException extends CakeException {
|
||||||
|
|
||||||
protected $_messageTemplate = 'Private Action %s::%s() is not directly accessible.';
|
protected $_messageTemplate = 'Private Action %s::%s() is not directly accessible.';
|
||||||
|
|
||||||
|
//@codingStandardsIgnoreStart
|
||||||
public function __construct($message, $code = 404, Exception $previous = null) {
|
public function __construct($message, $code = 404, Exception $previous = null) {
|
||||||
parent::__construct($message, $code, $previous);
|
parent::__construct($message, $code, $previous);
|
||||||
}
|
}
|
||||||
|
//@codingStandardsIgnoreEnd
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -609,8 +615,10 @@ class NotImplementedException extends CakeException {
|
||||||
|
|
||||||
protected $_messageTemplate = '%s is not implemented.';
|
protected $_messageTemplate = '%s is not implemented.';
|
||||||
|
|
||||||
|
//@codingStandardsIgnoreStart
|
||||||
public function __construct($message, $code = 501) {
|
public function __construct($message, $code = 501) {
|
||||||
parent::__construct($message, $code);
|
parent::__construct($message, $code);
|
||||||
}
|
}
|
||||||
|
//@codingStandardsIgnoreEnd
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -732,7 +732,6 @@ class Multibyte {
|
||||||
* @param string $charset charset to use for encoding. defaults to UTF-8
|
* @param string $charset charset to use for encoding. defaults to UTF-8
|
||||||
* @param string $newline
|
* @param string $newline
|
||||||
* @return string
|
* @return string
|
||||||
* @TODO: add support for 'Q'('Quoted Printable') encoding
|
|
||||||
*/
|
*/
|
||||||
public static function mimeEncode($string, $charset = null, $newline = "\r\n") {
|
public static function mimeEncode($string, $charset = null, $newline = "\r\n") {
|
||||||
if (!Multibyte::checkMultibyte($string) && strlen($string) < 75) {
|
if (!Multibyte::checkMultibyte($string) && strlen($string) < 75) {
|
||||||
|
|
|
@ -588,7 +588,6 @@ class TreeBehavior extends ModelBehavior {
|
||||||
* 'parent' the values of the parent_id field will be used to populate the left and right fields. The missingParentAction
|
* 'parent' the values of the parent_id field will be used to populate the left and right fields. The missingParentAction
|
||||||
* parameter only applies to "parent" mode and determines what to do if the parent field contains an id that is not present.
|
* parameter only applies to "parent" mode and determines what to do if the parent field contains an id that is not present.
|
||||||
*
|
*
|
||||||
* @todo Could be written to be faster, *maybe*. Ideally using a subquery and putting all the logic burden on the DB.
|
|
||||||
* @param Model $Model Model instance
|
* @param Model $Model Model instance
|
||||||
* @param string $mode parent or tree
|
* @param string $mode parent or tree
|
||||||
* @param string|integer $missingParentAction 'return' to do nothing and return, 'delete' to
|
* @param string|integer $missingParentAction 'return' to do nothing and return, 'delete' to
|
||||||
|
|
|
@ -55,7 +55,6 @@ class BehaviorCollection extends ObjectCollection implements CakeEventListener {
|
||||||
/**
|
/**
|
||||||
* Attaches a model object and loads a list of behaviors
|
* Attaches a model object and loads a list of behaviors
|
||||||
*
|
*
|
||||||
* @todo Make this method a constructor instead..
|
|
||||||
* @param string $modelName
|
* @param string $modelName
|
||||||
* @param array $behaviors
|
* @param array $behaviors
|
||||||
* @return void
|
* @return void
|
||||||
|
|
|
@ -322,7 +322,6 @@ class DataSource extends Object {
|
||||||
* @param Model $linkModel Instance of model to replace $__cakeForeignKey__$
|
* @param Model $linkModel Instance of model to replace $__cakeForeignKey__$
|
||||||
* @param array $stack
|
* @param array $stack
|
||||||
* @return string String of query data with placeholders replaced.
|
* @return string String of query data with placeholders replaced.
|
||||||
* @todo Remove and refactor $assocData, ensure uses of the method have the param removed too.
|
|
||||||
*/
|
*/
|
||||||
public function insertQueryData($query, $data, $association, $assocData, Model $model, Model $linkModel, $stack) {
|
public function insertQueryData($query, $data, $association, $assocData, Model $model, Model $linkModel, $stack) {
|
||||||
$keys = array('{$__cakeID__$}', '{$__cakeForeignKey__$}');
|
$keys = array('{$__cakeID__$}', '{$__cakeForeignKey__$}');
|
||||||
|
|
|
@ -250,7 +250,9 @@ class Sqlite extends DboSource {
|
||||||
|
|
||||||
$col = strtolower(str_replace(')', '', $real));
|
$col = strtolower(str_replace(')', '', $real));
|
||||||
$limit = null;
|
$limit = null;
|
||||||
@list($col, $limit) = explode('(', $col);
|
if (strpos($col, '(') !== false) {
|
||||||
|
list($col, $limit) = explode('(', $col);
|
||||||
|
}
|
||||||
|
|
||||||
$standard = array(
|
$standard = array(
|
||||||
'text',
|
'text',
|
||||||
|
|
|
@ -446,6 +446,8 @@ class CakeResponse {
|
||||||
}
|
}
|
||||||
if (strpos($this->_contentType, 'text/') === 0) {
|
if (strpos($this->_contentType, 'text/') === 0) {
|
||||||
$this->header('Content-Type', "{$this->_contentType}; charset={$this->_charset}");
|
$this->header('Content-Type', "{$this->_contentType}; charset={$this->_charset}");
|
||||||
|
} elseif ($this->_contentType === 'application/json') {
|
||||||
|
$this->header('Content-Type', "{$this->_contentType}; charset=UTF-8");
|
||||||
} else {
|
} else {
|
||||||
$this->header('Content-Type', "{$this->_contentType}");
|
$this->header('Content-Type', "{$this->_contentType}");
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,9 +63,11 @@ class MailTransport extends AbstractTransport {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function _mail($to, $subject, $message, $headers, $params = null) {
|
protected function _mail($to, $subject, $message, $headers, $params = null) {
|
||||||
|
//@codingStandardsIgnoreStart
|
||||||
if (!@mail($to, $subject, $message, $headers, $params)) {
|
if (!@mail($to, $subject, $message, $headers, $params)) {
|
||||||
throw new SocketException(__d('cake_dev', 'Could not send email.'));
|
throw new SocketException(__d('cake_dev', 'Could not send email.'));
|
||||||
}
|
}
|
||||||
|
//@codingStandardsIgnoreEnd
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -935,7 +935,6 @@ class HttpSocket extends CakeSocket {
|
||||||
*
|
*
|
||||||
* @param array $cookies Array of cookies to send with the request.
|
* @param array $cookies Array of cookies to send with the request.
|
||||||
* @return string Cookie header string to be sent with the request.
|
* @return string Cookie header string to be sent with the request.
|
||||||
* @todo Refactor token escape mechanism to be configurable
|
|
||||||
*/
|
*/
|
||||||
public function buildCookies($cookies) {
|
public function buildCookies($cookies) {
|
||||||
$header = array();
|
$header = array();
|
||||||
|
@ -951,7 +950,6 @@ class HttpSocket extends CakeSocket {
|
||||||
* @param string $token Token to escape
|
* @param string $token Token to escape
|
||||||
* @param array $chars
|
* @param array $chars
|
||||||
* @return string Escaped token
|
* @return string Escaped token
|
||||||
* @todo Test $chars parameter
|
|
||||||
*/
|
*/
|
||||||
protected function _escapeToken($token, $chars = null) {
|
protected function _escapeToken($token, $chars = null) {
|
||||||
$regex = '/([' . implode('', $this->_tokenEscapeChars(true, $chars)) . '])/';
|
$regex = '/([' . implode('', $this->_tokenEscapeChars(true, $chars)) . '])/';
|
||||||
|
@ -965,7 +963,6 @@ class HttpSocket extends CakeSocket {
|
||||||
* @param boolean $hex true to get them as HEX values, false otherwise
|
* @param boolean $hex true to get them as HEX values, false otherwise
|
||||||
* @param array $chars
|
* @param array $chars
|
||||||
* @return array Escape chars
|
* @return array Escape chars
|
||||||
* @todo Test $chars parameter
|
|
||||||
*/
|
*/
|
||||||
protected function _tokenEscapeChars($hex = true, $chars = null) {
|
protected function _tokenEscapeChars($hex = true, $chars = null) {
|
||||||
if (!empty($chars)) {
|
if (!empty($chars)) {
|
||||||
|
|
|
@ -282,7 +282,9 @@ class BasicsTest extends CakeTestCase {
|
||||||
|
|
||||||
$result = cache('basics_test');
|
$result = cache('basics_test');
|
||||||
$this->assertEquals('simple cache write', $result);
|
$this->assertEquals('simple cache write', $result);
|
||||||
@unlink(CACHE . 'basics_test');
|
if (file_exists(CACHE . 'basics_test')) {
|
||||||
|
unlink(CACHE . 'basics_test');
|
||||||
|
}
|
||||||
|
|
||||||
cache('basics_test', 'expired', '+1 second');
|
cache('basics_test', 'expired', '+1 second');
|
||||||
sleep(2);
|
sleep(2);
|
||||||
|
@ -603,7 +605,9 @@ class BasicsTest extends CakeTestCase {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testLogError() {
|
public function testLogError() {
|
||||||
@unlink(LOGS . 'error.log');
|
if (file_exists(LOGS . 'error.log')) {
|
||||||
|
unlink(LOGS . 'error.log');
|
||||||
|
}
|
||||||
|
|
||||||
// disable stderr output for this test
|
// disable stderr output for this test
|
||||||
if (CakeLog::stream('stderr')) {
|
if (CakeLog::stream('stderr')) {
|
||||||
|
|
|
@ -111,9 +111,11 @@ class MemcacheEngineTest extends CakeTestCase {
|
||||||
|
|
||||||
foreach ($servers as $server) {
|
foreach ($servers as $server) {
|
||||||
list($host, $port) = explode(':', $server);
|
list($host, $port) = explode(':', $server);
|
||||||
|
//@codingStandardsIgnoreStart
|
||||||
if (!@$Memcache->connect($host, $port)) {
|
if (!@$Memcache->connect($host, $port)) {
|
||||||
$available = false;
|
$available = false;
|
||||||
}
|
}
|
||||||
|
//@codingStandardsIgnoreEnd
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->skipIf(!$available, 'Need memcache servers at ' . implode(', ', $servers) . ' to run this test.');
|
$this->skipIf(!$available, 'Need memcache servers at ' . implode(', ', $servers) . ' to run this test.');
|
||||||
|
|
|
@ -314,10 +314,29 @@ class ConsoleOptionParserTest extends CakeTestCase {
|
||||||
$parser = new ConsoleOptionParser('test', false);
|
$parser = new ConsoleOptionParser('test', false);
|
||||||
$parser->addArgument(new ConsoleInputArgument('test'));
|
$parser->addArgument(new ConsoleInputArgument('test'));
|
||||||
$result = $parser->arguments();
|
$result = $parser->arguments();
|
||||||
$this->assertEquals(1, count($result));
|
$this->assertCount(1, $result);
|
||||||
$this->assertEquals('test', $result[0]->name());
|
$this->assertEquals('test', $result[0]->name());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test adding arguments out of order.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testAddArgumentOutOfOrder() {
|
||||||
|
$parser = new ConsoleOptionParser('test', false);
|
||||||
|
$parser->addArgument('name', array('index' => 1, 'help' => 'first argument'))
|
||||||
|
->addArgument('bag', array('index' => 2, 'help' => 'second argument'))
|
||||||
|
->addArgument('other', array('index' => 0, 'help' => 'Zeroth argument'));
|
||||||
|
|
||||||
|
$result = $parser->arguments();
|
||||||
|
$this->assertCount(3, $result);
|
||||||
|
$this->assertEquals('other', $result[0]->name());
|
||||||
|
$this->assertEquals('name', $result[1]->name());
|
||||||
|
$this->assertEquals('bag', $result[2]->name());
|
||||||
|
$this->assertSame(array(0, 1, 2), array_keys($result));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test overwriting positional arguments.
|
* test overwriting positional arguments.
|
||||||
*
|
*
|
||||||
|
|
|
@ -437,7 +437,9 @@ class ConfigureTest extends CakeTestCase {
|
||||||
$result = file_get_contents(TMP . 'config_test.php');
|
$result = file_get_contents(TMP . 'config_test.php');
|
||||||
$this->assertContains('<?php', $result);
|
$this->assertContains('<?php', $result);
|
||||||
$this->assertContains('$config = ', $result);
|
$this->assertContains('$config = ', $result);
|
||||||
@unlink(TMP . 'config_test.php');
|
if (file_exists(TMP . 'config_test.php')) {
|
||||||
|
unlink(TMP . 'config_test.php');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -456,7 +458,9 @@ class ConfigureTest extends CakeTestCase {
|
||||||
$this->assertContains('Error', $result);
|
$this->assertContains('Error', $result);
|
||||||
$this->assertNotContains('debug', $result);
|
$this->assertNotContains('debug', $result);
|
||||||
|
|
||||||
@unlink(TMP . 'config_test.php');
|
if (file_exists(TMP . 'config_test.php')) {
|
||||||
|
unlink(TMP . 'config_test.php');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,7 +124,9 @@ class ErrorHandlerTest extends CakeTestCase {
|
||||||
$this->_restoreError = true;
|
$this->_restoreError = true;
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
|
//@codingStandardsIgnoreStart
|
||||||
@include 'invalid.file';
|
@include 'invalid.file';
|
||||||
|
//@codingStandardsIgnoreEnd
|
||||||
$result = ob_get_clean();
|
$result = ob_get_clean();
|
||||||
$this->assertTrue(empty($result));
|
$this->assertTrue(empty($result));
|
||||||
}
|
}
|
||||||
|
@ -138,7 +140,7 @@ class ErrorHandlerTest extends CakeTestCase {
|
||||||
Configure::write('debug', 0);
|
Configure::write('debug', 0);
|
||||||
Configure::write('Error.trace', false);
|
Configure::write('Error.trace', false);
|
||||||
if (file_exists(LOGS . 'debug.log')) {
|
if (file_exists(LOGS . 'debug.log')) {
|
||||||
@unlink(LOGS . 'debug.log');
|
unlink(LOGS . 'debug.log');
|
||||||
}
|
}
|
||||||
|
|
||||||
set_error_handler('ErrorHandler::handleError');
|
set_error_handler('ErrorHandler::handleError');
|
||||||
|
@ -152,7 +154,9 @@ class ErrorHandlerTest extends CakeTestCase {
|
||||||
'/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} (Notice|Debug): Notice \(8\): Undefined variable:\s+out in \[.+ line \d+\]$/',
|
'/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} (Notice|Debug): Notice \(8\): Undefined variable:\s+out in \[.+ line \d+\]$/',
|
||||||
$result[0]
|
$result[0]
|
||||||
);
|
);
|
||||||
@unlink(LOGS . 'debug.log');
|
if (file_exists(LOGS . 'debug.log')) {
|
||||||
|
unlink(LOGS . 'debug.log');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -164,7 +168,7 @@ class ErrorHandlerTest extends CakeTestCase {
|
||||||
Configure::write('debug', 0);
|
Configure::write('debug', 0);
|
||||||
Configure::write('Error.trace', true);
|
Configure::write('Error.trace', true);
|
||||||
if (file_exists(LOGS . 'debug.log')) {
|
if (file_exists(LOGS . 'debug.log')) {
|
||||||
@unlink(LOGS . 'debug.log');
|
unlink(LOGS . 'debug.log');
|
||||||
}
|
}
|
||||||
|
|
||||||
set_error_handler('ErrorHandler::handleError');
|
set_error_handler('ErrorHandler::handleError');
|
||||||
|
@ -179,7 +183,9 @@ class ErrorHandlerTest extends CakeTestCase {
|
||||||
);
|
);
|
||||||
$this->assertRegExp('/^Trace:/', $result[1]);
|
$this->assertRegExp('/^Trace:/', $result[1]);
|
||||||
$this->assertRegExp('/^ErrorHandlerTest\:\:testHandleErrorLoggingTrace\(\)/', $result[2]);
|
$this->assertRegExp('/^ErrorHandlerTest\:\:testHandleErrorLoggingTrace\(\)/', $result[2]);
|
||||||
@unlink(LOGS . 'debug.log');
|
if (file_exists(LOGS . 'debug.log')) {
|
||||||
|
unlink(LOGS . 'debug.log');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -150,7 +150,7 @@ class CakeLogTest extends CakeTestCase {
|
||||||
$this->assertEquals(array('file'), $result);
|
$this->assertEquals(array('file'), $result);
|
||||||
|
|
||||||
if (file_exists(LOGS . 'error.log')) {
|
if (file_exists(LOGS . 'error.log')) {
|
||||||
@unlink(LOGS . 'error.log');
|
unlink(LOGS . 'error.log');
|
||||||
}
|
}
|
||||||
CakeLog::write(LOG_WARNING, 'Test warning');
|
CakeLog::write(LOG_WARNING, 'Test warning');
|
||||||
$this->assertTrue(file_exists(LOGS . 'error.log'));
|
$this->assertTrue(file_exists(LOGS . 'error.log'));
|
||||||
|
|
|
@ -4054,7 +4054,6 @@ class ModelReadTest extends BaseModelTest {
|
||||||
/**
|
/**
|
||||||
* testFindAllWithConditionInChildQuery
|
* testFindAllWithConditionInChildQuery
|
||||||
*
|
*
|
||||||
* @todo external conditions like this are going to need to be revisited at some point
|
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testFindAllWithConditionInChildQuery() {
|
public function testFindAllWithConditionInChildQuery() {
|
||||||
|
|
|
@ -199,7 +199,7 @@ class CakeResponseTest extends CakeTestCase {
|
||||||
* Tests the send method and changing the content type
|
* Tests the send method and changing the content type
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function testSendChangingContentYype() {
|
public function testSendChangingContentType() {
|
||||||
$response = $this->getMock('CakeResponse', array('_sendHeader', '_sendContent', '_setCookies'));
|
$response = $this->getMock('CakeResponse', array('_sendHeader', '_sendContent', '_setCookies'));
|
||||||
$response->type('mp3');
|
$response->type('mp3');
|
||||||
$response->body('the response body');
|
$response->body('the response body');
|
||||||
|
@ -215,12 +215,12 @@ class CakeResponseTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests the send method and changing the content type
|
* Tests the send method and changing the content type to JSON
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function testSendChangingContentType() {
|
public function testSendChangingContentTypeJSON() {
|
||||||
$response = $this->getMock('CakeResponse', array('_sendHeader', '_sendContent', '_setCookies'));
|
$response = $this->getMock('CakeResponse', array('_sendHeader', '_sendContent', '_setCookies'));
|
||||||
$response->type('mp3');
|
$response->type('json');
|
||||||
$response->body('the response body');
|
$response->body('the response body');
|
||||||
$response->expects($this->once())->method('_sendContent')->with('the response body');
|
$response->expects($this->once())->method('_sendContent')->with('the response body');
|
||||||
$response->expects($this->at(0))->method('_setCookies');
|
$response->expects($this->at(0))->method('_setCookies');
|
||||||
|
@ -229,7 +229,7 @@ class CakeResponseTest extends CakeTestCase {
|
||||||
$response->expects($this->at(2))
|
$response->expects($this->at(2))
|
||||||
->method('_sendHeader')->with('Content-Length', 17);
|
->method('_sendHeader')->with('Content-Length', 17);
|
||||||
$response->expects($this->at(3))
|
$response->expects($this->at(3))
|
||||||
->method('_sendHeader')->with('Content-Type', 'audio/mpeg');
|
->method('_sendHeader')->with('Content-Type', 'application/json; charset=UTF-8');
|
||||||
$response->send();
|
$response->send();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1567,7 +1567,6 @@ class HttpSocketTest extends CakeTestCase {
|
||||||
* testBuildCookies method
|
* testBuildCookies method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @todo Test more scenarios
|
|
||||||
*/
|
*/
|
||||||
public function testBuildCookies() {
|
public function testBuildCookies() {
|
||||||
$cookies = array(
|
$cookies = array(
|
||||||
|
|
|
@ -1538,7 +1538,6 @@ class RouterTest extends CakeTestCase {
|
||||||
* test url generation with legacy (1.2) style prefix routes.
|
* test url generation with legacy (1.2) style prefix routes.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @todo Remove tests related to legacy style routes.
|
|
||||||
* @see testUrlGenerationWithAutoPrefixes
|
* @see testUrlGenerationWithAutoPrefixes
|
||||||
*/
|
*/
|
||||||
public function testUrlGenerationWithLegacyPrefixes() {
|
public function testUrlGenerationWithLegacyPrefixes() {
|
||||||
|
|
|
@ -152,6 +152,9 @@ class SetTest extends CakeTestCase {
|
||||||
$r = Set::merge('foo', 'bar');
|
$r = Set::merge('foo', 'bar');
|
||||||
$this->assertEquals(array('foo', 'bar'), $r);
|
$this->assertEquals(array('foo', 'bar'), $r);
|
||||||
|
|
||||||
|
$r = Set::merge(array('foo'), array(), array('bar'));
|
||||||
|
$this->assertEquals(array('foo', 'bar'), $r);
|
||||||
|
|
||||||
$r = Set::merge('foo', array('user' => 'bob', 'no-bar'), 'bar');
|
$r = Set::merge('foo', array('user' => 'bob', 'no-bar'), 'bar');
|
||||||
$this->assertEquals(array('foo', 'user' => 'bob', 'no-bar', 'bar'), $r);
|
$this->assertEquals(array('foo', 'user' => 'bob', 'no-bar', 'bar'), $r);
|
||||||
|
|
||||||
|
|
|
@ -177,6 +177,7 @@ class XmlTest extends CakeTestCase {
|
||||||
array(null),
|
array(null),
|
||||||
array(false),
|
array(false),
|
||||||
array(''),
|
array(''),
|
||||||
|
array('http://localhost/notthere.xml'),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,9 @@ class JsEncodingObject {
|
||||||
|
|
||||||
protected $_title = 'Old thing';
|
protected $_title = 'Old thing';
|
||||||
|
|
||||||
|
//@codingStandardsIgnoreStart
|
||||||
private $__noshow = 'Never ever';
|
private $__noshow = 'Never ever';
|
||||||
|
//@codingStandardsIgnoreEnd
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -366,7 +368,9 @@ class JsHelperTest extends CakeTestCase {
|
||||||
$this->assertTrue(file_exists(WWW_ROOT . $filename[1]));
|
$this->assertTrue(file_exists(WWW_ROOT . $filename[1]));
|
||||||
$contents = file_get_contents(WWW_ROOT . $filename[1]);
|
$contents = file_get_contents(WWW_ROOT . $filename[1]);
|
||||||
$this->assertRegExp('/one\s=\s1;\ntwo\s=\s2;/', $contents);
|
$this->assertRegExp('/one\s=\s1;\ntwo\s=\s2;/', $contents);
|
||||||
@unlink(WWW_ROOT . $filename[1]);
|
if (file_exists(WWW_ROOT . $filename[1])) {
|
||||||
|
unlink(WWW_ROOT . $filename[1]);
|
||||||
|
}
|
||||||
|
|
||||||
Configure::write('Cache.disable', true);
|
Configure::write('Cache.disable', true);
|
||||||
$this->Js->buffer('one = 1;');
|
$this->Js->buffer('one = 1;');
|
||||||
|
|
|
@ -279,7 +279,7 @@ class ScaffoldViewTest extends CakeTestCase {
|
||||||
|
|
||||||
$this->assertRegExp('/<h2>View Scaffold Mock<\/h2>/', $result);
|
$this->assertRegExp('/<h2>View Scaffold Mock<\/h2>/', $result);
|
||||||
$this->assertRegExp('/<dl>/', $result);
|
$this->assertRegExp('/<dl>/', $result);
|
||||||
//TODO: add specific tests for fields.
|
|
||||||
$this->assertRegExp('/<a href="\/scaffold_users\/view\/1">1<\/a>/', $result); //belongsTo links
|
$this->assertRegExp('/<a href="\/scaffold_users\/view\/1">1<\/a>/', $result); //belongsTo links
|
||||||
$this->assertRegExp('/<li><a href="\/scaffold_mock\/edit\/1">Edit Scaffold Mock<\/a>\s<\/li>/', $result);
|
$this->assertRegExp('/<li><a href="\/scaffold_mock\/edit\/1">Edit Scaffold Mock<\/a>\s<\/li>/', $result);
|
||||||
$this->assertRegExp('/<a href="\#" onclick="if[^>]*>Delete Scaffold Mock<\/a>\s<\/li>/', $result);
|
$this->assertRegExp('/<a href="\#" onclick="if[^>]*>Delete Scaffold Mock<\/a>\s<\/li>/', $result);
|
||||||
|
@ -370,7 +370,7 @@ class ScaffoldViewTest extends CakeTestCase {
|
||||||
|
|
||||||
$this->assertRegExp('/<h2>Scaffold Mock<\/h2>/', $result);
|
$this->assertRegExp('/<h2>Scaffold Mock<\/h2>/', $result);
|
||||||
$this->assertRegExp('/<table cellpadding="0" cellspacing="0">/', $result);
|
$this->assertRegExp('/<table cellpadding="0" cellspacing="0">/', $result);
|
||||||
//TODO: add testing for table generation
|
|
||||||
$this->assertRegExp('/<li><a href="\/admin\/scaffold_mock\/add">New Scaffold Mock<\/a><\/li>/', $result);
|
$this->assertRegExp('/<li><a href="\/admin\/scaffold_mock\/add">New Scaffold Mock<\/a><\/li>/', $result);
|
||||||
|
|
||||||
Configure::write('Routing.prefixes', $_backAdmin);
|
Configure::write('Routing.prefixes', $_backAdmin);
|
||||||
|
@ -454,7 +454,7 @@ class ScaffoldViewTest extends CakeTestCase {
|
||||||
|
|
||||||
$this->assertRegExp('/<h2>Scaffold Mock<\/h2>/', $result);
|
$this->assertRegExp('/<h2>Scaffold Mock<\/h2>/', $result);
|
||||||
$this->assertRegExp('/<table cellpadding="0" cellspacing="0">/', $result);
|
$this->assertRegExp('/<table cellpadding="0" cellspacing="0">/', $result);
|
||||||
//TODO: add testing for table generation
|
|
||||||
$this->assertRegExp('/<li><a href="\/member\/scaffold_mock\/add">New Scaffold Mock<\/a><\/li>/', $result);
|
$this->assertRegExp('/<li><a href="\/member\/scaffold_mock\/add">New Scaffold Mock<\/a><\/li>/', $result);
|
||||||
|
|
||||||
Configure::write('Routing.prefixes', $_backAdmin);
|
Configure::write('Routing.prefixes', $_backAdmin);
|
||||||
|
|
|
@ -1101,7 +1101,9 @@ class ViewTest extends CakeTestCase {
|
||||||
|
|
||||||
$this->assertRegExp('/^some cacheText/', $result);
|
$this->assertRegExp('/^some cacheText/', $result);
|
||||||
|
|
||||||
@unlink($path);
|
if (file_exists($path)) {
|
||||||
|
unlink($path);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -674,7 +674,7 @@ abstract class CakeTestCase extends PHPUnit_Framework_TestCase {
|
||||||
}
|
}
|
||||||
return $condition;
|
return $condition;
|
||||||
}
|
}
|
||||||
// @codingStandardsIgnoreStop
|
// @codingStandardsIgnoreEnd
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mock a model, maintain fixtures and table association
|
* Mock a model, maintain fixtures and table association
|
||||||
|
|
|
@ -82,7 +82,9 @@ class CakeTestSuiteCommand extends PHPUnit_TextUI_Command {
|
||||||
$result = $skeleton->generate(true);
|
$result = $skeleton->generate(true);
|
||||||
|
|
||||||
if (!$result['incomplete']) {
|
if (!$result['incomplete']) {
|
||||||
|
//@codingStandardsIgnoreStart
|
||||||
eval(str_replace(array('<?php', '?>'), '', $result['code']));
|
eval(str_replace(array('<?php', '?>'), '', $result['code']));
|
||||||
|
//@codingStandardsIgnoreEnd
|
||||||
$suite = new PHPUnit_Framework_TestSuite(
|
$suite = new PHPUnit_Framework_TestSuite(
|
||||||
$this->arguments['test'] . 'Test'
|
$this->arguments['test'] . 'Test'
|
||||||
);
|
);
|
||||||
|
|
|
@ -173,7 +173,7 @@ abstract class ControllerTestCase extends CakeTestCase {
|
||||||
*
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
private $__dirtyController = false;
|
protected $_dirtyController = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to enable calling ControllerTestCase::testAction() without the testing
|
* Used to enable calling ControllerTestCase::testAction() without the testing
|
||||||
|
@ -252,7 +252,7 @@ abstract class ControllerTestCase extends CakeTestCase {
|
||||||
$this->headers = Router::currentRoute()->response->header();
|
$this->headers = Router::currentRoute()->response->header();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ($this->__dirtyController) {
|
if ($this->_dirtyController) {
|
||||||
$this->controller = null;
|
$this->controller = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -275,7 +275,7 @@ abstract class ControllerTestCase extends CakeTestCase {
|
||||||
if (isset($this->controller->View)) {
|
if (isset($this->controller->View)) {
|
||||||
$this->view = $this->controller->View->fetch('__view_no_layout__');
|
$this->view = $this->controller->View->fetch('__view_no_layout__');
|
||||||
}
|
}
|
||||||
$this->__dirtyController = true;
|
$this->_dirtyController = true;
|
||||||
$this->headers = $Dispatch->response->header();
|
$this->headers = $Dispatch->response->header();
|
||||||
|
|
||||||
$_GET = $restore['get'];
|
$_GET = $restore['get'];
|
||||||
|
@ -366,7 +366,7 @@ abstract class ControllerTestCase extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
$_controller->constructClasses();
|
$_controller->constructClasses();
|
||||||
$this->__dirtyController = false;
|
$this->_dirtyController = false;
|
||||||
|
|
||||||
$this->controller = $_controller;
|
$this->controller = $_controller;
|
||||||
return $this->controller;
|
return $this->controller;
|
||||||
|
|
|
@ -395,7 +395,10 @@ class Debugger {
|
||||||
if (!file_exists($file)) {
|
if (!file_exists($file)) {
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
$data = @explode("\n", file_get_contents($file));
|
$data = file_get_contents($file);
|
||||||
|
if (!empty($data) && strpos($data, "\n") !== false) {
|
||||||
|
$data = explode("\n", $data);
|
||||||
|
}
|
||||||
|
|
||||||
if (empty($data) || !isset($data[$line])) {
|
if (empty($data) || !isset($data[$line])) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -378,7 +378,9 @@ class Folder {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($recursive === false && is_dir($path)) {
|
if ($recursive === false && is_dir($path)) {
|
||||||
|
//@codingStandardsIgnoreStart
|
||||||
if (@chmod($path, intval($mode, 8))) {
|
if (@chmod($path, intval($mode, 8))) {
|
||||||
|
//@codingStandardsIgnoreEnd
|
||||||
$this->_messages[] = __d('cake_dev', '%s changed to %s', $path, $mode);
|
$this->_messages[] = __d('cake_dev', '%s changed to %s', $path, $mode);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -399,7 +401,9 @@ class Folder {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//@codingStandardsIgnoreStart
|
||||||
if (@chmod($fullpath, intval($mode, 8))) {
|
if (@chmod($fullpath, intval($mode, 8))) {
|
||||||
|
//@codingStandardsIgnoreEnd
|
||||||
$this->_messages[] = __d('cake_dev', '%s changed to %s', $fullpath, $mode);
|
$this->_messages[] = __d('cake_dev', '%s changed to %s', $fullpath, $mode);
|
||||||
} else {
|
} else {
|
||||||
$this->_errors[] = __d('cake_dev', '%s NOT changed to %s', $fullpath, $mode);
|
$this->_errors[] = __d('cake_dev', '%s NOT changed to %s', $fullpath, $mode);
|
||||||
|
@ -583,13 +587,17 @@ class Folder {
|
||||||
foreach ($iterator as $item) {
|
foreach ($iterator as $item) {
|
||||||
$filePath = $item->getPathname();
|
$filePath = $item->getPathname();
|
||||||
if ($item->isFile() || $item->isLink()) {
|
if ($item->isFile() || $item->isLink()) {
|
||||||
|
//@codingStandardsIgnoreStart
|
||||||
if (@unlink($filePath)) {
|
if (@unlink($filePath)) {
|
||||||
|
//@codingStandardsIgnoreEnd
|
||||||
$this->_messages[] = __d('cake_dev', '%s removed', $filePath);
|
$this->_messages[] = __d('cake_dev', '%s removed', $filePath);
|
||||||
} else {
|
} else {
|
||||||
$this->_errors[] = __d('cake_dev', '%s NOT removed', $filePath);
|
$this->_errors[] = __d('cake_dev', '%s NOT removed', $filePath);
|
||||||
}
|
}
|
||||||
} elseif ($item->isDir() && !$item->isDot()) {
|
} elseif ($item->isDir() && !$item->isDot()) {
|
||||||
|
//@codingStandardsIgnoreStart
|
||||||
if (@rmdir($filePath)) {
|
if (@rmdir($filePath)) {
|
||||||
|
//@codingStandardsIgnoreEnd
|
||||||
$this->_messages[] = __d('cake_dev', '%s removed', $filePath);
|
$this->_messages[] = __d('cake_dev', '%s removed', $filePath);
|
||||||
} else {
|
} else {
|
||||||
$this->_errors[] = __d('cake_dev', '%s NOT removed', $filePath);
|
$this->_errors[] = __d('cake_dev', '%s NOT removed', $filePath);
|
||||||
|
@ -599,7 +607,9 @@ class Folder {
|
||||||
}
|
}
|
||||||
|
|
||||||
$path = rtrim($path, DS);
|
$path = rtrim($path, DS);
|
||||||
|
//@codingStandardsIgnoreStart
|
||||||
if (@rmdir($path)) {
|
if (@rmdir($path)) {
|
||||||
|
//@codingStandardsIgnoreEnd
|
||||||
$this->_messages[] = __d('cake_dev', '%s removed', $path);
|
$this->_messages[] = __d('cake_dev', '%s removed', $path);
|
||||||
} else {
|
} else {
|
||||||
$this->_errors[] = __d('cake_dev', '%s NOT removed', $path);
|
$this->_errors[] = __d('cake_dev', '%s NOT removed', $path);
|
||||||
|
@ -654,7 +664,9 @@ class Folder {
|
||||||
}
|
}
|
||||||
|
|
||||||
$exceptions = array_merge(array('.', '..', '.svn'), $options['skip']);
|
$exceptions = array_merge(array('.', '..', '.svn'), $options['skip']);
|
||||||
|
//@codingStandardsIgnoreStart
|
||||||
if ($handle = @opendir($fromDir)) {
|
if ($handle = @opendir($fromDir)) {
|
||||||
|
//@codingStandardsIgnoreEnd
|
||||||
while (($item = readdir($handle)) !== false) {
|
while (($item = readdir($handle)) !== false) {
|
||||||
$to = Folder::addPathElement($toDir, $item);
|
$to = Folder::addPathElement($toDir, $item);
|
||||||
if (($options['scheme'] != Folder::SKIP || !is_dir($to)) && !in_array($item, $exceptions)) {
|
if (($options['scheme'] != Folder::SKIP || !is_dir($to)) && !in_array($item, $exceptions)) {
|
||||||
|
|
|
@ -103,7 +103,7 @@ abstract class ObjectCollection {
|
||||||
if (empty($event->omitSubject)) {
|
if (empty($event->omitSubject)) {
|
||||||
$subject = $event->subject();
|
$subject = $event->subject();
|
||||||
}
|
}
|
||||||
//TODO: Temporary BC check, while we move all the triggers system into the CakeEventManager
|
|
||||||
foreach (array('break', 'breakOn', 'collectReturn', 'modParams') as $opt) {
|
foreach (array('break', 'breakOn', 'collectReturn', 'modParams') as $opt) {
|
||||||
if (isset($event->{$opt})) {
|
if (isset($event->{$opt})) {
|
||||||
$options[$opt] = $event->{$opt};
|
$options[$opt] = $event->{$opt};
|
||||||
|
|
|
@ -71,7 +71,6 @@ class Security {
|
||||||
*
|
*
|
||||||
* @param string $authKey Authorization hash
|
* @param string $authKey Authorization hash
|
||||||
* @return boolean Success
|
* @return boolean Success
|
||||||
* @todo Complete implementation
|
|
||||||
*/
|
*/
|
||||||
public static function validateAuthKey($authKey) {
|
public static function validateAuthKey($authKey) {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -45,7 +45,7 @@ class Set {
|
||||||
*/
|
*/
|
||||||
public static function merge($data, $merge = null) {
|
public static function merge($data, $merge = null) {
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
if (empty($args[1])) {
|
if (empty($args[1]) && count($args) <= 2) {
|
||||||
return (array)$args[0];
|
return (array)$args[0];
|
||||||
}
|
}
|
||||||
if (!is_array($args[0])) {
|
if (!is_array($args[0])) {
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
* @since CakePHP v .0.10.3.1400
|
* @since CakePHP v .0.10.3.1400
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
|
App::uses('HttpSocket', 'Network/Http');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* XML handling for Cake.
|
* XML handling for Cake.
|
||||||
|
@ -97,9 +98,15 @@ class Xml {
|
||||||
return self::fromArray((array)$input, $options);
|
return self::fromArray((array)$input, $options);
|
||||||
} elseif (strpos($input, '<') !== false) {
|
} elseif (strpos($input, '<') !== false) {
|
||||||
return self::_loadXml($input, $options);
|
return self::_loadXml($input, $options);
|
||||||
} elseif (file_exists($input) || strpos($input, 'http://') === 0 || strpos($input, 'https://') === 0) {
|
} elseif (file_exists($input)) {
|
||||||
$input = file_get_contents($input);
|
return self::_loadXml(file_get_contents($input), $options);
|
||||||
return self::_loadXml($input, $options);
|
} elseif (strpos($input, 'http://') === 0 || strpos($input, 'https://') === 0) {
|
||||||
|
$socket = new HttpSocket();
|
||||||
|
$response = $socket->get($input);
|
||||||
|
if (!$response->isOk()) {
|
||||||
|
throw new XmlException(__d('cake_dev', 'XML cannot be read.'));
|
||||||
|
}
|
||||||
|
return self::_loadXml($response->body, $options);
|
||||||
} elseif (!is_string($input)) {
|
} elseif (!is_string($input)) {
|
||||||
throw new XmlException(__d('cake_dev', 'Invalid input.'));
|
throw new XmlException(__d('cake_dev', 'Invalid input.'));
|
||||||
}
|
}
|
||||||
|
|
|
@ -341,20 +341,26 @@ class Helper extends Object {
|
||||||
$filepath = preg_replace('/^' . preg_quote($this->request->webroot, '/') . '/', '', $path);
|
$filepath = preg_replace('/^' . preg_quote($this->request->webroot, '/') . '/', '', $path);
|
||||||
$webrootPath = WWW_ROOT . str_replace('/', DS, $filepath);
|
$webrootPath = WWW_ROOT . str_replace('/', DS, $filepath);
|
||||||
if (file_exists($webrootPath)) {
|
if (file_exists($webrootPath)) {
|
||||||
|
//@codingStandardsIgnoreStart
|
||||||
return $path . '?' . @filemtime($webrootPath);
|
return $path . '?' . @filemtime($webrootPath);
|
||||||
|
//@codingStandardsIgnoreEnd
|
||||||
}
|
}
|
||||||
$segments = explode('/', ltrim($filepath, '/'));
|
$segments = explode('/', ltrim($filepath, '/'));
|
||||||
if ($segments[0] === 'theme') {
|
if ($segments[0] === 'theme') {
|
||||||
$theme = $segments[1];
|
$theme = $segments[1];
|
||||||
unset($segments[0], $segments[1]);
|
unset($segments[0], $segments[1]);
|
||||||
$themePath = App::themePath($theme) . 'webroot' . DS . implode(DS, $segments);
|
$themePath = App::themePath($theme) . 'webroot' . DS . implode(DS, $segments);
|
||||||
|
//@codingStandardsIgnoreStart
|
||||||
return $path . '?' . @filemtime($themePath);
|
return $path . '?' . @filemtime($themePath);
|
||||||
|
//@codingStandardsIgnoreEnd
|
||||||
} else {
|
} else {
|
||||||
$plugin = Inflector::camelize($segments[0]);
|
$plugin = Inflector::camelize($segments[0]);
|
||||||
if (CakePlugin::loaded($plugin)) {
|
if (CakePlugin::loaded($plugin)) {
|
||||||
unset($segments[0]);
|
unset($segments[0]);
|
||||||
$pluginPath = CakePlugin::path($plugin) . 'webroot' . DS . implode(DS, $segments);
|
$pluginPath = CakePlugin::path($plugin) . 'webroot' . DS . implode(DS, $segments);
|
||||||
|
//@codingStandardsIgnoreStart
|
||||||
return $path . '?' . @filemtime($pluginPath);
|
return $path . '?' . @filemtime($pluginPath);
|
||||||
|
//@codingStandardsIgnoreEnd
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -593,7 +599,6 @@ class Helper extends Object {
|
||||||
* @param string $id The name of the 'id' attribute.
|
* @param string $id The name of the 'id' attribute.
|
||||||
* @return mixed If $options was an array, an array will be returned with $id set. If a string
|
* @return mixed If $options was an array, an array will be returned with $id set. If a string
|
||||||
* was supplied, a string will be returned.
|
* was supplied, a string will be returned.
|
||||||
* @todo Refactor this method to not have as many input/output options.
|
|
||||||
*/
|
*/
|
||||||
public function domId($options = null, $id = 'id') {
|
public function domId($options = null, $id = 'id') {
|
||||||
if (is_array($options) && array_key_exists($id, $options) && $options[$id] === null) {
|
if (is_array($options) && array_key_exists($id, $options) && $options[$id] === null) {
|
||||||
|
@ -626,7 +631,6 @@ class Helper extends Object {
|
||||||
* @param string $key The name of the attribute to be set, defaults to 'name'
|
* @param string $key The name of the attribute to be set, defaults to 'name'
|
||||||
* @return mixed If an array was given for $options, an array with $key set will be returned.
|
* @return mixed If an array was given for $options, an array with $key set will be returned.
|
||||||
* If a string was supplied a string will be returned.
|
* If a string was supplied a string will be returned.
|
||||||
* @todo Refactor this method to not have as many input/output options.
|
|
||||||
*/
|
*/
|
||||||
protected function _name($options = array(), $field = null, $key = 'name') {
|
protected function _name($options = array(), $field = null, $key = 'name') {
|
||||||
if ($options === null) {
|
if ($options === null) {
|
||||||
|
@ -670,7 +674,6 @@ class Helper extends Object {
|
||||||
* @param string $key The name of the attribute to be set, defaults to 'value'
|
* @param string $key The name of the attribute to be set, defaults to 'value'
|
||||||
* @return mixed If an array was given for $options, an array with $key set will be returned.
|
* @return mixed If an array was given for $options, an array with $key set will be returned.
|
||||||
* If a string was supplied a string will be returned.
|
* If a string was supplied a string will be returned.
|
||||||
* @todo Refactor this method to not have as many input/output options.
|
|
||||||
*/
|
*/
|
||||||
public function value($options = array(), $field = null, $key = 'value') {
|
public function value($options = array(), $field = null, $key = 'value') {
|
||||||
if ($options === null) {
|
if ($options === null) {
|
||||||
|
|
|
@ -530,7 +530,9 @@ class View extends Object {
|
||||||
|
|
||||||
if (preg_match('/^<!--cachetime:(\\d+)-->/', $out, $match)) {
|
if (preg_match('/^<!--cachetime:(\\d+)-->/', $out, $match)) {
|
||||||
if (time() >= $match['1']) {
|
if (time() >= $match['1']) {
|
||||||
|
//@codingStandardsIgnoreStart
|
||||||
@unlink($filename);
|
@unlink($filename);
|
||||||
|
//@codingStandardsIgnoreEnd
|
||||||
unset ($out);
|
unset ($out);
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
|
@ -869,7 +871,7 @@ class View extends Object {
|
||||||
$content = $this->_evaluate($viewFile, $data);
|
$content = $this->_evaluate($viewFile, $data);
|
||||||
|
|
||||||
$afterEvent = new CakeEvent('View.afterRenderFile', $this, array($viewFile, $content));
|
$afterEvent = new CakeEvent('View.afterRenderFile', $this, array($viewFile, $content));
|
||||||
//TODO: For BC puporses, set extra info in the event object. Remove when appropriate
|
|
||||||
$afterEvent->modParams = 1;
|
$afterEvent->modParams = 1;
|
||||||
$eventManager->dispatch($afterEvent);
|
$eventManager->dispatch($afterEvent);
|
||||||
$content = $afterEvent->data[1];
|
$content = $afterEvent->data[1];
|
||||||
|
|
|
@ -422,19 +422,27 @@ if (!function_exists('cache')) {
|
||||||
$filetime = false;
|
$filetime = false;
|
||||||
|
|
||||||
if (file_exists($filename)) {
|
if (file_exists($filename)) {
|
||||||
|
//@codingStandardsIgnoreStart
|
||||||
$filetime = @filemtime($filename);
|
$filetime = @filemtime($filename);
|
||||||
|
//@codingStandardsIgnoreEnd
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($data === null) {
|
if ($data === null) {
|
||||||
if (file_exists($filename) && $filetime !== false) {
|
if (file_exists($filename) && $filetime !== false) {
|
||||||
if ($filetime + $timediff < $now) {
|
if ($filetime + $timediff < $now) {
|
||||||
|
//@codingStandardsIgnoreStart
|
||||||
@unlink($filename);
|
@unlink($filename);
|
||||||
|
//@codingStandardsIgnoreEnd
|
||||||
} else {
|
} else {
|
||||||
|
//@codingStandardsIgnoreStart
|
||||||
$data = @file_get_contents($filename);
|
$data = @file_get_contents($filename);
|
||||||
|
//@codingStandardsIgnoreEnd
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} elseif (is_writable(dirname($filename))) {
|
} elseif (is_writable(dirname($filename))) {
|
||||||
|
//@codingStandardsIgnoreStart
|
||||||
@file_put_contents($filename, $data, LOCK_EX);
|
@file_put_contents($filename, $data, LOCK_EX);
|
||||||
|
//@codingStandardsIgnoreEnd
|
||||||
}
|
}
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
@ -459,7 +467,9 @@ if (!function_exists('clearCache')) {
|
||||||
$cache = CACHE . $type . DS . $params;
|
$cache = CACHE . $type . DS . $params;
|
||||||
|
|
||||||
if (is_file($cache . $ext)) {
|
if (is_file($cache . $ext)) {
|
||||||
|
//@codingStandardsIgnoreStart
|
||||||
@unlink($cache . $ext);
|
@unlink($cache . $ext);
|
||||||
|
//@codingStandardsIgnoreEnd
|
||||||
return true;
|
return true;
|
||||||
} elseif (is_dir($cache)) {
|
} elseif (is_dir($cache)) {
|
||||||
$files = glob($cache . '*');
|
$files = glob($cache . '*');
|
||||||
|
@ -470,7 +480,9 @@ if (!function_exists('clearCache')) {
|
||||||
|
|
||||||
foreach ($files as $file) {
|
foreach ($files as $file) {
|
||||||
if (is_file($file) && strrpos($file, DS . 'empty') !== strlen($file) - 6) {
|
if (is_file($file) && strrpos($file, DS . 'empty') !== strlen($file) - 6) {
|
||||||
|
//@codingStandardsIgnoreStart
|
||||||
@unlink($file);
|
@unlink($file);
|
||||||
|
//@codingStandardsIgnoreEnd
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -491,7 +503,9 @@ if (!function_exists('clearCache')) {
|
||||||
}
|
}
|
||||||
foreach ($files as $file) {
|
foreach ($files as $file) {
|
||||||
if (is_file($file) && strrpos($file, DS . 'empty') !== strlen($file) - 6) {
|
if (is_file($file) && strrpos($file, DS . 'empty') !== strlen($file) - 6) {
|
||||||
|
//@codingStandardsIgnoreStart
|
||||||
@unlink($file);
|
@unlink($file);
|
||||||
|
//@codingStandardsIgnoreEnd
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue