mirror of
https://github.com/friendica/friendica
synced 2025-04-26 01:50:11 +00:00
Rename App Methods
- renamed a lot of App methods to CamelCase - replaced direct public variables with get-/set-Methods
This commit is contained in:
parent
5f9dd11cfb
commit
5a02e39a65
94 changed files with 481 additions and 338 deletions
|
@ -197,7 +197,7 @@ class Addon extends BaseObject
|
|||
*/
|
||||
public static function registerHook($hook, $file, $function, $priority = 0)
|
||||
{
|
||||
$file = str_replace(self::getApp()->get_basepath() . DIRECTORY_SEPARATOR, '', $file);
|
||||
$file = str_replace(self::getApp()->getBasePath() . DIRECTORY_SEPARATOR, '', $file);
|
||||
|
||||
$condition = ['hook' => $hook, 'file' => $file, 'function' => $function];
|
||||
$exists = DBA::exists('hook', $condition);
|
||||
|
@ -220,7 +220,7 @@ class Addon extends BaseObject
|
|||
*/
|
||||
public static function unregisterHook($hook, $file, $function)
|
||||
{
|
||||
$relative_file = str_replace(self::getApp()->get_basepath() . DIRECTORY_SEPARATOR, '', $file);
|
||||
$relative_file = str_replace(self::getApp()->getBasePath() . DIRECTORY_SEPARATOR, '', $file);
|
||||
|
||||
// This here is only needed for fixing a problem that existed on the develop branch
|
||||
$condition = ['hook' => $hook, 'file' => $file, 'function' => $function];
|
||||
|
@ -368,7 +368,7 @@ class Addon extends BaseObject
|
|||
|
||||
$stamp1 = microtime(true);
|
||||
$f = file_get_contents("addon/$addon/$addon.php");
|
||||
$a->save_timestamp($stamp1, "file");
|
||||
$a->saveTimestamp($stamp1, "file");
|
||||
|
||||
$r = preg_match("|/\*.*\*/|msU", $f, $m);
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ class Cache extends \Friendica\BaseObject
|
|||
|
||||
$return = self::getDriver()->getAllKeys($prefix);
|
||||
|
||||
self::getApp()->save_timestamp($time, 'cache');
|
||||
self::getApp()->saveTimestamp($time, 'cache');
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ class Cache extends \Friendica\BaseObject
|
|||
|
||||
$return = self::getDriver()->get($key);
|
||||
|
||||
self::getApp()->save_timestamp($time, 'cache');
|
||||
self::getApp()->saveTimestamp($time, 'cache');
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ class Cache extends \Friendica\BaseObject
|
|||
|
||||
$return = self::getDriver()->set($key, $value, $duration);
|
||||
|
||||
self::getApp()->save_timestamp($time, 'cache_write');
|
||||
self::getApp()->saveTimestamp($time, 'cache_write');
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ class Cache extends \Friendica\BaseObject
|
|||
|
||||
$return = self::getDriver()->delete($key);
|
||||
|
||||
self::getApp()->save_timestamp($time, 'cache_write');
|
||||
self::getApp()->saveTimestamp($time, 'cache_write');
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ abstract class AbstractCacheDriver extends BaseObject
|
|||
protected function getCacheKey($key)
|
||||
{
|
||||
// We fetch with the hostname as key to avoid problems with other applications
|
||||
return self::getApp()->get_hostname() . ":" . $key;
|
||||
return self::getApp()->getHostName() . ":" . $key;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -34,7 +34,7 @@ abstract class AbstractCacheDriver extends BaseObject
|
|||
} else {
|
||||
// Keys are prefixed with the node hostname, let's remove it
|
||||
array_walk($keys, function (&$value) {
|
||||
$value = preg_replace('/^' . self::getApp()->get_hostname() . ':/', '', $value);
|
||||
$value = preg_replace('/^' . self::getApp()->getHostName() . ':/', '', $value);
|
||||
});
|
||||
|
||||
sort($keys);
|
||||
|
|
|
@ -84,8 +84,8 @@ HELP;
|
|||
if ($config_file != 'config' . DIRECTORY_SEPARATOR . 'local.ini.php') {
|
||||
// Copy config file
|
||||
$this->out("Copying config file...\n");
|
||||
if (!copy($a->basepath . DIRECTORY_SEPARATOR . $config_file, $a->basepath . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'local.ini.php')) {
|
||||
throw new RuntimeException("ERROR: Saving config file failed. Please copy '$config_file' to '$a->basepath" . DIRECTORY_SEPARATOR . "config" . DIRECTORY_SEPARATOR . "local.ini.php' manually.\n");
|
||||
if (!copy($a->getBasePath() . DIRECTORY_SEPARATOR . $config_file, $a->getBasePath() . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'local.ini.php')) {
|
||||
throw new RuntimeException("ERROR: Saving config file failed. Please copy '$config_file' to '" . $a->getBasePath() . "'" . DIRECTORY_SEPARATOR . "config" . DIRECTORY_SEPARATOR . "local.ini.php' manually.\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ HELP;
|
|||
}
|
||||
|
||||
//return from util folder to frindica base dir
|
||||
$dir = get_app()->get_basepath();
|
||||
$dir = get_app()->getBasePath();
|
||||
|
||||
//stack for dirs to search
|
||||
$dirstack = [];
|
||||
|
|
|
@ -86,7 +86,7 @@ class Install extends BaseObject
|
|||
|
||||
$app = self::getApp();
|
||||
|
||||
$result = file_put_contents($app->basepath . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'local.ini.php', $txt);
|
||||
$result = file_put_contents($app->getBasePath() . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'local.ini.php', $txt);
|
||||
if (!$result) {
|
||||
$app->data['txt'] = $txt;
|
||||
}
|
||||
|
|
|
@ -631,7 +631,7 @@ class NotificationsManager extends BaseObject
|
|||
// We have to distinguish between these two because they use different data.
|
||||
// Contact suggestions
|
||||
if ($it['fid']) {
|
||||
$return_addr = bin2hex(self::getApp()->user['nickname'] . '@' . self::getApp()->get_hostname() . ((self::getApp()->urlpath) ? '/' . self::getApp()->urlpath : ''));
|
||||
$return_addr = bin2hex(self::getApp()->user['nickname'] . '@' . self::getApp()->getHostName() . ((self::getApp()->getURLpath()) ? '/' . self::getApp()->getURLpath() : ''));
|
||||
|
||||
$intro = [
|
||||
'label' => 'friend_suggestion',
|
||||
|
|
|
@ -27,7 +27,7 @@ class System extends BaseObject
|
|||
*/
|
||||
public static function baseUrl($ssl = false)
|
||||
{
|
||||
return self::getApp()->get_baseurl($ssl);
|
||||
return self::getApp()->getBaseURL($ssl);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -39,7 +39,7 @@ class System extends BaseObject
|
|||
*/
|
||||
public static function removedBaseUrl($orig_url)
|
||||
{
|
||||
return self::getApp()->remove_baseurl($orig_url);
|
||||
return self::getApp()->removeBaseURL($orig_url);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -185,7 +185,7 @@ class System extends BaseObject
|
|||
if (is_bool($prefix) && !$prefix) {
|
||||
$prefix = '';
|
||||
} elseif (empty($prefix)) {
|
||||
$prefix = hash('crc32', self::getApp()->get_hostname());
|
||||
$prefix = hash('crc32', self::getApp()->getHostName());
|
||||
}
|
||||
|
||||
while (strlen($prefix) < ($size - 13)) {
|
||||
|
|
|
@ -50,7 +50,7 @@ class Theme
|
|||
$a = get_app();
|
||||
$stamp1 = microtime(true);
|
||||
$theme_file = file_get_contents("view/theme/$theme/theme.php");
|
||||
$a->save_timestamp($stamp1, "file");
|
||||
$a->saveTimestamp($stamp1, "file");
|
||||
|
||||
$result = preg_match("|/\*.*\*/|msU", $theme_file, $matches);
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ class Worker
|
|||
}
|
||||
|
||||
// Do we have too few memory?
|
||||
if ($a->min_memory_reached()) {
|
||||
if ($a->isMinMemoryReached()) {
|
||||
logger('Pre check: Memory limit reached, quitting.', LOGGER_DEBUG);
|
||||
return;
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ class Worker
|
|||
}
|
||||
|
||||
// Check free memory
|
||||
if ($a->min_memory_reached()) {
|
||||
if ($a->isMinMemoryReached()) {
|
||||
logger('Memory limit reached, quitting.', LOGGER_DEBUG);
|
||||
Lock::release('worker');
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue