Skip to content
Permalink
Browse files

Replacing self with static due to PHP5.3+. Following #7040.

  • Loading branch information...
dereuromark committed Jul 21, 2015
1 parent 27e40f0 commit 52e79987a28c852753d590fa98d3adb858ee4f69
Showing with 998 additions and 998 deletions.
  1. +71 −71 lib/Cake/Cache/Cache.php
  2. +3 −3 lib/Cake/Console/Command/ServerShell.php
  3. +5 −5 lib/Cake/Console/ConsoleErrorHandler.php
  4. +15 −15 lib/Cake/Console/ConsoleOutput.php
  5. +3 −3 lib/Cake/Controller/Component/Acl/PhpAcl.php
  6. +7 −7 lib/Cake/Controller/Component/AuthComponent.php
  7. +66 −66 lib/Cake/Core/App.php
  8. +23 −23 lib/Cake/Core/CakePlugin.php
  9. +37 −37 lib/Cake/Core/Configure.php
  10. +7 −7 lib/Cake/Error/ErrorHandler.php
  11. +7 −7 lib/Cake/Event/CakeEventManager.php
  12. +6 −6 lib/Cake/I18n/I18n.php
  13. +13 −13 lib/Cake/I18n/Multibyte.php
  14. +52 −52 lib/Cake/Log/CakeLog.php
  15. +37 −37 lib/Cake/Model/ConnectionManager.php
  16. +94 −94 lib/Cake/Model/Datasource/CakeSession.php
  17. +2 −2 lib/Cake/Model/Datasource/Database/Sqlserver.php
  18. +6 −6 lib/Cake/Model/Datasource/DboSource.php
  19. +1 −1 lib/Cake/Network/CakeRequest.php
  20. +4 −4 lib/Cake/Network/Email/CakeEmail.php
  21. +2 −2 lib/Cake/Network/Http/BasicAuthentication.php
  22. +2 −2 lib/Cake/Network/Http/DigestAuthentication.php
  23. +94 −94 lib/Cake/Routing/Router.php
  24. +1 −1 lib/Cake/Test/Case/Controller/Component/Auth/BlowfishAuthenticateTest.php
  25. +1 −1 lib/Cake/Test/Case/Controller/Component/Auth/FormAuthenticateTest.php
  26. +1 −1 lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php
  27. +7 −7 lib/Cake/Test/Case/Controller/Component/EmailComponentTest.php
  28. +2 −2 lib/Cake/Test/Case/Controller/Component/SessionComponentTest.php
  29. +1 −1 lib/Cake/Test/Case/Log/Engine/ConsoleLogTest.php
  30. +4 −4 lib/Cake/Test/Case/Model/Datasource/CakeSessionTest.php
  31. +2 −2 lib/Cake/Test/Case/Model/Datasource/Session/CacheSessionTest.php
  32. +2 −2 lib/Cake/Test/Case/Model/Datasource/Session/DatabaseSessionTest.php
  33. +1 −1 lib/Cake/Test/Case/Model/ModelIntegrationTest.php
  34. +75 −75 lib/Cake/Test/Case/Model/ModelWriteTest.php
  35. +2 −2 lib/Cake/Test/Case/Utility/FolderTest.php
  36. +18 −18 lib/Cake/Test/Case/Utility/HashTest.php
  37. +1 −1 lib/Cake/Test/Case/Utility/InflectorTest.php
  38. +9 −9 lib/Cake/TestSuite/CakeTestCase.php
  39. +2 −2 lib/Cake/TestSuite/CakeTestLoader.php
  40. +1 −1 lib/Cake/TestSuite/CakeTestRunner.php
  41. +2 −2 lib/Cake/TestSuite/CakeTestSuiteDispatcher.php
  42. +20 −20 lib/Cake/Utility/CakeNumber.php
  43. +3 −3 lib/Cake/Utility/CakeText.php
  44. +75 −75 lib/Cake/Utility/CakeTime.php
  45. +13 −13 lib/Cake/Utility/Debugger.php
  46. +3 −3 lib/Cake/Utility/Folder.php
  47. +38 −38 lib/Cake/Utility/Hash.php
  48. +72 −72 lib/Cake/Utility/Inflector.php
  49. +8 −8 lib/Cake/Utility/Security.php
  50. +55 −55 lib/Cake/Utility/Validation.php
  51. +10 −10 lib/Cake/Utility/Xml.php
  52. +6 −6 lib/Cake/View/Helper/FormHelper.php
  53. +6 −6 lib/Cake/View/View.php
