зеркало из https://github.com/nextcloud/server.git
Update core to PHP 7.4 standard
- Typed properties - Port to LoggerInterface Signed-off-by: Carl Schwan <carl@carlschwan.eu>
This commit is contained in:
Родитель
2b0d82675f
Коммит
b70c6a128f
|
@ -28,23 +28,19 @@ namespace OC\Core\BackgroundJobs;
|
|||
|
||||
use OC\BackgroundJob\QueuedJob;
|
||||
use OCP\IConfig;
|
||||
use OCP\ILogger;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class BackgroundCleanupUpdaterBackupsJob extends QueuedJob {
|
||||
protected IConfig $config;
|
||||
protected LoggerInterface $log;
|
||||
|
||||
/** @var IConfig */
|
||||
protected $config;
|
||||
/** @var ILogger */
|
||||
protected $log;
|
||||
|
||||
public function __construct(IConfig $config, ILogger $log) {
|
||||
public function __construct(IConfig $config, LoggerInterface $log) {
|
||||
$this->config = $config;
|
||||
$this->log = $log;
|
||||
}
|
||||
|
||||
/**
|
||||
* This job cleans up all backups except the latest 3 from the updaters backup directory
|
||||
*
|
||||
*/
|
||||
public function run($arguments) {
|
||||
$dataDir = $this->config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data');
|
||||
|
|
|
@ -35,13 +35,9 @@ use OCP\IUser;
|
|||
use OCP\IUserManager;
|
||||
|
||||
class CheckForUserCertificates extends QueuedJob {
|
||||
|
||||
/** @var IConfig */
|
||||
protected $config;
|
||||
/** @var IUserManager */
|
||||
private $userManager;
|
||||
/** @var IRootFolder */
|
||||
private $rootFolder;
|
||||
protected IConfig $config;
|
||||
private IUserManager $userManager;
|
||||
private IRootFolder $rootFolder;
|
||||
|
||||
public function __construct(IConfig $config, IUserManager $userManager, IRootFolder $rootFolder) {
|
||||
$this->config = $config;
|
||||
|
|
|
@ -31,9 +31,7 @@ use OCP\AppFramework\Utility\ITimeFactory;
|
|||
use OCP\BackgroundJob\TimedJob;
|
||||
|
||||
class CleanupLoginFlowV2 extends TimedJob {
|
||||
|
||||
/** @var LoginFlowV2Mapper */
|
||||
private $loginFlowV2Mapper;
|
||||
private LoginFlowV2Mapper $loginFlowV2Mapper;
|
||||
|
||||
public function __construct(ITimeFactory $time, LoginFlowV2Mapper $loginFlowV2Mapper) {
|
||||
parent::__construct($time);
|
||||
|
|
|
@ -31,11 +31,8 @@ use OCP\IUser;
|
|||
use OCP\IUserManager;
|
||||
|
||||
class LookupServerSendCheckBackgroundJob extends QueuedJob {
|
||||
|
||||
/** @var IConfig */
|
||||
protected $config;
|
||||
/** @var IUserManager */
|
||||
private $userManager;
|
||||
protected IConfig $config;
|
||||
private IUserManager $userManager;
|
||||
|
||||
public function __construct(IConfig $config, IUserManager $userManager) {
|
||||
$this->config = $config;
|
||||
|
|
|
@ -33,16 +33,9 @@ use Symfony\Component\Console\Input\InputInterface;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class Disable extends Command implements CompletionAwareInterface {
|
||||
protected IAppManager $appManager;
|
||||
protected int $exitCode = 0;
|
||||
|
||||
/** @var IAppManager */
|
||||
protected $appManager;
|
||||
|
||||
/** @var int */
|
||||
protected $exitCode = 0;
|
||||
|
||||
/**
|
||||
* @param IAppManager $appManager
|
||||
*/
|
||||
public function __construct(IAppManager $appManager) {
|
||||
parent::__construct();
|
||||
$this->appManager = $appManager;
|
||||
|
|
|
@ -39,20 +39,10 @@ use Symfony\Component\Console\Input\InputOption;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class Enable extends Command implements CompletionAwareInterface {
|
||||
protected IAppManager $appManager;
|
||||
protected IGroupManager $groupManager;
|
||||
protected int $exitCode = 0;
|
||||
|
||||
/** @var IAppManager */
|
||||
protected $appManager;
|
||||
|
||||
/** @var IGroupManager */
|
||||
protected $groupManager;
|
||||
|
||||
/** @var int */
|
||||
protected $exitCode = 0;
|
||||
|
||||
/**
|
||||
* @param IAppManager $appManager
|
||||
* @param IGroupManager $groupManager
|
||||
*/
|
||||
public function __construct(IAppManager $appManager, IGroupManager $groupManager) {
|
||||
parent::__construct();
|
||||
$this->appManager = $appManager;
|
||||
|
|
|
@ -33,13 +33,8 @@ use Symfony\Component\Console\Input\InputOption;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class ListApps extends Base {
|
||||
protected IAppManager $manager;
|
||||
|
||||
/** @var IAppManager */
|
||||
protected $manager;
|
||||
|
||||
/**
|
||||
* @param IAppManager $manager
|
||||
*/
|
||||
public function __construct(IAppManager $manager) {
|
||||
parent::__construct();
|
||||
$this->manager = $manager;
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace OC\Core\Command\App;
|
|||
|
||||
use OC\Installer;
|
||||
use OCP\App\IAppManager;
|
||||
use OCP\ILogger;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Stecman\Component\Symfony\Console\BashCompletion\Completion\CompletionAwareInterface;
|
||||
use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
|
@ -39,20 +39,11 @@ use Symfony\Component\Console\Output\OutputInterface;
|
|||
use Throwable;
|
||||
|
||||
class Remove extends Command implements CompletionAwareInterface {
|
||||
protected IAppManager $manager;
|
||||
private Installer $installer;
|
||||
private LoggerInterface $logger;
|
||||
|
||||
/** @var IAppManager */
|
||||
protected $manager;
|
||||
/** @var Installer */
|
||||
private $installer;
|
||||
/** @var ILogger */
|
||||
private $logger;
|
||||
|
||||
/**
|
||||
* @param IAppManager $manager
|
||||
* @param Installer $installer
|
||||
* @param ILogger $logger
|
||||
*/
|
||||
public function __construct(IAppManager $manager, Installer $installer, ILogger $logger) {
|
||||
public function __construct(IAppManager $manager, Installer $installer, LoggerInterface $logger) {
|
||||
parent::__construct();
|
||||
$this->manager = $manager;
|
||||
$this->installer = $installer;
|
||||
|
@ -100,9 +91,9 @@ class Remove extends Command implements CompletionAwareInterface {
|
|||
$output->writeln($appId . ' disabled');
|
||||
} catch (Throwable $e) {
|
||||
$output->writeln('<error>Error: ' . $e->getMessage() . '</error>');
|
||||
$this->logger->logException($e, [
|
||||
$this->logger->error($e->getMessage(), [
|
||||
'app' => 'CLI',
|
||||
'level' => ILogger::ERROR
|
||||
'exception' => $e,
|
||||
]);
|
||||
return 1;
|
||||
}
|
||||
|
@ -113,9 +104,9 @@ class Remove extends Command implements CompletionAwareInterface {
|
|||
$result = $this->installer->removeApp($appId);
|
||||
} catch (Throwable $e) {
|
||||
$output->writeln('<error>Error: ' . $e->getMessage() . '</error>');
|
||||
$this->logger->logException($e, [
|
||||
$this->logger->error($e->getMessage(), [
|
||||
'app' => 'CLI',
|
||||
'level' => ILogger::ERROR
|
||||
'exception' => $e,
|
||||
]);
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace OC\Core\Command\App;
|
|||
|
||||
use OC\Installer;
|
||||
use OCP\App\IAppManager;
|
||||
use OCP\ILogger;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
|
@ -37,19 +37,11 @@ use Symfony\Component\Console\Input\InputOption;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class Update extends Command {
|
||||
protected IAppManager $manager;
|
||||
private Installer $installer;
|
||||
private LoggerInterface $logger;
|
||||
|
||||
/** @var IAppManager */
|
||||
protected $manager;
|
||||
/** @var Installer */
|
||||
private $installer;
|
||||
/** @var ILogger */
|
||||
private $logger;
|
||||
|
||||
/**
|
||||
* @param IAppManager $manager
|
||||
* @param Installer $installer
|
||||
*/
|
||||
public function __construct(IAppManager $manager, Installer $installer, ILogger $logger) {
|
||||
public function __construct(IAppManager $manager, Installer $installer, LoggerInterface $logger) {
|
||||
parent::__construct();
|
||||
$this->manager = $manager;
|
||||
$this->installer = $installer;
|
||||
|
@ -114,7 +106,10 @@ class Update extends Command {
|
|||
try {
|
||||
$result = $this->installer->updateAppstoreApp($appId, $input->getOption('allow-unstable'));
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->logException($e, ['message' => 'Failure during update of app "' . $appId . '"','app' => 'app:update']);
|
||||
$this->logger->error('Failure during update of app "' . $appId . '"', [
|
||||
'app' => 'app:update',
|
||||
'exception' => $e,
|
||||
]);
|
||||
$output->writeln('Error: ' . $e->getMessage());
|
||||
$return = 1;
|
||||
}
|
||||
|
|
|
@ -38,15 +38,8 @@ use Symfony\Component\Console\Output\OutputInterface;
|
|||
*/
|
||||
abstract class Base extends Command {
|
||||
abstract protected function getMode();
|
||||
protected IConfig $config;
|
||||
|
||||
/**
|
||||
* @var \OCP\IConfig
|
||||
*/
|
||||
protected $config;
|
||||
|
||||
/**
|
||||
* @param \OCP\IConfig $config
|
||||
*/
|
||||
public function __construct(IConfig $config) {
|
||||
parent::__construct();
|
||||
$this->config = $config;
|
||||
|
|
|
@ -35,10 +35,8 @@ use Symfony\Component\Console\Input\InputOption;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class Job extends Command {
|
||||
/** @var IJobList */
|
||||
protected $jobList;
|
||||
/** @var ILogger */
|
||||
protected $logger;
|
||||
protected IJobList $jobList;
|
||||
protected ILogger $logger;
|
||||
|
||||
public function __construct(IJobList $jobList,
|
||||
ILogger $logger) {
|
||||
|
|
|
@ -38,13 +38,9 @@ class Base extends Command implements CompletionAwareInterface {
|
|||
public const OUTPUT_FORMAT_JSON = 'json';
|
||||
public const OUTPUT_FORMAT_JSON_PRETTY = 'json_pretty';
|
||||
|
||||
protected $defaultOutputFormat = self::OUTPUT_FORMAT_PLAIN;
|
||||
|
||||
/** @var boolean */
|
||||
private $php_pcntl_signal = false;
|
||||
|
||||
/** @var boolean */
|
||||
private $interrupted = false;
|
||||
protected string $defaultOutputFormat = self::OUTPUT_FORMAT_PLAIN;
|
||||
private bool $php_pcntl_signal = false;
|
||||
private bool $interrupted = false;
|
||||
|
||||
protected function configure() {
|
||||
$this
|
||||
|
@ -58,13 +54,7 @@ class Base extends Command implements CompletionAwareInterface {
|
|||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param InputInterface $input
|
||||
* @param OutputInterface $output
|
||||
* @param array $items
|
||||
* @param string $prefix
|
||||
*/
|
||||
protected function writeArrayInOutputFormat(InputInterface $input, OutputInterface $output, $items, $prefix = ' - ') {
|
||||
protected function writeArrayInOutputFormat(InputInterface $input, OutputInterface $output, array $items, string $prefix = ' - ') {
|
||||
switch ($input->getOption('output')) {
|
||||
case self::OUTPUT_FORMAT_JSON:
|
||||
$output->writeln(json_encode($items));
|
||||
|
@ -95,8 +85,6 @@ class Base extends Command implements CompletionAwareInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param InputInterface $input
|
||||
* @param OutputInterface $output
|
||||
* @param mixed $item
|
||||
*/
|
||||
protected function writeMixedInOutputFormat(InputInterface $input, OutputInterface $output, $item) {
|
||||
|
@ -118,7 +106,7 @@ class Base extends Command implements CompletionAwareInterface {
|
|||
}
|
||||
}
|
||||
|
||||
protected function valueToString($value, $returnNull = true) {
|
||||
protected function valueToString($value, bool $returnNull = true): ?string {
|
||||
if ($value === false) {
|
||||
return 'false';
|
||||
} elseif ($value === true) {
|
||||
|
|
|
@ -34,9 +34,7 @@ use Symfony\Component\Console\Input\InputInterface;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class Test extends Command {
|
||||
|
||||
/** @var IEventDispatcher */
|
||||
private $eventDispatcher;
|
||||
private IEventDispatcher $eventDispatcher;
|
||||
|
||||
public function __construct(IEventDispatcher $eventDispatcher) {
|
||||
parent::__construct();
|
||||
|
|
|
@ -29,10 +29,7 @@ use Symfony\Component\Console\Input\InputInterface;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class Check extends Base {
|
||||
/**
|
||||
* @var SystemConfig
|
||||
*/
|
||||
private $config;
|
||||
private SystemConfig $config;
|
||||
|
||||
public function __construct(SystemConfig $config) {
|
||||
parent::__construct();
|
||||
|
|
|
@ -26,9 +26,7 @@ use OCP\IConfig;
|
|||
use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext;
|
||||
|
||||
abstract class Base extends \OC\Core\Command\Base {
|
||||
|
||||
/** * @var IConfig */
|
||||
protected $config;
|
||||
protected IConfig $config;
|
||||
|
||||
/**
|
||||
* @param string $argumentName
|
||||
|
|
|
@ -28,8 +28,7 @@ use Symfony\Component\Console\Input\InputOption;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class DeleteConfig extends Base {
|
||||
/** * @var IConfig */
|
||||
protected $config;
|
||||
protected IConfig $config;
|
||||
|
||||
/**
|
||||
* @param IConfig $config
|
||||
|
|
|
@ -28,12 +28,8 @@ use Symfony\Component\Console\Input\InputOption;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class GetConfig extends Base {
|
||||
/** * @var IConfig */
|
||||
protected $config;
|
||||
protected IConfig $config;
|
||||
|
||||
/**
|
||||
* @param IConfig $config
|
||||
*/
|
||||
public function __construct(IConfig $config) {
|
||||
parent::__construct();
|
||||
$this->config = $config;
|
||||
|
|
|
@ -28,12 +28,8 @@ use Symfony\Component\Console\Input\InputOption;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class SetConfig extends Base {
|
||||
/** * @var IConfig */
|
||||
protected $config;
|
||||
protected IConfig $config;
|
||||
|
||||
/**
|
||||
* @param IConfig $config
|
||||
*/
|
||||
public function __construct(IConfig $config) {
|
||||
parent::__construct();
|
||||
$this->config = $config;
|
||||
|
|
|
@ -34,14 +34,9 @@ use Symfony\Component\Console\Input\InputInterface;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class Import extends Command implements CompletionAwareInterface {
|
||||
protected $validRootKeys = ['system', 'apps'];
|
||||
protected array $validRootKeys = ['system', 'apps'];
|
||||
protected IConfig $config;
|
||||
|
||||
/** @var IConfig */
|
||||
protected $config;
|
||||
|
||||
/**
|
||||
* @param IConfig $config
|
||||
*/
|
||||
public function __construct(IConfig $config) {
|
||||
parent::__construct();
|
||||
$this->config = $config;
|
||||
|
|
|
@ -32,18 +32,10 @@ use Symfony\Component\Console\Input\InputOption;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class ListConfigs extends Base {
|
||||
protected $defaultOutputFormat = self::OUTPUT_FORMAT_JSON_PRETTY;
|
||||
protected string $defaultOutputFormat = self::OUTPUT_FORMAT_JSON_PRETTY;
|
||||
protected SystemConfig $systemConfig;
|
||||
protected IAppConfig $appConfig;
|
||||
|
||||
/** * @var SystemConfig */
|
||||
protected $systemConfig;
|
||||
|
||||
/** @var IAppConfig */
|
||||
protected $appConfig;
|
||||
|
||||
/**
|
||||
* @param SystemConfig $systemConfig
|
||||
* @param IAppConfig $appConfig
|
||||
*/
|
||||
public function __construct(SystemConfig $systemConfig, IAppConfig $appConfig) {
|
||||
parent::__construct();
|
||||
$this->systemConfig = $systemConfig;
|
||||
|
|
|
@ -26,9 +26,12 @@ use OC\SystemConfig;
|
|||
use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext;
|
||||
|
||||
abstract class Base extends \OC\Core\Command\Base {
|
||||
protected SystemConfig $systemConfig;
|
||||
|
||||
/** @var SystemConfig */
|
||||
protected $systemConfig;
|
||||
public function __construct(SystemConfig $systemConfig) {
|
||||
parent::__construct();
|
||||
$this->systemConfig = $systemConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $argumentName
|
||||
|
|
|
@ -30,15 +30,8 @@ use Symfony\Component\Console\Input\InputOption;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class DeleteConfig extends Base {
|
||||
/** * @var SystemConfig */
|
||||
protected $systemConfig;
|
||||
|
||||
/**
|
||||
* @param SystemConfig $systemConfig
|
||||
*/
|
||||
public function __construct(SystemConfig $systemConfig) {
|
||||
parent::__construct();
|
||||
$this->systemConfig = $systemConfig;
|
||||
parent::__construct($systemConfig);
|
||||
}
|
||||
|
||||
protected function configure() {
|
||||
|
|
|
@ -29,15 +29,8 @@ use Symfony\Component\Console\Input\InputOption;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class GetConfig extends Base {
|
||||
/** * @var SystemConfig */
|
||||
protected $systemConfig;
|
||||
|
||||
/**
|
||||
* @param SystemConfig $systemConfig
|
||||
*/
|
||||
public function __construct(SystemConfig $systemConfig) {
|
||||
parent::__construct();
|
||||
$this->systemConfig = $systemConfig;
|
||||
parent::__construct($systemConfig);
|
||||
}
|
||||
|
||||
protected function configure() {
|
||||
|
|
|
@ -32,15 +32,8 @@ use Symfony\Component\Console\Input\InputOption;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class SetConfig extends Base {
|
||||
/** * @var SystemConfig */
|
||||
protected $systemConfig;
|
||||
|
||||
/**
|
||||
* @param SystemConfig $systemConfig
|
||||
*/
|
||||
public function __construct(SystemConfig $systemConfig) {
|
||||
parent::__construct();
|
||||
$this->systemConfig = $systemConfig;
|
||||
parent::__construct($systemConfig);
|
||||
}
|
||||
|
||||
protected function configure() {
|
||||
|
|
|
@ -45,12 +45,8 @@ use Symfony\Component\EventDispatcher\GenericEvent;
|
|||
* @package OC\Core\Command\Db
|
||||
*/
|
||||
class AddMissingColumns extends Command {
|
||||
|
||||
/** @var Connection */
|
||||
private $connection;
|
||||
|
||||
/** @var EventDispatcherInterface */
|
||||
private $dispatcher;
|
||||
private Connection $connection;
|
||||
private EventDispatcherInterface $dispatcher;
|
||||
|
||||
public function __construct(Connection $connection, EventDispatcherInterface $dispatcher) {
|
||||
parent::__construct();
|
||||
|
|
|
@ -53,12 +53,8 @@ use Symfony\Component\EventDispatcher\GenericEvent;
|
|||
* @package OC\Core\Command\Db
|
||||
*/
|
||||
class AddMissingIndices extends Command {
|
||||
|
||||
/** @var Connection */
|
||||
private $connection;
|
||||
|
||||
/** @var EventDispatcherInterface */
|
||||
private $dispatcher;
|
||||
private Connection $connection;
|
||||
private EventDispatcherInterface $dispatcher;
|
||||
|
||||
public function __construct(Connection $connection, EventDispatcherInterface $dispatcher) {
|
||||
parent::__construct();
|
||||
|
|
|
@ -45,12 +45,8 @@ use Symfony\Component\EventDispatcher\GenericEvent;
|
|||
* @package OC\Core\Command\Db
|
||||
*/
|
||||
class AddMissingPrimaryKeys extends Command {
|
||||
|
||||
/** @var Connection */
|
||||
private $connection;
|
||||
|
||||
/** @var EventDispatcherInterface */
|
||||
private $dispatcher;
|
||||
private Connection $connection;
|
||||
private EventDispatcherInterface $dispatcher;
|
||||
|
||||
public function __construct(Connection $connection, EventDispatcherInterface $dispatcher) {
|
||||
parent::__construct();
|
||||
|
|
|
@ -42,13 +42,8 @@ use Symfony\Component\Console\Output\OutputInterface;
|
|||
use Symfony\Component\Console\Question\ConfirmationQuestion;
|
||||
|
||||
class ConvertFilecacheBigInt extends Command {
|
||||
private Connection $connection;
|
||||
|
||||
/** @var Connection */
|
||||
private $connection;
|
||||
|
||||
/**
|
||||
* @param Connection $connection
|
||||
*/
|
||||
public function __construct(Connection $connection) {
|
||||
$this->connection = $connection;
|
||||
parent::__construct();
|
||||
|
|
|
@ -37,15 +37,9 @@ use Symfony\Component\Console\Input\InputInterface;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class ConvertMysqlToMB4 extends Command {
|
||||
/** @var IConfig */
|
||||
private $config;
|
||||
|
||||
/** @var IDBConnection */
|
||||
private $connection;
|
||||
|
||||
/** @var IURLGenerator */
|
||||
private $urlGenerator;
|
||||
|
||||
private IConfig $config;
|
||||
private IDBConnection $connection;
|
||||
private IURLGenerator $urlGenerator;
|
||||
private LoggerInterface $logger;
|
||||
|
||||
public function __construct(
|
||||
|
|
|
@ -56,23 +56,10 @@ use function preg_match;
|
|||
use function preg_quote;
|
||||
|
||||
class ConvertType extends Command implements CompletionAwareInterface {
|
||||
/**
|
||||
* @var \OCP\IConfig
|
||||
*/
|
||||
protected $config;
|
||||
protected IConfig $config;
|
||||
protected ConnectionFactory $connectionFactory;
|
||||
protected array $columnTypes;
|
||||
|
||||
/**
|
||||
* @var \OC\DB\ConnectionFactory
|
||||
*/
|
||||
protected $connectionFactory;
|
||||
|
||||
/** @var array */
|
||||
protected $columnTypes;
|
||||
|
||||
/**
|
||||
* @param \OCP\IConfig $config
|
||||
* @param \OC\DB\ConnectionFactory $connectionFactory
|
||||
*/
|
||||
public function __construct(IConfig $config, ConnectionFactory $connectionFactory) {
|
||||
$this->config = $config;
|
||||
$this->connectionFactory = $connectionFactory;
|
||||
|
|
|
@ -35,19 +35,9 @@ use Symfony\Component\Console\Input\InputInterface;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class ExecuteCommand extends Command implements CompletionAwareInterface {
|
||||
private Connection $connection;
|
||||
private IConfig $config;
|
||||
|
||||
/** @var Connection */
|
||||
private $connection;
|
||||
|
||||
/** @var IConfig */
|
||||
private $config;
|
||||
|
||||
/**
|
||||
* ExecuteCommand constructor.
|
||||
*
|
||||
* @param Connection $connection
|
||||
* @param IConfig $config
|
||||
*/
|
||||
public function __construct(Connection $connection, IConfig $config) {
|
||||
$this->connection = $connection;
|
||||
$this->config = $config;
|
||||
|
|
|
@ -106,16 +106,9 @@ class {{classname}} extends SimpleMigrationStep {
|
|||
}
|
||||
';
|
||||
|
||||
/** @var Connection */
|
||||
protected $connection;
|
||||
protected Connection $connection;
|
||||
protected IAppManager $appManager;
|
||||
|
||||
/** @var IAppManager */
|
||||
protected $appManager;
|
||||
|
||||
/**
|
||||
* @param Connection $connection
|
||||
* @param IAppManager $appManager
|
||||
*/
|
||||
public function __construct(Connection $connection, IAppManager $appManager) {
|
||||
$this->connection = $connection;
|
||||
$this->appManager = $appManager;
|
||||
|
|
|
@ -33,13 +33,8 @@ use Symfony\Component\Console\Input\InputInterface;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class MigrateCommand extends Command implements CompletionAwareInterface {
|
||||
private Connection $connection;
|
||||
|
||||
/** @var Connection */
|
||||
private $connection;
|
||||
|
||||
/**
|
||||
* @param Connection $connection
|
||||
*/
|
||||
public function __construct(Connection $connection) {
|
||||
$this->connection = $connection;
|
||||
parent::__construct();
|
||||
|
|
|
@ -34,9 +34,7 @@ use Symfony\Component\Console\Input\InputInterface;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class StatusCommand extends Command implements CompletionAwareInterface {
|
||||
|
||||
/** @var Connection */
|
||||
private $connection;
|
||||
private Connection $connection;
|
||||
|
||||
public function __construct(Connection $connection) {
|
||||
$this->connection = $connection;
|
||||
|
|
|
@ -40,29 +40,12 @@ use Symfony\Component\Console\Output\OutputInterface;
|
|||
use Symfony\Component\Console\Question\ConfirmationQuestion;
|
||||
|
||||
class ChangeKeyStorageRoot extends Command {
|
||||
protected View $rootView;
|
||||
protected IUserManager $userManager;
|
||||
protected IConfig $config;
|
||||
protected Util $util;
|
||||
protected QuestionHelper $questionHelper;
|
||||
|
||||
/** @var View */
|
||||
protected $rootView;
|
||||
|
||||
/** @var IUserManager */
|
||||
protected $userManager;
|
||||
|
||||
/** @var IConfig */
|
||||
protected $config;
|
||||
|
||||
/** @var Util */
|
||||
protected $util;
|
||||
|
||||
/** @var QuestionHelper */
|
||||
protected $questionHelper;
|
||||
|
||||
/**
|
||||
* @param View $view
|
||||
* @param IUserManager $userManager
|
||||
* @param IConfig $config
|
||||
* @param Util $util
|
||||
* @param QuestionHelper $questionHelper
|
||||
*/
|
||||
public function __construct(View $view, IUserManager $userManager, IConfig $config, Util $util, QuestionHelper $questionHelper) {
|
||||
parent::__construct();
|
||||
$this->rootView = $view;
|
||||
|
|
|
@ -41,35 +41,14 @@ use Symfony\Component\Console\Output\OutputInterface;
|
|||
use Symfony\Component\Console\Question\ConfirmationQuestion;
|
||||
|
||||
class DecryptAll extends Command {
|
||||
protected IManager $encryptionManager;
|
||||
protected IAppManager $appManager;
|
||||
protected IConfig $config;
|
||||
protected QuestionHelper $questionHelper;
|
||||
protected bool $wasTrashbinEnabled;
|
||||
protected bool $wasMaintenanceModeEnabled;
|
||||
protected \OC\Encryption\DecryptAll $decryptAll;
|
||||
|
||||
/** @var IManager */
|
||||
protected $encryptionManager;
|
||||
|
||||
/** @var IAppManager */
|
||||
protected $appManager;
|
||||
|
||||
/** @var IConfig */
|
||||
protected $config;
|
||||
|
||||
/** @var QuestionHelper */
|
||||
protected $questionHelper;
|
||||
|
||||
/** @var bool */
|
||||
protected $wasTrashbinEnabled;
|
||||
|
||||
/** @var bool */
|
||||
protected $wasMaintenanceModeEnabled;
|
||||
|
||||
/** @var \OC\Encryption\DecryptAll */
|
||||
protected $decryptAll;
|
||||
|
||||
/**
|
||||
* @param IManager $encryptionManager
|
||||
* @param IAppManager $appManager
|
||||
* @param IConfig $config
|
||||
* @param \OC\Encryption\DecryptAll $decryptAll
|
||||
* @param QuestionHelper $questionHelper
|
||||
*/
|
||||
public function __construct(
|
||||
IManager $encryptionManager,
|
||||
IAppManager $appManager,
|
||||
|
@ -89,7 +68,7 @@ class DecryptAll extends Command {
|
|||
/**
|
||||
* Set maintenance mode and disable the trashbin app
|
||||
*/
|
||||
protected function forceMaintenanceAndTrashbin() {
|
||||
protected function forceMaintenanceAndTrashbin(): void {
|
||||
$this->wasTrashbinEnabled = $this->appManager->isEnabledForUser('files_trashbin');
|
||||
$this->wasMaintenanceModeEnabled = $this->config->getSystemValueBool('maintenance');
|
||||
$this->config->setSystemValue('maintenance', true);
|
||||
|
@ -99,7 +78,7 @@ class DecryptAll extends Command {
|
|||
/**
|
||||
* Reset the maintenance mode and re-enable the trashbin app
|
||||
*/
|
||||
protected function resetMaintenanceAndTrashbin() {
|
||||
protected function resetMaintenanceAndTrashbin(): void {
|
||||
$this->config->setSystemValue('maintenance', $this->wasMaintenanceModeEnabled);
|
||||
if ($this->wasTrashbinEnabled) {
|
||||
$this->appManager->enableApp('files_trashbin');
|
||||
|
@ -181,13 +160,12 @@ class DecryptAll extends Command {
|
|||
}
|
||||
$this->resetMaintenanceAndTrashbin();
|
||||
return 0;
|
||||
} else {
|
||||
$output->write('Enable server side encryption... ');
|
||||
$this->config->setAppValue('core', 'encryption_enabled', 'yes');
|
||||
$output->writeln('done.');
|
||||
$output->writeln('aborted');
|
||||
return 1;
|
||||
}
|
||||
$output->write('Enable server side encryption... ');
|
||||
$this->config->setAppValue('core', 'encryption_enabled', 'yes');
|
||||
$output->writeln('done.');
|
||||
$output->writeln('aborted');
|
||||
return 1;
|
||||
} catch (\Exception $e) {
|
||||
// enable server side encryption again if something went wrong
|
||||
$this->config->setAppValue('core', 'encryption_enabled', 'yes');
|
||||
|
|
|
@ -27,12 +27,8 @@ use Symfony\Component\Console\Input\InputInterface;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class Disable extends Command {
|
||||
/** @var IConfig */
|
||||
protected $config;
|
||||
protected IConfig $config;
|
||||
|
||||
/**
|
||||
* @param IConfig $config
|
||||
*/
|
||||
public function __construct(IConfig $config) {
|
||||
parent::__construct();
|
||||
$this->config = $config;
|
||||
|
|
|
@ -29,16 +29,9 @@ use Symfony\Component\Console\Input\InputInterface;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class Enable extends Command {
|
||||
/** @var IConfig */
|
||||
protected $config;
|
||||
protected IConfig $config;
|
||||
protected IManager $encryptionManager;
|
||||
|
||||
/** @var IManager */
|
||||
protected $encryptionManager;
|
||||
|
||||
/**
|
||||
* @param IConfig $config
|
||||
* @param IManager $encryptionManager
|
||||
*/
|
||||
public function __construct(IConfig $config, IManager $encryptionManager) {
|
||||
parent::__construct();
|
||||
|
||||
|
|
|
@ -36,31 +36,13 @@ use Symfony\Component\Console\Output\OutputInterface;
|
|||
use Symfony\Component\Console\Question\ConfirmationQuestion;
|
||||
|
||||
class EncryptAll extends Command {
|
||||
protected IManager $encryptionManager;
|
||||
protected IAppManager $appManager;
|
||||
protected IConfig $config;
|
||||
protected QuestionHelper $questionHelper;
|
||||
protected bool $wasTrashbinEnabled = false;
|
||||
protected bool $wasMaintenanceModeEnabled;
|
||||
|
||||
/** @var IManager */
|
||||
protected $encryptionManager;
|
||||
|
||||
/** @var IAppManager */
|
||||
protected $appManager;
|
||||
|
||||
/** @var IConfig */
|
||||
protected $config;
|
||||
|
||||
/** @var QuestionHelper */
|
||||
protected $questionHelper;
|
||||
|
||||
/** @var bool */
|
||||
protected $wasTrashbinEnabled;
|
||||
|
||||
/** @var bool */
|
||||
protected $wasMaintenanceModeEnabled;
|
||||
|
||||
/**
|
||||
* @param IManager $encryptionManager
|
||||
* @param IAppManager $appManager
|
||||
* @param IConfig $config
|
||||
* @param QuestionHelper $questionHelper
|
||||
*/
|
||||
public function __construct(
|
||||
IManager $encryptionManager,
|
||||
IAppManager $appManager,
|
||||
|
@ -77,8 +59,8 @@ class EncryptAll extends Command {
|
|||
/**
|
||||
* Set maintenance mode and disable the trashbin app
|
||||
*/
|
||||
protected function forceMaintenanceAndTrashbin() {
|
||||
$this->wasTrashbinEnabled = $this->appManager->isEnabledForUser('files_trashbin');
|
||||
protected function forceMaintenanceAndTrashbin(): void {
|
||||
$this->wasTrashbinEnabled = (bool)$this->appManager->isEnabledForUser('files_trashbin');
|
||||
$this->wasMaintenanceModeEnabled = $this->config->getSystemValueBool('maintenance');
|
||||
$this->config->setSystemValue('maintenance', true);
|
||||
$this->appManager->disableApp('files_trashbin');
|
||||
|
@ -87,7 +69,7 @@ class EncryptAll extends Command {
|
|||
/**
|
||||
* Reset the maintenance mode and re-enable the trashbin app
|
||||
*/
|
||||
protected function resetMaintenanceAndTrashbin() {
|
||||
protected function resetMaintenanceAndTrashbin(): void {
|
||||
$this->config->setSystemValue('maintenance', $this->wasMaintenanceModeEnabled);
|
||||
if ($this->wasTrashbinEnabled) {
|
||||
$this->appManager->enableApp('files_trashbin');
|
||||
|
@ -138,10 +120,9 @@ class EncryptAll extends Command {
|
|||
}
|
||||
|
||||
$this->resetMaintenanceAndTrashbin();
|
||||
} else {
|
||||
$output->writeln('aborted');
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
$output->writeln('aborted');
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,16 +30,9 @@ use Symfony\Component\Console\Input\InputInterface;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class ListModules extends Base {
|
||||
/** @var IManager */
|
||||
protected $encryptionManager;
|
||||
protected IManager $encryptionManager;
|
||||
protected IConfig $config;
|
||||
|
||||
/** @var IConfig */
|
||||
protected $config;
|
||||
|
||||
/**
|
||||
* @param IManager $encryptionManager
|
||||
* @param IConfig $config
|
||||
*/
|
||||
public function __construct(
|
||||
IManager $encryptionManager,
|
||||
IConfig $config
|
||||
|
|
|
@ -38,25 +38,12 @@ use Symfony\Component\Console\Input\InputInterface;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class MigrateKeyStorage extends Command {
|
||||
|
||||
/** @var View */
|
||||
protected $rootView;
|
||||
|
||||
/** @var IUserManager */
|
||||
protected $userManager;
|
||||
|
||||
/** @var IConfig */
|
||||
protected $config;
|
||||
|
||||
/** @var Util */
|
||||
protected $util;
|
||||
|
||||
/** @var QuestionHelper */
|
||||
protected $questionHelper;
|
||||
/**
|
||||
* @var ICrypto
|
||||
*/
|
||||
private $crypto;
|
||||
protected View $rootView;
|
||||
protected IUserManager $userManager;
|
||||
protected IConfig $config;
|
||||
protected Util $util;
|
||||
protected QuestionHelper $questionHelper;
|
||||
private ICrypto $crypto;
|
||||
|
||||
public function __construct(View $view, IUserManager $userManager, IConfig $config, Util $util, ICrypto $crypto) {
|
||||
parent::__construct();
|
||||
|
@ -85,14 +72,14 @@ class MigrateKeyStorage extends Command {
|
|||
}
|
||||
|
||||
/**
|
||||
* move keys to new key storage root
|
||||
* Move keys to new key storage root
|
||||
*
|
||||
* @param string $root
|
||||
* @param OutputInterface $output
|
||||
* @return bool
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function updateKeys(string $root, OutputInterface $output) {
|
||||
protected function updateKeys(string $root, OutputInterface $output): bool {
|
||||
$output->writeln("Start to update the keys:");
|
||||
|
||||
$this->updateSystemKeys($root);
|
||||
|
@ -102,11 +89,9 @@ class MigrateKeyStorage extends Command {
|
|||
}
|
||||
|
||||
/**
|
||||
* move system key folder
|
||||
*
|
||||
* @param string $root
|
||||
* Move system key folder
|
||||
*/
|
||||
protected function updateSystemKeys($root) {
|
||||
protected function updateSystemKeys(string $root): void {
|
||||
if (!$this->rootView->is_dir($root . '/files_encryption')) {
|
||||
return;
|
||||
}
|
||||
|
@ -119,40 +104,31 @@ class MigrateKeyStorage extends Command {
|
|||
|
||||
foreach ($listing as $node) {
|
||||
if ($node['mimetype'] === 'httpd/unix-directory') {
|
||||
//ignore
|
||||
} else {
|
||||
$endsWith = function ($haystack, $needle) {
|
||||
$length = strlen($needle);
|
||||
if ($length === 0) {
|
||||
return true;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
return (substr($haystack, -$length) === $needle);
|
||||
};
|
||||
if ($node['name'] === 'fileKey' ||
|
||||
str_ends_with($node['name'], '.privateKey') ||
|
||||
str_ends_with($node['name'], '.publicKey') ||
|
||||
str_ends_with($node['name'], '.shareKey')) {
|
||||
$path = $folder . '/' . $node['name'];
|
||||
|
||||
if ($node['name'] === 'fileKey' ||
|
||||
$endsWith($node['name'], '.privateKey') ||
|
||||
$endsWith($node['name'], '.publicKey') ||
|
||||
$endsWith($node['name'], '.shareKey')) {
|
||||
$path = $folder . '/' . $node['name'];
|
||||
$content = $this->rootView->file_get_contents($path);
|
||||
|
||||
$content = $this->rootView->file_get_contents($path);
|
||||
|
||||
try {
|
||||
$this->crypto->decrypt($content);
|
||||
continue;
|
||||
} catch (\Exception $e) {
|
||||
// Ignore we now update the data.
|
||||
}
|
||||
|
||||
$data = [
|
||||
'key' => base64_encode($content),
|
||||
'uid' => $uid,
|
||||
];
|
||||
|
||||
$enc = $this->crypto->encrypt(json_encode($data));
|
||||
$this->rootView->file_put_contents($path, $enc);
|
||||
try {
|
||||
$this->crypto->decrypt($content);
|
||||
continue;
|
||||
} catch (\Exception $e) {
|
||||
// Ignore we now update the data.
|
||||
}
|
||||
|
||||
$data = [
|
||||
'key' => base64_encode($content),
|
||||
'uid' => $uid,
|
||||
];
|
||||
|
||||
$enc = $this->crypto->encrypt(json_encode($data));
|
||||
$this->rootView->file_put_contents($path, $enc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,16 +31,9 @@ use Symfony\Component\Console\Input\InputInterface;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class SetDefaultModule extends Command {
|
||||
/** @var IManager */
|
||||
protected $encryptionManager;
|
||||
protected IManager $encryptionManager;
|
||||
protected IConfig $config;
|
||||
|
||||
/** @var IConfig */
|
||||
protected $config;
|
||||
|
||||
/**
|
||||
* @param IManager $encryptionManager
|
||||
* @param IConfig $config
|
||||
*/
|
||||
public function __construct(
|
||||
IManager $encryptionManager,
|
||||
IConfig $config
|
||||
|
|
|
@ -29,13 +29,8 @@ use Symfony\Component\Console\Input\InputInterface;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class ShowKeyStorageRoot extends Command {
|
||||
protected Util $util;
|
||||
|
||||
/** @var Util */
|
||||
protected $util;
|
||||
|
||||
/**
|
||||
* @param Util $util
|
||||
*/
|
||||
public function __construct(Util $util) {
|
||||
parent::__construct();
|
||||
$this->util = $util;
|
||||
|
|
|
@ -27,12 +27,8 @@ use Symfony\Component\Console\Input\InputInterface;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class Status extends Base {
|
||||
/** @var IManager */
|
||||
protected $encryptionManager;
|
||||
protected IManager $encryptionManager;
|
||||
|
||||
/**
|
||||
* @param IManager $encryptionManager
|
||||
*/
|
||||
public function __construct(IManager $encryptionManager) {
|
||||
parent::__construct();
|
||||
$this->encryptionManager = $encryptionManager;
|
||||
|
|
|
@ -36,12 +36,8 @@ use Symfony\Component\Console\Input\InputOption;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class Add extends Base {
|
||||
/** @var IGroupManager */
|
||||
protected $groupManager;
|
||||
protected IGroupManager $groupManager;
|
||||
|
||||
/**
|
||||
* @param IGroupManager $groupManager
|
||||
*/
|
||||
public function __construct(IGroupManager $groupManager) {
|
||||
$this->groupManager = $groupManager;
|
||||
parent::__construct();
|
||||
|
|
|
@ -34,15 +34,9 @@ use Symfony\Component\Console\Input\InputInterface;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class AddUser extends Base {
|
||||
/** @var IUserManager */
|
||||
protected $userManager;
|
||||
/** @var IGroupManager */
|
||||
protected $groupManager;
|
||||
protected IUserManager $userManager;
|
||||
protected IGroupManager $groupManager;
|
||||
|
||||
/**
|
||||
* @param IUserManager $userManager
|
||||
* @param IGroupManager $groupManager
|
||||
*/
|
||||
public function __construct(IUserManager $userManager, IGroupManager $groupManager) {
|
||||
$this->userManager = $userManager;
|
||||
$this->groupManager = $groupManager;
|
||||
|
|
|
@ -35,12 +35,8 @@ use Symfony\Component\Console\Input\InputInterface;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class Delete extends Base {
|
||||
/** @var IGroupManager */
|
||||
protected $groupManager;
|
||||
protected IGroupManager $groupManager;
|
||||
|
||||
/**
|
||||
* @param IGroupManager $groupManager
|
||||
*/
|
||||
public function __construct(IGroupManager $groupManager) {
|
||||
$this->groupManager = $groupManager;
|
||||
parent::__construct();
|
||||
|
|
|
@ -35,12 +35,8 @@ use Symfony\Component\Console\Input\InputOption;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class Info extends Base {
|
||||
/** @var IGroupManager */
|
||||
protected $groupManager;
|
||||
protected IGroupManager $groupManager;
|
||||
|
||||
/**
|
||||
* @param IGroupManager $groupManager
|
||||
*/
|
||||
public function __construct(IGroupManager $groupManager) {
|
||||
$this->groupManager = $groupManager;
|
||||
parent::__construct();
|
||||
|
|
|
@ -32,12 +32,8 @@ use Symfony\Component\Console\Input\InputOption;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class ListCommand extends Base {
|
||||
/** @var IGroupManager */
|
||||
protected $groupManager;
|
||||
protected IGroupManager $groupManager;
|
||||
|
||||
/**
|
||||
* @param IGroupManager $groupManager
|
||||
*/
|
||||
public function __construct(IGroupManager $groupManager) {
|
||||
$this->groupManager = $groupManager;
|
||||
parent::__construct();
|
||||
|
|
|
@ -34,15 +34,9 @@ use Symfony\Component\Console\Input\InputInterface;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class RemoveUser extends Base {
|
||||
/** @var IUserManager */
|
||||
protected $userManager;
|
||||
/** @var IGroupManager */
|
||||
protected $groupManager;
|
||||
protected IUserManager $userManager;
|
||||
protected IGroupManager $groupManager;
|
||||
|
||||
/**
|
||||
* @param IUserManager $userManager
|
||||
* @param IGroupManager $groupManager
|
||||
*/
|
||||
public function __construct(IUserManager $userManager, IGroupManager $groupManager) {
|
||||
$this->userManager = $userManager;
|
||||
$this->groupManager = $groupManager;
|
||||
|
|
|
@ -40,11 +40,7 @@ use Symfony\Component\Console\Output\OutputInterface;
|
|||
* @package OC\Core\Command\Integrity
|
||||
*/
|
||||
class CheckApp extends Base {
|
||||
|
||||
/**
|
||||
* @var Checker
|
||||
*/
|
||||
private $checker;
|
||||
private Checker $checker;
|
||||
|
||||
public function __construct(Checker $checker) {
|
||||
parent::__construct();
|
||||
|
|
|
@ -36,10 +36,7 @@ use Symfony\Component\Console\Output\OutputInterface;
|
|||
* @package OC\Core\Command\Integrity
|
||||
*/
|
||||
class CheckCore extends Base {
|
||||
/**
|
||||
* @var Checker
|
||||
*/
|
||||
private $checker;
|
||||
private Checker $checker;
|
||||
|
||||
public function __construct(Checker $checker) {
|
||||
parent::__construct();
|
||||
|
|
|
@ -40,18 +40,10 @@ use Symfony\Component\Console\Output\OutputInterface;
|
|||
* @package OC\Core\Command\Integrity
|
||||
*/
|
||||
class SignApp extends Command {
|
||||
/** @var Checker */
|
||||
private $checker;
|
||||
/** @var FileAccessHelper */
|
||||
private $fileAccessHelper;
|
||||
/** @var IURLGenerator */
|
||||
private $urlGenerator;
|
||||
private Checker $checker;
|
||||
private FileAccessHelper $fileAccessHelper;
|
||||
private IURLGenerator $urlGenerator;
|
||||
|
||||
/**
|
||||
* @param Checker $checker
|
||||
* @param FileAccessHelper $fileAccessHelper
|
||||
* @param IURLGenerator $urlGenerator
|
||||
*/
|
||||
public function __construct(Checker $checker,
|
||||
FileAccessHelper $fileAccessHelper,
|
||||
IURLGenerator $urlGenerator) {
|
||||
|
|
|
@ -39,15 +39,9 @@ use Symfony\Component\Console\Output\OutputInterface;
|
|||
* @package OC\Core\Command\Integrity
|
||||
*/
|
||||
class SignCore extends Command {
|
||||
/** @var Checker */
|
||||
private $checker;
|
||||
/** @var FileAccessHelper */
|
||||
private $fileAccessHelper;
|
||||
private Checker $checker;
|
||||
private FileAccessHelper $fileAccessHelper;
|
||||
|
||||
/**
|
||||
* @param Checker $checker
|
||||
* @param FileAccessHelper $fileAccessHelper
|
||||
*/
|
||||
public function __construct(Checker $checker,
|
||||
FileAccessHelper $fileAccessHelper) {
|
||||
parent::__construct(null);
|
||||
|
|
|
@ -36,9 +36,7 @@ use Symfony\Component\Console\Input\InputOption;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class File extends Command implements Completion\CompletionAwareInterface {
|
||||
|
||||
/** @var IConfig */
|
||||
protected $config;
|
||||
protected IConfig $config;
|
||||
|
||||
public function __construct(IConfig $config) {
|
||||
$this->config = $config;
|
||||
|
|
|
@ -39,8 +39,7 @@ class Manage extends Command implements CompletionAwareInterface {
|
|||
public const DEFAULT_LOG_LEVEL = 2;
|
||||
public const DEFAULT_TIMEZONE = 'UTC';
|
||||
|
||||
/** @var IConfig */
|
||||
protected $config;
|
||||
protected IConfig $config;
|
||||
|
||||
public function __construct(IConfig $config) {
|
||||
$this->config = $config;
|
||||
|
|
|
@ -29,11 +29,8 @@ use Symfony\Component\Console\Input\InputInterface;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class DataFingerprint extends Command {
|
||||
|
||||
/** @var IConfig */
|
||||
protected $config;
|
||||
/** @var ITimeFactory */
|
||||
protected $timeFactory;
|
||||
protected IConfig $config;
|
||||
protected ITimeFactory $timeFactory;
|
||||
|
||||
public function __construct(IConfig $config,
|
||||
ITimeFactory $timeFactory) {
|
||||
|
|
|
@ -47,11 +47,8 @@ use Throwable;
|
|||
use function get_class;
|
||||
|
||||
class Install extends Command {
|
||||
|
||||
/** @var SystemConfig */
|
||||
private $config;
|
||||
/** @var IniGetWrapper */
|
||||
private $iniGetWrapper;
|
||||
private SystemConfig $config;
|
||||
private IniGetWrapper $iniGetWrapper;
|
||||
|
||||
public function __construct(SystemConfig $config, IniGetWrapper $iniGetWrapper) {
|
||||
parent::__construct();
|
||||
|
|
|
@ -35,11 +35,8 @@ use Symfony\Component\Console\Output\OutputInterface;
|
|||
class UpdateDB extends Command {
|
||||
public const DEFAULT_MIMETYPE = 'application/octet-stream';
|
||||
|
||||
/** @var IMimeTypeDetector */
|
||||
protected $mimetypeDetector;
|
||||
|
||||
/** @var IMimeTypeLoader */
|
||||
protected $mimetypeLoader;
|
||||
protected IMimeTypeDetector $mimetypeDetector;
|
||||
protected IMimeTypeLoader $mimetypeLoader;
|
||||
|
||||
public function __construct(
|
||||
IMimeTypeDetector $mimetypeDetector,
|
||||
|
|
|
@ -31,9 +31,7 @@ use Symfony\Component\Console\Input\InputInterface;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class UpdateJS extends Command {
|
||||
|
||||
/** @var IMimeTypeDetector */
|
||||
protected $mimetypeDetector;
|
||||
protected IMimeTypeDetector $mimetypeDetector;
|
||||
|
||||
public function __construct(
|
||||
IMimeTypeDetector $mimetypeDetector
|
||||
|
|
|
@ -33,9 +33,7 @@ use Symfony\Component\Console\Input\InputOption;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class Mode extends Command {
|
||||
|
||||
/** @var IConfig */
|
||||
protected $config;
|
||||
protected IConfig $config;
|
||||
|
||||
public function __construct(IConfig $config) {
|
||||
$this->config = $config;
|
||||
|
|
|
@ -40,25 +40,13 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
|||
use Symfony\Component\EventDispatcher\GenericEvent;
|
||||
|
||||
class Repair extends Command {
|
||||
/** @var \OC\Repair $repair */
|
||||
protected $repair;
|
||||
/** @var IConfig */
|
||||
protected $config;
|
||||
/** @var EventDispatcherInterface */
|
||||
private $dispatcher;
|
||||
/** @var ProgressBar */
|
||||
private $progress;
|
||||
/** @var OutputInterface */
|
||||
private $output;
|
||||
/** @var IAppManager */
|
||||
private $appManager;
|
||||
protected \OC\Repair $repair;
|
||||
protected IConfig $config;
|
||||
private EventDispatcherInterface $dispatcher;
|
||||
private ProgressBar $progress;
|
||||
private OutputInterface $output;
|
||||
private IAppManager $appManager;
|
||||
|
||||
/**
|
||||
* @param \OC\Repair $repair
|
||||
* @param IConfig $config
|
||||
* @param EventDispatcherInterface $dispatcher
|
||||
* @param IAppManager $appManager
|
||||
*/
|
||||
public function __construct(\OC\Repair $repair, IConfig $config, EventDispatcherInterface $dispatcher, IAppManager $appManager) {
|
||||
$this->repair = $repair;
|
||||
$this->config = $config;
|
||||
|
|
|
@ -33,12 +33,8 @@ use Symfony\Component\Console\Input\InputInterface;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class UpdateTheme extends UpdateJS {
|
||||
|
||||
/** @var IMimeTypeDetector */
|
||||
protected $mimetypeDetector;
|
||||
|
||||
/** @var ICacheFactory */
|
||||
protected $cacheFactory;
|
||||
protected IMimeTypeDetector $mimetypeDetector;
|
||||
protected ICacheFactory $cacheFactory;
|
||||
|
||||
public function __construct(
|
||||
IMimeTypeDetector $mimetypeDetector,
|
||||
|
|
|
@ -32,9 +32,9 @@ use OCP\Files\Folder;
|
|||
use OCP\Files\IRootFolder;
|
||||
use OCP\Files\NotFoundException;
|
||||
use OCP\IConfig;
|
||||
use OCP\ILogger;
|
||||
use OCP\Lock\ILockingProvider;
|
||||
use OCP\Lock\LockedException;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Helper\ProgressBar;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
|
@ -43,29 +43,21 @@ use Symfony\Component\Console\Output\OutputInterface;
|
|||
use Symfony\Component\Console\Question\ConfirmationQuestion;
|
||||
|
||||
class Repair extends Command {
|
||||
/** @var IConfig */
|
||||
protected $config;
|
||||
/** @var IRootFolder */
|
||||
private $rootFolder;
|
||||
/** @var ILogger */
|
||||
private $logger;
|
||||
protected IConfig $config;
|
||||
private IRootFolder $rootFolder;
|
||||
private LoggerInterface $logger;
|
||||
private bool $stopSignalReceived = false;
|
||||
private int $memoryLimit;
|
||||
private int $memoryTreshold;
|
||||
private ILockingProvider $lockingProvider;
|
||||
|
||||
/** @var bool */
|
||||
private $stopSignalReceived = false;
|
||||
/** @var int */
|
||||
private $memoryLimit;
|
||||
/** @var int */
|
||||
private $memoryTreshold;
|
||||
/** @var ILockingProvider */
|
||||
private $lockingProvider;
|
||||
|
||||
public function __construct(IConfig $config, IRootFolder $rootFolder, ILogger $logger, IniGetWrapper $phpIni, ILockingProvider $lockingProvider) {
|
||||
public function __construct(IConfig $config, IRootFolder $rootFolder, LoggerInterface $logger, IniGetWrapper $phpIni, ILockingProvider $lockingProvider) {
|
||||
$this->config = $config;
|
||||
$this->rootFolder = $rootFolder;
|
||||
$this->logger = $logger;
|
||||
$this->lockingProvider = $lockingProvider;
|
||||
|
||||
$this->memoryLimit = $phpIni->getBytes('memory_limit');
|
||||
$this->memoryLimit = (int)$phpIni->getBytes('memory_limit');
|
||||
$this->memoryTreshold = $this->memoryLimit - 25 * 1024 * 1024;
|
||||
|
||||
parent::__construct();
|
||||
|
@ -265,27 +257,36 @@ class Repair extends Command {
|
|||
$section1->writeln(" Delete preview/$name/$previewName", OutputInterface::VERBOSITY_VERBOSE);
|
||||
$preview->delete();
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->logException($e, ['app' => 'core', 'message' => "Failed to delete preview at preview/$name/$previewName"]);
|
||||
$this->logger->error("Failed to delete preview at preview/$name/$previewName", [
|
||||
'app' => 'core',
|
||||
'exception' => $e,
|
||||
]);
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
$section1->writeln(" Move preview/$name/$previewName to preview/$newFoldername", OutputInterface::VERBOSITY_VERBOSE);
|
||||
$preview->move("appdata_$instanceId/preview/$newFoldername/$previewName");
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->logException($e, ['app' => 'core', 'message' => "Failed to move preview from preview/$name/$previewName to preview/$newFoldername"]);
|
||||
$this->logger->error("Failed to move preview from preview/$name/$previewName to preview/$newFoldername", [
|
||||
'app' => 'core',
|
||||
'exception' => $e,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($oldPreviewFolder->getDirectoryListing() === []) {
|
||||
$section1->writeln(" Delete empty folder preview/$name", OutputInterface::VERBOSITY_VERBOSE);
|
||||
if (!$dryMode) {
|
||||
try {
|
||||
$oldPreviewFolder->delete();
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->logException($e, ['app' => 'core', 'message' => "Failed to delete empty folder preview/$name"]);
|
||||
$this->logger->error("Failed to delete empty folder preview/$name", [
|
||||
'app' => 'core',
|
||||
'exception' => $e,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,21 +39,11 @@ use Symfony\Component\Console\Input\InputOption;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class ResetRenderedTexts extends Command {
|
||||
|
||||
/** @var IDBConnection */
|
||||
protected $connection;
|
||||
|
||||
/** @var IUserManager */
|
||||
protected $userManager;
|
||||
|
||||
/** @var IAvatarManager */
|
||||
protected $avatarManager;
|
||||
|
||||
/** @var Root */
|
||||
private $previewFolder;
|
||||
|
||||
/** @var IMimeTypeLoader */
|
||||
private $mimeTypeLoader;
|
||||
protected IDBConnection $connection;
|
||||
protected IUserManager $userManager;
|
||||
protected IAvatarManager $avatarManager;
|
||||
private Root $previewFolder;
|
||||
private IMimeTypeLoader $mimeTypeLoader;
|
||||
|
||||
public function __construct(IDBConnection $connection,
|
||||
IUserManager $userManager,
|
||||
|
|
|
@ -30,9 +30,7 @@ use Symfony\Component\Console\Input\InputInterface;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class ImportCertificate extends Base {
|
||||
|
||||
/** @var ICertificateManager */
|
||||
protected $certificateManager;
|
||||
protected ICertificateManager $certificateManager;
|
||||
|
||||
public function __construct(ICertificateManager $certificateManager) {
|
||||
$this->certificateManager = $certificateManager;
|
||||
|
|
|
@ -31,11 +31,8 @@ use Symfony\Component\Console\Input\InputInterface;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class ListCertificates extends Base {
|
||||
|
||||
/** @var ICertificateManager */
|
||||
protected $certificateManager;
|
||||
/** @var IL10N */
|
||||
protected $l;
|
||||
protected ICertificateManager $certificateManager;
|
||||
protected IL10N $l;
|
||||
|
||||
public function __construct(ICertificateManager $certificateManager, IL10N $l) {
|
||||
$this->certificateManager = $certificateManager;
|
||||
|
|
|
@ -30,9 +30,7 @@ use Symfony\Component\Console\Input\InputInterface;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class RemoveCertificate extends Base {
|
||||
|
||||
/** @var ICertificateManager */
|
||||
protected $certificateManager;
|
||||
protected ICertificateManager $certificateManager;
|
||||
|
||||
public function __construct(ICertificateManager $certificateManager) {
|
||||
$this->certificateManager = $certificateManager;
|
||||
|
|
|
@ -30,9 +30,7 @@ use Symfony\Component\Console\Input\InputInterface;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class ResetBruteforceAttempts extends Base {
|
||||
|
||||
/** @var Throttler */
|
||||
protected $throttler;
|
||||
protected Throttler $throttler;
|
||||
|
||||
public function __construct(Throttler $throttler) {
|
||||
$this->throttler = $throttler;
|
||||
|
|
|
@ -32,11 +32,8 @@ use Symfony\Component\Console\Input\InputInterface;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class Status extends Base {
|
||||
|
||||
/** @var IConfig */
|
||||
private $config;
|
||||
/** @var Defaults */
|
||||
private $themingDefaults;
|
||||
private IConfig $config;
|
||||
private Defaults $themingDefaults;
|
||||
|
||||
public function __construct(IConfig $config, Defaults $themingDefaults) {
|
||||
parent::__construct('status');
|
||||
|
|
|
@ -31,9 +31,7 @@ use Symfony\Component\Console\Input\InputInterface;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class Add extends Base {
|
||||
|
||||
/** @var ISystemTagManager */
|
||||
protected $systemTagManager;
|
||||
protected ISystemTagManager $systemTagManager;
|
||||
|
||||
public function __construct(ISystemTagManager $systemTagManager) {
|
||||
$this->systemTagManager = $systemTagManager;
|
||||
|
|
|
@ -30,9 +30,7 @@ use Symfony\Component\Console\Input\InputOption;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class Delete extends Base {
|
||||
|
||||
/** @var ISystemTagManager */
|
||||
protected $systemTagManager;
|
||||
protected ISystemTagManager $systemTagManager;
|
||||
|
||||
public function __construct(ISystemTagManager $systemTagManager) {
|
||||
$this->systemTagManager = $systemTagManager;
|
||||
|
|
|
@ -31,13 +31,8 @@ use Symfony\Component\Console\Input\InputOption;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class Edit extends Base {
|
||||
protected ISystemTagManager $systemTagManager;
|
||||
|
||||
/** @var ISystemTagManager */
|
||||
protected $systemTagManager;
|
||||
|
||||
/**
|
||||
* @param ISystemTagManager $systemTagManager
|
||||
*/
|
||||
public function __construct(ISystemTagManager $systemTagManager) {
|
||||
$this->systemTagManager = $systemTagManager;
|
||||
parent::__construct();
|
||||
|
|
|
@ -30,9 +30,7 @@ use Symfony\Component\Console\Input\InputOption;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class ListCommand extends Base {
|
||||
|
||||
/** @var ISystemTagManager */
|
||||
protected $systemTagManager;
|
||||
protected ISystemTagManager $systemTagManager;
|
||||
|
||||
public function __construct(ISystemTagManager $systemTagManager) {
|
||||
$this->systemTagManager = $systemTagManager;
|
||||
|
|
|
@ -30,9 +30,7 @@ use OCP\IUserManager;
|
|||
use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext;
|
||||
|
||||
class Base extends \OC\Core\Command\Base {
|
||||
|
||||
/** @var IUserManager */
|
||||
protected $userManager;
|
||||
protected IUserManager $userManager;
|
||||
|
||||
/**
|
||||
* Return possible values for the named option
|
||||
|
|
|
@ -32,9 +32,7 @@ use Symfony\Component\Console\Input\InputInterface;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class Cleanup extends Base {
|
||||
|
||||
/** @var IRegistry */
|
||||
private $registry;
|
||||
private IRegistry $registry;
|
||||
|
||||
public function __construct(IRegistry $registry) {
|
||||
parent::__construct();
|
||||
|
|
|
@ -29,12 +29,7 @@ use Symfony\Component\Console\Input\InputInterface;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class Disable extends Base {
|
||||
|
||||
/** @var ProviderManager */
|
||||
private $manager;
|
||||
|
||||
/** @var IUserManager */
|
||||
protected $userManager;
|
||||
private ProviderManager $manager;
|
||||
|
||||
public function __construct(ProviderManager $manager, IUserManager $userManager) {
|
||||
parent::__construct('twofactorauth:disable');
|
||||
|
|
|
@ -29,12 +29,7 @@ use Symfony\Component\Console\Input\InputInterface;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class Enable extends Base {
|
||||
|
||||
/** @var ProviderManager */
|
||||
private $manager;
|
||||
|
||||
/** @var IUserManager */
|
||||
protected $userManager;
|
||||
private ProviderManager $manager;
|
||||
|
||||
public function __construct(ProviderManager $manager, IUserManager $userManager) {
|
||||
parent::__construct('twofactorauth:enable');
|
||||
|
|
|
@ -35,9 +35,7 @@ use Symfony\Component\Console\Input\InputOption;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class Enforce extends Command {
|
||||
|
||||
/** @var MandatoryTwoFactor */
|
||||
private $mandatoryTwoFactor;
|
||||
private MandatoryTwoFactor $mandatoryTwoFactor;
|
||||
|
||||
public function __construct(MandatoryTwoFactor $mandatoryTwoFactor) {
|
||||
parent::__construct();
|
||||
|
@ -92,9 +90,6 @@ class Enforce extends Command {
|
|||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param OutputInterface $output
|
||||
*/
|
||||
protected function writeEnforced(OutputInterface $output, EnforcementState $state) {
|
||||
if (empty($state->getEnforcedGroups())) {
|
||||
$message = 'Two-factor authentication is enforced for all users';
|
||||
|
@ -107,9 +102,6 @@ class Enforce extends Command {
|
|||
$output->writeln($message);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param OutputInterface $output
|
||||
*/
|
||||
protected function writeNotEnforced(OutputInterface $output) {
|
||||
$output->writeln('Two-factor authentication is not enforced');
|
||||
}
|
||||
|
|
|
@ -33,9 +33,7 @@ use Symfony\Component\Console\Input\InputInterface;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class State extends Base {
|
||||
|
||||
/** @var IRegistry */
|
||||
private $registry;
|
||||
private IRegistry $registry;
|
||||
|
||||
public function __construct(IRegistry $registry, IUserManager $userManager) {
|
||||
parent::__construct('twofactorauth:state');
|
||||
|
|
|
@ -53,14 +53,9 @@ class Upgrade extends Command {
|
|||
public const ERROR_INVALID_ARGUMENTS = 4;
|
||||
public const ERROR_FAILURE = 5;
|
||||
|
||||
/** @var IConfig */
|
||||
private $config;
|
||||
|
||||
/** @var LoggerInterface */
|
||||
private $logger;
|
||||
|
||||
/** @var Installer */
|
||||
private $installer;
|
||||
private IConfig $config;
|
||||
private LoggerInterface $logger;
|
||||
private Installer $installer;
|
||||
|
||||
public function __construct(IConfig $config, LoggerInterface $logger, Installer $installer) {
|
||||
parent::__construct();
|
||||
|
|
|
@ -39,16 +39,9 @@ use Symfony\Component\Console\Output\OutputInterface;
|
|||
use Symfony\Component\Console\Question\Question;
|
||||
|
||||
class Add extends Command {
|
||||
/** @var \OCP\IUserManager */
|
||||
protected $userManager;
|
||||
protected IUserManager $userManager;
|
||||
protected IGroupManager $groupManager;
|
||||
|
||||
/** @var \OCP\IGroupManager */
|
||||
protected $groupManager;
|
||||
|
||||
/**
|
||||
* @param IUserManager $userManager
|
||||
* @param IGroupManager $groupManager
|
||||
*/
|
||||
public function __construct(IUserManager $userManager, IGroupManager $groupManager) {
|
||||
parent::__construct();
|
||||
$this->userManager = $userManager;
|
||||
|
|
|
@ -41,18 +41,10 @@ use Symfony\Component\Console\Output\OutputInterface;
|
|||
use Symfony\Component\Console\Question\Question;
|
||||
|
||||
class AddAppPassword extends Command {
|
||||
|
||||
/** @var IUserManager */
|
||||
protected $userManager;
|
||||
|
||||
/** @var IProvider */
|
||||
protected $tokenProvider;
|
||||
|
||||
/** @var ISecureRandom */
|
||||
private $random;
|
||||
|
||||
/** @var IEventDispatcher */
|
||||
private $eventDispatcher;
|
||||
protected IUserManager $userManager;
|
||||
protected IProvider $tokenProvider;
|
||||
private ISecureRandom $random;
|
||||
private IEventDispatcher $eventDispatcher;
|
||||
|
||||
public function __construct(IUserManager $userManager,
|
||||
IProvider $tokenProvider,
|
||||
|
|
|
@ -32,12 +32,8 @@ use Symfony\Component\Console\Input\InputInterface;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class Disable extends Base {
|
||||
/** @var IUserManager */
|
||||
protected $userManager;
|
||||
protected IUserManager $userManager;
|
||||
|
||||
/**
|
||||
* @param IUserManager $userManager
|
||||
*/
|
||||
public function __construct(IUserManager $userManager) {
|
||||
$this->userManager = $userManager;
|
||||
parent::__construct();
|
||||
|
|
|
@ -32,12 +32,8 @@ use Symfony\Component\Console\Input\InputInterface;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class Enable extends Base {
|
||||
/** @var IUserManager */
|
||||
protected $userManager;
|
||||
protected IUserManager $userManager;
|
||||
|
||||
/**
|
||||
* @param IUserManager $userManager
|
||||
*/
|
||||
public function __construct(IUserManager $userManager) {
|
||||
$this->userManager = $userManager;
|
||||
parent::__construct();
|
||||
|
|
|
@ -35,15 +35,9 @@ use Symfony\Component\Console\Input\InputOption;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class Info extends Base {
|
||||
/** @var IUserManager */
|
||||
protected $userManager;
|
||||
/** @var IGroupManager */
|
||||
protected $groupManager;
|
||||
protected IUserManager $userManager;
|
||||
protected IGroupManager $groupManager;
|
||||
|
||||
/**
|
||||
* @param IUserManager $userManager
|
||||
* @param IGroupManager $groupManager
|
||||
*/
|
||||
public function __construct(IUserManager $userManager, IGroupManager $groupManager) {
|
||||
$this->userManager = $userManager;
|
||||
$this->groupManager = $groupManager;
|
||||
|
|
|
@ -34,12 +34,8 @@ use Symfony\Component\Console\Input\InputInterface;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class LastSeen extends Base {
|
||||
/** @var IUserManager */
|
||||
protected $userManager;
|
||||
protected IUserManager $userManager;
|
||||
|
||||
/**
|
||||
* @param IUserManager $userManager
|
||||
*/
|
||||
public function __construct(IUserManager $userManager) {
|
||||
$this->userManager = $userManager;
|
||||
parent::__construct();
|
||||
|
|
|
@ -33,17 +33,9 @@ use Symfony\Component\Console\Input\InputOption;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class ListCommand extends Base {
|
||||
protected IUserManager $userManager;
|
||||
protected IGroupManager $groupManager;
|
||||
|
||||
/** @var IUserManager */
|
||||
protected $userManager;
|
||||
|
||||
/** @var IGroupManager */
|
||||
protected $groupManager;
|
||||
|
||||
/**
|
||||
* @param IUserManager $userManager
|
||||
* @param IGroupManager $groupManager
|
||||
*/
|
||||
public function __construct(IUserManager $userManager,
|
||||
IGroupManager $groupManager) {
|
||||
$this->userManager = $userManager;
|
||||
|
|
|
@ -41,10 +41,8 @@ use Symfony\Component\Console\Output\OutputInterface;
|
|||
class Report extends Command {
|
||||
public const DEFAULT_COUNT_DIRS_MAX_USERS = 500;
|
||||
|
||||
/** @var IUserManager */
|
||||
protected $userManager;
|
||||
/** @var IConfig */
|
||||
private $config;
|
||||
protected IUserManager $userManager;
|
||||
private IConfig $config;
|
||||
|
||||
public function __construct(IUserManager $userManager,
|
||||
IConfig $config) {
|
||||
|
|
|
@ -40,9 +40,7 @@ use Symfony\Component\Console\Question\ConfirmationQuestion;
|
|||
use Symfony\Component\Console\Question\Question;
|
||||
|
||||
class ResetPassword extends Base {
|
||||
|
||||
/** @var IUserManager */
|
||||
protected $userManager;
|
||||
protected IUserManager $userManager;
|
||||
|
||||
public function __construct(IUserManager $userManager) {
|
||||
$this->userManager = $userManager;
|
||||
|
|
|
@ -36,16 +36,9 @@ use Symfony\Component\Console\Input\InputOption;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class Setting extends Base {
|
||||
/** @var IUserManager */
|
||||
protected $userManager;
|
||||
protected IUserManager $userManager;
|
||||
protected IConfig $config;
|
||||
|
||||
/** @var IConfig */
|
||||
protected $config;
|
||||
|
||||
/**
|
||||
* @param IUserManager $userManager
|
||||
* @param IConfig $config
|
||||
*/
|
||||
public function __construct(IUserManager $userManager, IConfig $config) {
|
||||
parent::__construct();
|
||||
$this->userManager = $userManager;
|
||||
|
|
|
@ -42,21 +42,11 @@ use OCP\ISession;
|
|||
use OCP\Security\ISecureRandom;
|
||||
|
||||
class AppPasswordController extends \OCP\AppFramework\OCSController {
|
||||
|
||||
/** @var ISession */
|
||||
private $session;
|
||||
|
||||
/** @var ISecureRandom */
|
||||
private $random;
|
||||
|
||||
/** @var IProvider */
|
||||
private $tokenProvider;
|
||||
|
||||
/** @var IStore */
|
||||
private $credentialStore;
|
||||
|
||||
/** @var IEventDispatcher */
|
||||
private $eventDispatcher;
|
||||
private ISession $session;
|
||||
private ISecureRandom $random;
|
||||
private IProvider $tokenProvider;
|
||||
private IStore $credentialStore;
|
||||
private IEventDispatcher $eventDispatcher;
|
||||
|
||||
public function __construct(string $appName,
|
||||
IRequest $request,
|
||||
|
@ -77,7 +67,6 @@ class AppPasswordController extends \OCP\AppFramework\OCSController {
|
|||
/**
|
||||
* @NoAdminRequired
|
||||
*
|
||||
* @return DataResponse
|
||||
* @throws OCSForbiddenException
|
||||
*/
|
||||
public function getAppPassword(): DataResponse {
|
||||
|
@ -123,10 +112,8 @@ class AppPasswordController extends \OCP\AppFramework\OCSController {
|
|||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
*
|
||||
* @return DataResponse
|
||||
*/
|
||||
public function deleteAppPassword() {
|
||||
public function deleteAppPassword(): DataResponse {
|
||||
if (!$this->session->exists('app_password')) {
|
||||
throw new OCSForbiddenException('no app password in use');
|
||||
}
|
||||
|
|
|
@ -39,14 +39,9 @@ use OCP\IRequest;
|
|||
use OCP\Share\IShare;
|
||||
|
||||
class AutoCompleteController extends Controller {
|
||||
/** @var ISearch */
|
||||
private $collaboratorSearch;
|
||||
|
||||
/** @var IManager */
|
||||
private $autoCompleteManager;
|
||||
|
||||
/** @var IEventDispatcher */
|
||||
private $dispatcher;
|
||||
private ISearch $collaboratorSearch;
|
||||
private IManager $autoCompleteManager;
|
||||
private IEventDispatcher $dispatcher;
|
||||
|
||||
public function __construct(string $appName,
|
||||
IRequest $request,
|
||||
|
@ -62,16 +57,9 @@ class AutoCompleteController extends Controller {
|
|||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
*
|
||||
* @param string $search
|
||||
* @param string $itemType
|
||||
* @param string $itemId
|
||||
* @param string|null $sorter can be piped, top prio first, e.g.: "commenters|share-recipients"
|
||||
* @param array $shareTypes
|
||||
* @param int $limit
|
||||
* @return DataResponse
|
||||
*/
|
||||
public function get($search, $itemType, $itemId, $sorter = null, $shareTypes = [IShare::TYPE_USER], $limit = 10): DataResponse {
|
||||
public function get(string $search, ?string $itemType, ?string $itemId, ?string $sorter = null, array $shareTypes = [IShare::TYPE_USER], int $limit = 10): DataResponse {
|
||||
// if enumeration/user listings are disabled, we'll receive an empty
|
||||
// result from search() – thus nothing else to do here.
|
||||
[$results,] = $this->collaboratorSearch->search($search, $shareTypes, false, $limit, 0);
|
||||
|
@ -106,7 +94,6 @@ class AutoCompleteController extends Controller {
|
|||
return new DataResponse($results);
|
||||
}
|
||||
|
||||
|
||||
protected function prepareResultArray(array $results): array {
|
||||
$output = [];
|
||||
foreach ($results as $type => $subResult) {
|
||||
|
|
|
@ -41,10 +41,10 @@ use OCP\Files\IRootFolder;
|
|||
use OCP\IAvatarManager;
|
||||
use OCP\ICache;
|
||||
use OCP\IL10N;
|
||||
use OCP\ILogger;
|
||||
use OCP\IRequest;
|
||||
use OCP\IUserManager;
|
||||
use OCP\IUserSession;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
/**
|
||||
* Class AvatarController
|
||||
|
@ -52,43 +52,25 @@ use OCP\IUserSession;
|
|||
* @package OC\Core\Controller
|
||||
*/
|
||||
class AvatarController extends Controller {
|
||||
protected IAvatarManager $avatarManager;
|
||||
protected ICache $cache;
|
||||
protected IL10N $l;
|
||||
protected IUserManager $userManager;
|
||||
protected IUserSession $userSession;
|
||||
protected IRootFolder $rootFolder;
|
||||
protected LoggerInterface $logger;
|
||||
protected ?string $userId;
|
||||
protected TimeFactory $timeFactory;
|
||||
|
||||
/** @var IAvatarManager */
|
||||
protected $avatarManager;
|
||||
|
||||
/** @var ICache */
|
||||
protected $cache;
|
||||
|
||||
/** @var IL10N */
|
||||
protected $l;
|
||||
|
||||
/** @var IUserManager */
|
||||
protected $userManager;
|
||||
|
||||
/** @var IUserSession */
|
||||
protected $userSession;
|
||||
|
||||
/** @var IRootFolder */
|
||||
protected $rootFolder;
|
||||
|
||||
/** @var ILogger */
|
||||
protected $logger;
|
||||
|
||||
/** @var string */
|
||||
protected $userId;
|
||||
|
||||
/** @var TimeFactory */
|
||||
protected $timeFactory;
|
||||
|
||||
public function __construct($appName,
|
||||
public function __construct(string $appName,
|
||||
IRequest $request,
|
||||
IAvatarManager $avatarManager,
|
||||
ICache $cache,
|
||||
IL10N $l10n,
|
||||
IUserManager $userManager,
|
||||
IRootFolder $rootFolder,
|
||||
ILogger $logger,
|
||||
$userId,
|
||||
LoggerInterface $logger,
|
||||
?string $userId,
|
||||
TimeFactory $timeFactory) {
|
||||
parent::__construct($appName, $request);
|
||||
|
||||
|
@ -109,11 +91,9 @@ class AvatarController extends Controller {
|
|||
* @NoSameSiteCookieRequired
|
||||
* @PublicPage
|
||||
*
|
||||
* @param string $userId
|
||||
* @param int $size
|
||||
* @return JSONResponse|FileDisplayResponse
|
||||
*/
|
||||
public function getAvatar($userId, $size) {
|
||||
public function getAvatar(string $userId, int $size) {
|
||||
if ($size <= 64) {
|
||||
if ($size !== 64) {
|
||||
$this->logger->debug('Avatar requested in deprecated size ' . $size);
|
||||
|
@ -145,11 +125,8 @@ class AvatarController extends Controller {
|
|||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
*
|
||||
* @param string $path
|
||||
* @return JSONResponse
|
||||
*/
|
||||
public function postAvatar($path) {
|
||||
public function postAvatar(?string $path = null): JSONResponse {
|
||||
$files = $this->request->getUploadedFile('files');
|
||||
|
||||
if (isset($path)) {
|
||||
|
@ -250,23 +227,21 @@ class AvatarController extends Controller {
|
|||
);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->logException($e, ['app' => 'core']);
|
||||
$this->logger->error($e->getMessage(), ['exception' => $e, 'app' => 'core']);
|
||||
return new JSONResponse(['data' => ['message' => $this->l->t('An error occurred. Please contact your admin.')]], Http::STATUS_OK);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
*
|
||||
* @return JSONResponse
|
||||
*/
|
||||
public function deleteAvatar() {
|
||||
public function deleteAvatar(): JSONResponse {
|
||||
try {
|
||||
$avatar = $this->avatarManager->getAvatar($this->userId);
|
||||
$avatar->remove();
|
||||
return new JSONResponse();
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->logException($e, ['app' => 'core']);
|
||||
$this->logger->error($e->getMessage(), ['exception' => $e, 'app' => 'core']);
|
||||
return new JSONResponse(['data' => ['message' => $this->l->t('An error occurred. Please contact your admin.')]], Http::STATUS_BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
|
@ -301,11 +276,8 @@ class AvatarController extends Controller {
|
|||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
*
|
||||
* @param array $crop
|
||||
* @return JSONResponse
|
||||
*/
|
||||
public function postCroppedAvatar($crop) {
|
||||
public function postCroppedAvatar(?array $crop = null): JSONResponse {
|
||||
if (is_null($crop)) {
|
||||
return new JSONResponse(['data' => ['message' => $this->l->t("No crop data provided")]],
|
||||
Http::STATUS_BAD_REQUEST);
|
||||
|
@ -337,7 +309,7 @@ class AvatarController extends Controller {
|
|||
return new JSONResponse(['data' => ['message' => $this->l->t('Crop is not square')]],
|
||||
Http::STATUS_BAD_REQUEST);
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->logException($e, ['app' => 'core']);
|
||||
$this->logger->error($e->getMessage(), ['exception' => $e, 'app' => 'core']);
|
||||
return new JSONResponse(['data' => ['message' => $this->l->t('An error occurred. Please contact your admin.')]], Http::STATUS_BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,15 +33,8 @@ use OCP\AppFramework\Http\JSONResponse;
|
|||
use OCP\IRequest;
|
||||
|
||||
class CSRFTokenController extends Controller {
|
||||
private CsrfTokenManager $tokenManager;
|
||||
|
||||
/** @var CsrfTokenManager */
|
||||
private $tokenManager;
|
||||
|
||||
/**
|
||||
* @param string $appName
|
||||
* @param IRequest $request
|
||||
* @param CsrfTokenManager $tokenManager
|
||||
*/
|
||||
public function __construct(string $appName, IRequest $request,
|
||||
CsrfTokenManager $tokenManager) {
|
||||
parent::__construct($appName, $request);
|
||||
|
@ -52,7 +45,6 @@ class CSRFTokenController extends Controller {
|
|||
* @NoAdminRequired
|
||||
* @NoCSRFRequired
|
||||
* @PublicPage
|
||||
* @return JSONResponse
|
||||
*/
|
||||
public function index(): JSONResponse {
|
||||
if (!$this->request->passesStrictCookieCheck()) {
|
||||
|
|
|
@ -56,47 +56,21 @@ use OCP\Security\ISecureRandom;
|
|||
use OCP\Session\Exceptions\SessionNotAvailableException;
|
||||
|
||||
class ClientFlowLoginController extends Controller {
|
||||
/** @var IUserSession */
|
||||
private $userSession;
|
||||
/** @var IL10N */
|
||||
private $l10n;
|
||||
/** @var Defaults */
|
||||
private $defaults;
|
||||
/** @var ISession */
|
||||
private $session;
|
||||
/** @var IProvider */
|
||||
private $tokenProvider;
|
||||
/** @var ISecureRandom */
|
||||
private $random;
|
||||
/** @var IURLGenerator */
|
||||
private $urlGenerator;
|
||||
/** @var ClientMapper */
|
||||
private $clientMapper;
|
||||
/** @var AccessTokenMapper */
|
||||
private $accessTokenMapper;
|
||||
/** @var ICrypto */
|
||||
private $crypto;
|
||||
/** @var IEventDispatcher */
|
||||
private $eventDispatcher;
|
||||
private IUserSession $userSession;
|
||||
private IL10N $l10n;
|
||||
private Defaults $defaults;
|
||||
private ISession $session;
|
||||
private IProvider $tokenProvider;
|
||||
private ISecureRandom $random;
|
||||
private IURLGenerator $urlGenerator;
|
||||
private ClientMapper $clientMapper;
|
||||
private AccessTokenMapper $accessTokenMapper;
|
||||
private ICrypto $crypto;
|
||||
private IEventDispatcher $eventDispatcher;
|
||||
|
||||
public const STATE_NAME = 'client.flow.state.token';
|
||||
|
||||
/**
|
||||
* @param string $appName
|
||||
* @param IRequest $request
|
||||
* @param IUserSession $userSession
|
||||
* @param IL10N $l10n
|
||||
* @param Defaults $defaults
|
||||
* @param ISession $session
|
||||
* @param IProvider $tokenProvider
|
||||
* @param ISecureRandom $random
|
||||
* @param IURLGenerator $urlGenerator
|
||||
* @param ClientMapper $clientMapper
|
||||
* @param AccessTokenMapper $accessTokenMapper
|
||||
* @param ICrypto $crypto
|
||||
* @param IEventDispatcher $eventDispatcher
|
||||
*/
|
||||
public function __construct($appName,
|
||||
public function __construct(string $appName,
|
||||
IRequest $request,
|
||||
IUserSession $userSession,
|
||||
IL10N $l10n,
|
||||
|
@ -123,30 +97,20 @@ class ClientFlowLoginController extends Controller {
|
|||
$this->eventDispatcher = $eventDispatcher;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
private function getClientName() {
|
||||
private function getClientName(): string {
|
||||
$userAgent = $this->request->getHeader('USER_AGENT');
|
||||
return $userAgent !== '' ? $userAgent : 'unknown';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $stateToken
|
||||
* @return bool
|
||||
*/
|
||||
private function isValidToken($stateToken) {
|
||||
private function isValidToken(string $stateToken): bool {
|
||||
$currentToken = $this->session->get(self::STATE_NAME);
|
||||
if (!is_string($stateToken) || !is_string($currentToken)) {
|
||||
if (!is_string($currentToken)) {
|
||||
return false;
|
||||
}
|
||||
return hash_equals($currentToken, $stateToken);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return StandaloneTemplateResponse
|
||||
*/
|
||||
private function stateTokenForbiddenResponse() {
|
||||
private function stateTokenForbiddenResponse(): StandaloneTemplateResponse {
|
||||
$response = new StandaloneTemplateResponse(
|
||||
$this->appName,
|
||||
'403',
|
||||
|
@ -281,12 +245,10 @@ class ClientFlowLoginController extends Controller {
|
|||
* @NoAdminRequired
|
||||
* @UseSession
|
||||
*
|
||||
* @param string $stateToken
|
||||
* @param string $clientIdentifier
|
||||
* @return Http\RedirectResponse|Response
|
||||
*/
|
||||
public function generateAppPassword($stateToken,
|
||||
$clientIdentifier = '') {
|
||||
public function generateAppPassword(string $stateToken,
|
||||
string $clientIdentifier = '') {
|
||||
if (!$this->isValidToken($stateToken)) {
|
||||
$this->session->remove(self::STATE_NAME);
|
||||
return $this->stateTokenForbiddenResponse();
|
||||
|
@ -375,7 +337,7 @@ class ClientFlowLoginController extends Controller {
|
|||
/**
|
||||
* @PublicPage
|
||||
*/
|
||||
public function apptokenRedirect(string $stateToken, string $user, string $password) {
|
||||
public function apptokenRedirect(string $stateToken, string $user, string $password): Response {
|
||||
if (!$this->isValidToken($stateToken)) {
|
||||
return $this->stateTokenForbiddenResponse();
|
||||
}
|
||||
|
|
|
@ -50,22 +50,14 @@ class ClientFlowLoginV2Controller extends Controller {
|
|||
public const TOKEN_NAME = 'client.flow.v2.login.token';
|
||||
public const STATE_NAME = 'client.flow.v2.state.token';
|
||||
|
||||
/** @var LoginFlowV2Service */
|
||||
private $loginFlowV2Service;
|
||||
/** @var IURLGenerator */
|
||||
private $urlGenerator;
|
||||
/** @var ISession */
|
||||
private $session;
|
||||
/** @var IUserSession */
|
||||
private $userSession;
|
||||
/** @var ISecureRandom */
|
||||
private $random;
|
||||
/** @var Defaults */
|
||||
private $defaults;
|
||||
/** @var string */
|
||||
private $userId;
|
||||
/** @var IL10N */
|
||||
private $l10n;
|
||||
private LoginFlowV2Service $loginFlowV2Service;
|
||||
private IURLGenerator $urlGenerator;
|
||||
private IUserSession $userSession;
|
||||
private ISession $session;
|
||||
private ISecureRandom $random;
|
||||
private Defaults $defaults;
|
||||
private ?string $userId;
|
||||
private IL10N $l10n;
|
||||
|
||||
public function __construct(string $appName,
|
||||
IRequest $request,
|
||||
|
|
|
@ -36,25 +36,21 @@ use OCP\Collaboration\Resources\ICollection;
|
|||
use OCP\Collaboration\Resources\IManager;
|
||||
use OCP\Collaboration\Resources\IResource;
|
||||
use OCP\Collaboration\Resources\ResourceException;
|
||||
use OCP\ILogger;
|
||||
use OCP\IRequest;
|
||||
use OCP\IUserSession;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class CollaborationResourcesController extends OCSController {
|
||||
|
||||
/** @var IManager */
|
||||
private $manager;
|
||||
/** @var IUserSession */
|
||||
private $userSession;
|
||||
/** @var ILogger */
|
||||
private $logger;
|
||||
private IManager $manager;
|
||||
private IUserSession $userSession;
|
||||
private LoggerInterface $logger;
|
||||
|
||||
public function __construct(
|
||||
string $appName,
|
||||
IRequest $request,
|
||||
IManager $manager,
|
||||
IUserSession $userSession,
|
||||
ILogger $logger
|
||||
LoggerInterface $logger
|
||||
) {
|
||||
parent::__construct($appName, $request);
|
||||
|
||||
|
@ -240,7 +236,7 @@ class CollaborationResourcesController extends OCSController {
|
|||
} catch (CollectionException $e) {
|
||||
return new DataResponse([], Http::STATUS_NOT_FOUND);
|
||||
} catch (Exception $e) {
|
||||
$this->logger->logException($e);
|
||||
$this->logger->critical($e->getMessage(), ['exception' => $e, 'app' => 'core']);
|
||||
return new DataResponse([], Http::STATUS_INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
|
@ -253,7 +249,7 @@ class CollaborationResourcesController extends OCSController {
|
|||
$result[] = $this->prepareCollection($collection);
|
||||
} catch (CollectionException $e) {
|
||||
} catch (Exception $e) {
|
||||
$this->logger->logException($e);
|
||||
$this->logger->critical($e->getMessage(), ['exception' => $e, 'app' => 'core']);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -280,7 +276,7 @@ class CollaborationResourcesController extends OCSController {
|
|||
$result[] = $this->prepareResource($resource);
|
||||
} catch (ResourceException $e) {
|
||||
} catch (Exception $e) {
|
||||
$this->logger->logException($e);
|
||||
$this->logger->critical($e->getMessage(), ['exception' => $e, 'app' => 'core']);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -44,12 +44,8 @@ use OCP\Files\SimpleFS\ISimpleFolder;
|
|||
use OCP\IRequest;
|
||||
|
||||
class CssController extends Controller {
|
||||
|
||||
/** @var IAppData */
|
||||
protected $appData;
|
||||
|
||||
/** @var ITimeFactory */
|
||||
protected $timeFactory;
|
||||
protected IAppData $appData;
|
||||
protected ITimeFactory $timeFactory;
|
||||
|
||||
public function __construct(string $appName,
|
||||
IRequest $request,
|
||||
|
|
|
@ -26,37 +26,24 @@ use OCP\AppFramework\Controller;
|
|||
use OCP\AppFramework\Http;
|
||||
use OCP\AppFramework\Http\FileDisplayResponse;
|
||||
use OCP\IAvatarManager;
|
||||
use OCP\ILogger;
|
||||
use OCP\IRequest;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
/**
|
||||
* This controller handles guest avatar requests.
|
||||
*/
|
||||
class GuestAvatarController extends Controller {
|
||||
|
||||
/**
|
||||
* @var ILogger
|
||||
*/
|
||||
private $logger;
|
||||
|
||||
/**
|
||||
* @var IAvatarManager
|
||||
*/
|
||||
private $avatarManager;
|
||||
private LoggerInterface $logger;
|
||||
private IAvatarManager $avatarManager;
|
||||
|
||||
/**
|
||||
* GuestAvatarController constructor.
|
||||
*
|
||||
* @param $appName
|
||||
* @param IRequest $request
|
||||
* @param IAvatarManager $avatarManager
|
||||
* @param ILogger $logger
|
||||
*/
|
||||
public function __construct(
|
||||
$appName,
|
||||
string $appName,
|
||||
IRequest $request,
|
||||
IAvatarManager $avatarManager,
|
||||
ILogger $logger
|
||||
LoggerInterface $logger
|
||||
) {
|
||||
parent::__construct($appName, $request);
|
||||
$this->avatarManager = $avatarManager;
|
||||
|
@ -73,7 +60,7 @@ class GuestAvatarController extends Controller {
|
|||
* @param string $size The desired avatar size, e.g. 64 for 64x64px
|
||||
* @return FileDisplayResponse|Http\Response
|
||||
*/
|
||||
public function getAvatar($guestName, $size) {
|
||||
public function getAvatar(string $guestName, string $size) {
|
||||
$size = (int) $size;
|
||||
|
||||
if ($size <= 64) {
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче