1
0
Fork 0

Refactoring Core class structures ...

This commit is contained in:
Philipp Holzer 2021-10-26 21:44:29 +02:00
commit b216317477
Signed by: nupplaPhil
GPG key ID: 24A7501396EB5432
130 changed files with 1625 additions and 1397 deletions

View file

@ -24,8 +24,8 @@ namespace Friendica\Console;
use Asika\SimpleConsole\Console;
use Friendica\App;
use Friendica\App\BaseURL;
use Friendica\Core\Config\IConfig;
use Friendica\Core\Config\Cache\Cache;
use Friendica\Core\Config\Capability\IManageConfigValues;
use Friendica\Core\Config\ValueObject\Cache;
use Friendica\Core\Installer;
use Friendica\Core\Theme;
use Friendica\Database\Database;
@ -36,9 +36,9 @@ class AutomaticInstallation extends Console
{
/** @var App\Mode */
private $appMode;
/** @var \Friendica\Core\Config\Cache\Cache */
/** @var \Friendica\Core\Config\ValueObject\Cache */
private $configCache;
/** @var IConfig */
/** @var IManageConfigValues */
private $config;
/** @var Database */
private $dba;
@ -98,7 +98,7 @@ Examples
HELP;
}
public function __construct(App\Mode $appMode, Cache $configCache, IConfig $config, Database $dba, array $argv = null)
public function __construct(App\Mode $appMode, Cache $configCache, IManageConfigValues $config, Database $dba, array $argv = null)
{
parent::__construct($argv);
@ -252,8 +252,8 @@ HELP;
}
/**
* @param Installer $installer The Installer instance
* @param Cache $configCache The config cache
* @param Installer $installer The Installer instance
* @param \Friendica\Core\Config\ValueObject\Cache $configCache The config cache
*
* @return bool true if checks were successfully, otherwise false
* @throws \Friendica\Network\HTTPException\InternalServerErrorException

View file

@ -24,7 +24,7 @@ namespace Friendica\Console;
use Asika\SimpleConsole\CommandArgsException;
use Friendica\App;
use Friendica\Core\Cache\Enum\Duration;
use Friendica\Core\Cache\ICache;
use Friendica\Core\Cache\Capability\ICanCache;
use RuntimeException;
/**
@ -44,7 +44,7 @@ class Cache extends \Asika\SimpleConsole\Console
private $appMode;
/**
* @var ICache
* @var ICanCache
*/
private $cache;
@ -82,7 +82,7 @@ HELP;
return $help;
}
public function __construct(App\Mode $appMode, ICache $cache, array $argv = null)
public function __construct(App\Mode $appMode, ICanCache $cache, array $argv = null)
{
parent::__construct($argv);

View file

@ -23,7 +23,7 @@ namespace Friendica\Console;
use Asika\SimpleConsole\CommandArgsException;
use Friendica\App;
use Friendica\Core\Config\IConfig;
use Friendica\Core\Config\Capability\IManageConfigValues;
use RuntimeException;
/**
@ -56,7 +56,7 @@ class Config extends \Asika\SimpleConsole\Console
*/
private $appMode;
/**
* @var IConfig
* @var IManageConfigValues
*/
private $config;
@ -94,7 +94,7 @@ HELP;
return $help;
}
public function __construct(App\Mode $appMode, IConfig $config, array $argv = null)
public function __construct(App\Mode $appMode, IManageConfigValues $config, array $argv = null)
{
parent::__construct($argv);

View file

@ -21,7 +21,7 @@
namespace Friendica\Console;
use Friendica\Core\Config\Cache\Cache;
use Friendica\Core\Config\ValueObject\Cache;
use Friendica\Core\Update;
use Friendica\Database\Database;
use Friendica\Database\DBStructure;

View file

@ -23,7 +23,7 @@ namespace Friendica\Console;
use Asika\SimpleConsole\CommandArgsException;
use Friendica\App;
use Friendica\Core\Lock\ILock;
use Friendica\Core\Lock\Capability\ICanLock;
use RuntimeException;
/**
@ -42,7 +42,7 @@ class Lock extends \Asika\SimpleConsole\Console
private $appMode;
/**
* @var ILock
* @var \Friendica\Core\Lock\Capability\ICanLock
*/
private $lock;
@ -76,7 +76,7 @@ HELP;
return $help;
}
public function __construct(App\Mode $appMode, ILock $lock, array $argv = null)
public function __construct(App\Mode $appMode, ICanLock $lock, array $argv = null)
{
parent::__construct($argv);

View file

@ -22,7 +22,7 @@
namespace Friendica\Console;
use Friendica\App;
use Friendica\Core\Config\IConfig;
use Friendica\Core\Config\Capability\IManageConfigValues;
/**
* Sets maintenance mode for this node
@ -36,7 +36,7 @@ class Maintenance extends \Asika\SimpleConsole\Console
*/
private $appMode;
/**
* @var IConfig
* @var IManageConfigValues
*/
private $config;
@ -69,7 +69,7 @@ HELP;
return $help;
}
public function __construct(App\Mode $appMode, IConfig $config, $argv = null)
public function __construct(App\Mode $appMode, IManageConfigValues $config, $argv = null)
{
parent::__construct($argv);

View file

@ -22,7 +22,7 @@
namespace Friendica\Console;
use Friendica\App;
use Friendica\Core\Config\IConfig;
use Friendica\Core\Config\Capability\IManageConfigValues;
use Friendica\Core\L10n;
use Friendica\Core\Update;
@ -38,7 +38,7 @@ class PostUpdate extends \Asika\SimpleConsole\Console
*/
private $appMode;
/**
* @var IConfig
* @var \Friendica\Core\Config\Capability\IManageConfigValues
*/
private $config;
/**
@ -60,7 +60,7 @@ HELP;
return $help;
}
public function __construct(App\Mode $appMode, IConfig $config, L10n $l10n, array $argv = null)
public function __construct(App\Mode $appMode, IManageConfigValues $config, L10n $l10n, array $argv = null)
{
parent::__construct($argv);

View file

@ -24,7 +24,7 @@ namespace Friendica\Console;
use Asika\SimpleConsole\CommandArgsException;
use Asika\SimpleConsole\Console;
use Console_Table;
use Friendica\Core\Config\IConfig;
use Friendica\Core\Config\Capability\IManageConfigValues;
/**
* Manage blocked servers
@ -39,7 +39,7 @@ class ServerBlock extends Console
protected $helpOptions = ['h', 'help', '?'];
/**
* @var IConfig
* @var IManageConfigValues
*/
private $config;
@ -72,7 +72,7 @@ HELP;
return $help;
}
public function __construct(IConfig $config, $argv = null)
public function __construct(IManageConfigValues $config, $argv = null)
{
parent::__construct($argv);
@ -105,9 +105,9 @@ HELP;
* Exports the list of blocked domains including the reason for the
* block to a CSV file.
*
* @param IConfig $config
* @param IManageConfigValues $config
*/
private function exportBlockedServers(IConfig $config)
private function exportBlockedServers(IManageConfigValues $config)
{
$filename = $this->getArgument(1);
$blocklist = $config->get('system', 'blocklist', []);
@ -123,9 +123,9 @@ HELP;
* Imports a list of domains and a reason for the block from a CSV
* file, e.g. created with the export function.
*
* @param IConfig $config
* @param IManageConfigValues $config
*/
private function importBlockedServers(IConfig $config)
private function importBlockedServers(IManageConfigValues $config)
{
$filename = $this->getArgument(1);
$currBlockList = $config->get('system', 'blocklist', []);
@ -167,9 +167,9 @@ HELP;
/**
* Prints the whole list of blocked domains including the reason
*
* @param IConfig $config
* @param IManageConfigValues $config
*/
private function printBlockedServers(IConfig $config)
private function printBlockedServers(IManageConfigValues $config)
{
$table = new Console_Table();
$table->setHeaders(['Domain', 'Reason']);
@ -183,11 +183,11 @@ HELP;
/**
* Adds a server to the blocked list
*
* @param IConfig $config
* @param IManageConfigValues $config
*
* @return int The return code (0 = success, 1 = failed)
*/
private function addBlockedServer(IConfig $config)
private function addBlockedServer(IManageConfigValues $config)
{
if (count($this->args) < 2 || count($this->args) > 3) {
throw new CommandArgsException('Add needs a domain and optional a reason.');
@ -235,11 +235,11 @@ HELP;
/**
* Removes a server from the blocked list
*
* @param IConfig $config
* @param IManageConfigValues $config
*
* @return int The return code (0 = success, 1 = failed)
*/
private function removeBlockedServer(IConfig $config)
private function removeBlockedServer(IManageConfigValues $config)
{
if (count($this->args) !== 2) {
throw new CommandArgsException('Remove needs a second parameter.');

View file

@ -21,7 +21,7 @@
namespace Friendica\Console;
use Friendica\Core\Config\IConfig;
use Friendica\Core\Config\Capability\IManageConfigValues;
/**
* Tired of chasing typos and finding them after a commit.
@ -32,7 +32,7 @@ class Typo extends \Asika\SimpleConsole\Console
protected $helpOptions = ['h', 'help', '?'];
/**
* @var IConfig
* @var IManageConfigValues
*/
private $config;
@ -53,7 +53,7 @@ HELP;
return $help;
}
public function __construct(IConfig $config, array $argv = null)
public function __construct(IManageConfigValues $config, array $argv = null)
{
parent::__construct($argv);

View file

@ -25,7 +25,7 @@ use Console_Table;
use Friendica\App;
use Friendica\Content\Pager;
use Friendica\Core\L10n;
use Friendica\Core\PConfig\IPConfig;
use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
use Friendica\Model\Register;
use Friendica\Model\User as UserModel;
use Friendica\Util\Temporal;
@ -48,7 +48,7 @@ class User extends \Asika\SimpleConsole\Console
*/
private $l10n;
/**
* @var IPConfig
* @var IManagePersonalConfigValues
*/
private $pConfig;
@ -88,7 +88,7 @@ HELP;
return $help;
}
public function __construct(App\Mode $appMode, L10n $l10n, IPConfig $pConfig, array $argv = null)
public function __construct(App\Mode $appMode, L10n $l10n, IManagePersonalConfigValues $pConfig, array $argv = null)
{
parent::__construct($argv);