@@ -125,33 +125,33 @@ public static function config($name = null, $settings = array()) {
}
$current = array();
if (isset(self::$_config[$name])) {
$current = self::$_config[$name];
if (isset(static::$_config[$name])) {
$current = static::$_config[$name];
}
if (!empty($settings)) {
self::$_config[$name] = $settings + $current;
static::$_config[$name] = $settings + $current;
}
if (empty(self::$_config[$name]['engine'])) {
if (empty(static::$_config[$name]['engine'])) {
return false;
}
if (!empty(self::$_config[$name]['groups'])) {
foreach (self::$_config[$name]['groups'] as $group) {
self::$_groups[$group][] = $name;
sort(self::$_groups[$group]);
self::$_groups[$group] = array_unique(self::$_groups[$group]);
if (!empty(static::$_config[$name]['groups'])) {
foreach (static::$_config[$name]['groups'] as $group) {
static::$_groups[$group][] = $name;
sort(static::$_groups[$group]);
static::$_groups[$group] = array_unique(static::$_groups[$group]);
}
}
$engine = self::$_config[$name]['engine'];
$engine = static::$_config[$name]['engine'];
if (!isset(self::$_engines[$name])) {
self::_buildEngine($name);
$settings = self::$_config[$name] = self::settings($name);
} elseif ($settings = self::set(self::$_config[$name], null, $name)) {
self::$_config[$name] = $settings;
if (!isset(static::$_engines[$name])) {
static::_buildEngine($name);
$settings = static::$_config[$name] = static::settings($name);
} elseif ($settings = static::set(static::$_config[$name], null, $name)) {
static::$_config[$name] = $settings;
}
return compact('engine', 'settings');
}
@@ -164,7 +164,7 @@ public static function config($name = null, $settings = array()) {
* @throws CacheException
*/
protected static function _buildEngine($name) {
$config = self::$_config[$name];
$config = static::$_config[$name];
list($plugin, $class) = pluginSplit($config['engine'], true);
$cacheClass = $class . 'Engine';
@@ -176,17 +176,17 @@ protected static function _buildEngine($name) {
if (!is_subclass_of($cacheClass, 'CacheEngine')) {
throw new CacheException(__d('cake_dev', 'Cache engines must use %s as a base class.', 'CacheEngine'));
}
self::$_engines[$name] = new $cacheClass();
if (!self::$_engines[$name]->init($config)) {
static::$_engines[$name] = new $cacheClass();
if (!static::$_engines[$name]->init($config)) {
$msg = __d(
'cake_dev',
'Cache engine "%s" is not properly configured. Ensure required extensions are installed, and credentials/permissions are correct',
$name
);
throw new CacheException($msg);
}
if (self::$_engines[$name]->settings['probability'] && time() % self::$_engines[$name]->settings['probability'] === 0) {
self::$_engines[$name]->gc();
if (static::$_engines[$name]->settings['probability'] && time() % static::$_engines[$name]->settings['probability'] === 0) {
static::$_engines[$name]->gc();
}
return true;
}
@@ -197,7 +197,7 @@ protected static function _buildEngine($name) {
* @return array Array of configured Cache config names.
*/
public static function configured() {
return array_keys(self::$_config);
return array_keys(static::$_config);
}
/**
@@ -209,10 +209,10 @@ public static function configured() {
* @return bool success of the removal, returns false when the config does not exist.
*/
public static function drop($name) {
if (!isset(self::$_config[$name])) {
if (!isset(static::$_config[$name])) {
return false;
}
unset(self::$_config[$name], self::$_engines[$name]);
unset(static::$_config[$name], static::$_engines[$name]);
return true;
}
@@ -243,29 +243,29 @@ public static function set($settings = array(), $value = null, $config = 'defaul
if (is_array($settings) && $value !== null) {
$config = $value;
}
if (!isset(self::$_config[$config]) || !isset(self::$_engines[$config])) {
if (!isset(static::$_config[$config]) || !isset(static::$_engines[$config])) {
return false;
}
if (!empty($settings)) {
self::$_reset = true;
static::$_reset = true;
}
if (self::$_reset === true) {
if (static::$_reset === true) {
if (empty($settings)) {
self::$_reset = false;
$settings = self::$_config[$config];
static::$_reset = false;
$settings = static::$_config[$config];
} else {
if (is_string($settings) && $value !== null) {
$settings = array($settings => $value);
}
$settings += self::$_config[$config];
$settings += static::$_config[$config];
if (isset($settings['duration']) && !is_numeric($settings['duration'])) {
$settings['duration'] = strtotime($settings['duration']) - time();
}
}
self::$_engines[$config]->settings = $settings;
static::$_engines[$config]->settings = $settings;
}
return self::settings($config);
return static::settings($config);
}
/**
@@ -278,7 +278,7 @@ public static function set($settings = array(), $value = null, $config = 'defaul
* @return void
*/
public static function gc($config = 'default', $expires = null) {
self::$_engines[$config]->gc($expires);
static::$_engines[$config]->gc($expires);
}
/**
@@ -300,29 +300,29 @@ public static function gc($config = 'default', $expires = null) {
* @return bool True if the data was successfully cached, false on failure
*/
public static function write($key, $value, $config = 'default') {
$settings = self::settings($config);
$settings = static::settings($config);
if (empty($settings)) {
return false;
}
if (!self::isInitialized($config)) {
if (!static::isInitialized($config)) {
return false;
}
$key = self::$_engines[$config]->key($key);
$key = static::$_engines[$config]->key($key);
if (!$key || is_resource($value)) {
return false;
}
$success = self::$_engines[$config]->write($settings['prefix'] . $key, $value, $settings['duration']);
self::set(null, $config);
$success = static::$_engines[$config]->write($settings['prefix'] . $key, $value, $settings['duration']);
static::set(null, $config);
if ($success === false && $value !== '') {
trigger_error(
__d('cake_dev',
"%s cache was unable to write '%s' to %s cache",
$config,
$key,
self::$_engines[$config]->settings['engine']
static::$_engines[$config]->settings['engine']
),
E_USER_WARNING
);
@@ -348,19 +348,19 @@ public static function write($key, $value, $config = 'default') {
* @return mixed The cached data, or false if the data doesn't exist, has expired, or if there was an error fetching it
*/
public static function read($key, $config = 'default') {
$settings = self::settings($config);
$settings = static::settings($config);
if (empty($settings)) {
return false;
}
if (!self::isInitialized($config)) {
if (!static::isInitialized($config)) {
return false;
}
$key = self::$_engines[$config]->key($key);
$key = static::$_engines[$config]->key($key);
if (!$key) {
return false;
}
return self::$_engines[$config]->read($settings['prefix'] . $key);
return static::$_engines[$config]->read($settings['prefix'] . $key);
}
/**
@@ -373,21 +373,21 @@ public static function read($key, $config = 'default') {
* or if there was an error fetching it.
*/
public static function increment($key, $offset = 1, $config = 'default') {
$settings = self::settings($config);
$settings = static::settings($config);
if (empty($settings)) {
return false;
}
if (!self::isInitialized($config)) {
if (!static::isInitialized($config)) {
return false;
}
$key = self::$_engines[$config]->key($key);
$key = static::$_engines[$config]->key($key);
if (!$key || !is_int($offset) || $offset < 0) {
return false;
}
$success = self::$_engines[$config]->increment($settings['prefix'] . $key, $offset);
self::set(null, $config);
$success = static::$_engines[$config]->increment($settings['prefix'] . $key, $offset);
static::set(null, $config);
return $success;
}
@@ -401,21 +401,21 @@ public static function increment($key, $offset = 1, $config = 'default') {
* or if there was an error fetching it
*/
public static function decrement($key, $offset = 1, $config = 'default') {
$settings = self::settings($config);
$settings = static::settings($config);
if (empty($settings)) {
return false;
}
if (!self::isInitialized($config)) {
if (!static::isInitialized($config)) {
return false;
}
$key = self::$_engines[$config]->key($key);
$key = static::$_engines[$config]->key($key);
if (!$key || !is_int($offset) || $offset < 0) {
return false;
}
$success = self::$_engines[$config]->decrement($settings['prefix'] . $key, $offset);
self::set(null, $config);
$success = static::$_engines[$config]->decrement($settings['prefix'] . $key, $offset);
static::set(null, $config);
return $success;
}
@@ -437,21 +437,21 @@ public static function decrement($key, $offset = 1, $config = 'default') {
* @return bool True if the value was successfully deleted, false if it didn't exist or couldn't be removed
*/
public static function delete($key, $config = 'default') {
$settings = self::settings($config);
$settings = static::settings($config);
if (empty($settings)) {
return false;
}
if (!self::isInitialized($config)) {
if (!static::isInitialized($config)) {
return false;
}
$key = self::$_engines[$config]->key($key);
$key = static::$_engines[$config]->key($key);
if (!$key) {
return false;
}
$success = self::$_engines[$config]->delete($settings['prefix'] . $key);
self::set(null, $config);
$success = static::$_engines[$config]->delete($settings['prefix'] . $key);
static::set(null, $config);
return $success;
}
@@ -463,11 +463,11 @@ public static function delete($key, $config = 'default') {
* @return bool True if the cache was successfully cleared, false otherwise
*/
public static function clear($check = false, $config = 'default') {
if (!self::isInitialized($config)) {
if (!static::isInitialized($config)) {
return false;
}
$success = self::$_engines[$config]->clear($check);
self::set(null, $config);
$success = static::$_engines[$config]->clear($check);
static::set(null, $config);
return $success;
}
@@ -479,11 +479,11 @@ public static function clear($check = false, $config = 'default') {
* @return bool True if the cache group was successfully cleared, false otherwise
*/
public static function clearGroup($group, $config = 'default') {
if (!self::isInitialized($config)) {
if (!static::isInitialized($config)) {
return false;
}
$success = self::$_engines[$config]->clearGroup($group);
self::set(null, $config);
$success = static::$_engines[$config]->clearGroup($group);
static::set(null, $config);
return $success;
}
@@ -497,7 +497,7 @@ public static function isInitialized($config = 'default') {
if (Configure::read('Cache.disable')) {
return false;
}
return isset(self::$_engines[$config]);
return isset(static::$_engines[$config]);
}
/**
@@ -508,8 +508,8 @@ public static function isInitialized($config = 'default') {
* @see Cache::config()
*/
public static function settings($name = 'default') {
if (!empty(self::$_engines[$name])) {
return self::$_engines[$name]->settings();
if (!empty(static::$_engines[$name])) {
return static::$_engines[$name]->settings();
}
return array();
}
@@ -535,10 +535,10 @@ public static function settings($name = 'default') {
*/
public static function groupConfigs($group = null) {
if ($group === null) {
return self::$_groups;
return static::$_groups;
}
if (isset(self::$_groups[$group])) {
return array($group => self::$_groups[$group]);
if (isset(static::$_groups[$group])) {
return array($group => static::$_groups[$group]);
}
throw new CacheException(__d('cake_dev', 'Invalid cache group %s', $group));
}
@@ -569,12 +569,12 @@ public static function groupConfigs($group = null) {
* @return mixed The results of the callable or unserialized results.
*/
public static function remember($key, $callable, $config = 'default') {
$existing = self::read($key, $config);
$existing = static::read($key, $config);
if ($existing !== false) {
return $existing;
}
$results = call_user_func($callable);
self::write($key, $results, $config);
static::write($key, $results, $config);
return $results;
}
@@ -65,8 +65,8 @@ class ServerShell extends AppShell {
* @return void
*/
public function initialize() {
$this->_host = self::DEFAULT_HOST;
$this->_port = self::DEFAULT_PORT;
$this->_host = static::DEFAULT_HOST;
$this->_port = static::DEFAULT_PORT;
$this->_documentRoot = WWW_ROOT;
}
@@ -135,7 +135,7 @@ public function main() {
escapeshellarg($this->_documentRoot . '/index.php')
);
$port = ($this->_port == self::DEFAULT_PORT) ? '' : ':' . $this->_port;
$port = ($this->_port == static::DEFAULT_PORT) ? '' : ':' . $this->_port;
$this->out(__d('cake_console', 'built-in server is running in http://%s%s/', $this->_host, $port));
system($command);
}
Oops, something went wrong.

0 comments on commit 52e7998

Please sign in to comment.
You can’t perform that action at this time.