Rename App Methods

- renamed a lot of App methods to CamelCase
- replaced direct public variables with get-/set-Methods
This commit is contained in:
Philipp Holzer 2018-10-09 19:58:58 +02:00
parent 5f9dd11cfb
commit 5a02e39a65
No known key found for this signature in database
GPG key ID: 517BE60E2CE5C8A5
94 changed files with 481 additions and 338 deletions

View file

@ -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);

View file

@ -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;
}

View file

@ -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);

View file

@ -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");
}
}

View file

@ -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 = [];

View file

@ -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;
}

View file

@ -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',

View file

@ -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)) {

View file

@ -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);

View file

@ -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;