Replace global $a with BaseObject::getApp()

This commit is contained in:
Hypolite Petovan 2018-07-09 22:39:59 -04:00
parent d0780ccf7d
commit 820afa2284
17 changed files with 51 additions and 56 deletions

View file

@ -16,10 +16,10 @@ use Friendica\Util\Network;
* Checking the upstream version is optional (opt-in) and can be done to either
* the master or the develop branch in the repository.
*/
class CheckVersion {
public static function execute() {
global $a;
class CheckVersion
{
public static function execute()
{
logger('checkversion: start');
$checkurl = Config::get('system', 'check_new_version_url', 'none');

View file

@ -13,9 +13,11 @@ use dba;
require_once 'include/dba.php';
Class Cron {
public static function execute($parameter = '', $generation = 0) {
global $a;
class Cron
{
public static function execute($parameter = '', $generation = 0)
{
$a = \Friendica\BaseObject::getApp();
// Poll contacts with specific parameters
if (!empty($parameter)) {

View file

@ -24,7 +24,7 @@ class CronJobs
{
public static function execute($command = '')
{
global $a;
$a = \Friendica\BaseObject::getApp();
// No parameter set? So return
if ($command == '') {

View file

@ -7,9 +7,11 @@ namespace Friendica\Worker;
use Friendica\Core\Config;
class DBUpdate {
public static function execute() {
$a = get_app();
class DBUpdate
{
public static function execute()
{
$a = \Friendica\BaseObject::getApp();
// We are deleting the latest dbupdate entry.
// This is done to avoid endless loops because the update was interupted.

View file

@ -15,7 +15,8 @@ use Friendica\Util\DateTimeFormat;
use Friendica\Util\Network;
use dba;
class DiscoverPoCo {
class DiscoverPoCo
{
/// @todo Clean up this mess of a parameter hell and split it in several classes
public static function execute($command = '', $param1 = '', $param2 = '', $param3 = '', $param4 = '')
{
@ -276,8 +277,6 @@ class DiscoverPoCo {
// It is not removed since I hope that there will be a successor.
return false;
$a = get_app();
$url = "http://gstools.org/api/users_search/".urlencode($search);
$result = Network::curl($url);

View file

@ -15,9 +15,11 @@ use dba;
require_once 'include/dba.php';
class Expire {
public static function execute($param = '', $hook_name = '') {
global $a;
class Expire
{
public static function execute($param = '', $hook_name = '')
{
$a = \Friendica\BaseObject::getApp();
require_once 'include/items.php';

View file

@ -7,9 +7,11 @@ namespace Friendica\Worker;
use Friendica\Core\Addon;
Class ForkHook {
public static function execute($name, $hook, $data) {
global $a;
Class ForkHook
{
public static function execute($name, $hook, $data)
{
$a = \Friendica\BaseObject::getApp();
Addon::callSingleHook($a, $name, $hook, $data);
}

View file

@ -48,9 +48,11 @@ require_once 'include/items.php';
* and ITEM_ID is the id of the item in the database that needs to be sent to others.
*/
class Notifier {
public static function execute($cmd, $item_id) {
global $a;
class Notifier
{
public static function execute($cmd, $item_id)
{
$a = \Friendica\BaseObject::getApp();
logger('notifier: invoked: '.$cmd.': '.$item_id, LOGGER_DEBUG);

View file

@ -21,8 +21,9 @@ require_once 'include/dba.php';
class OnePoll
{
public static function execute($contact_id = 0, $command = '') {
global $a;
public static function execute($contact_id = 0, $command = '')
{
$a = \Friendica\BaseObject::getApp();
require_once 'include/items.php';
@ -634,7 +635,8 @@ class OnePoll
return;
}
private static function RemoveReply($subject) {
private static function RemoveReply($subject)
{
while (in_array(strtolower(substr($subject, 0, 3)), ["re:", "aw:"])) {
$subject = trim(substr($subject, 4));
}
@ -648,7 +650,8 @@ class OnePoll
* @param array $contact The personal contact entry
* @param array $fields The fields that are updated
*/
private static function updateContact($contact, $fields) {
private static function updateContact($contact, $fields)
{
dba::update('contact', $fields, ['id' => $contact['id']]);
dba::update('contact', $fields, ['uid' => 0, 'nurl' => $contact['nurl']]);
}

View file

@ -15,7 +15,8 @@ use dba;
require_once 'include/items.php';
class PubSubPublish {
class PubSubPublish
{
public static function execute($pubsubpublish_id = 0)
{
if ($pubsubpublish_id == 0) {
@ -25,8 +26,9 @@ class PubSubPublish {
self::publish($pubsubpublish_id);
}
private static function publish($id) {
global $a;
private static function publish($id)
{
$a = \Friendica\BaseObject::getApp();
$subscriber = dba::selectFirst('push_subscriber', [], ['id' => $id]);
if (!DBM::is_result($subscriber)) {

View file

@ -25,8 +25,6 @@ class Queue
{
public static function execute($queue_id = 0)
{
global $a;
$cachekey_deadguy = 'queue_run:deadguy:';
$cachekey_server = 'queue_run:server:';

View file

@ -15,8 +15,6 @@ class UpdateGContact
{
public static function execute($contact_id)
{
global $a;
logger('update_gcontact: start');
if (empty($contact_id)) {