mirror of
https://github.com/nextcloud/server.git
synced 2026-06-10 09:13:19 -04:00
Merge pull request #38771 from fsamapoor/constructor_property_promotion_in_core_command_part7
Uses PHP8's constructor property promotion core/Command/Info, /Integrity, and /Preview
This commit is contained in:
commit
cbebc50987
10 changed files with 43 additions and 83 deletions
|
|
@ -23,11 +23,12 @@ use Symfony\Component\Console\Output\OutputInterface;
|
|||
|
||||
class File extends Command {
|
||||
private IL10N $l10n;
|
||||
private FileUtils $fileUtils;
|
||||
|
||||
public function __construct(IFactory $l10nFactory, FileUtils $fileUtils) {
|
||||
public function __construct(
|
||||
IFactory $l10nFactory,
|
||||
private FileUtils $fileUtils,
|
||||
) {
|
||||
$this->l10n = $l10nFactory->get("core");
|
||||
$this->fileUtils = $fileUtils;
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace OC\Core\Command\Info;
|
||||
|
||||
use OC\Files\SetupManager;
|
||||
use OCA\Circles\MountManager\CircleMount;
|
||||
use OCA\Files_External\Config\ExternalMountPoint;
|
||||
use OCA\Files_Sharing\SharedMount;
|
||||
|
|
@ -33,7 +32,6 @@ use OCP\Files\Config\IUserMountCache;
|
|||
use OCP\Files\FileInfo;
|
||||
use OCP\Files\IHomeStorage;
|
||||
use OCP\Files\IRootFolder;
|
||||
use OCP\Files\Mount\IMountManager;
|
||||
use OCP\Files\Mount\IMountPoint;
|
||||
use OCP\Files\Node;
|
||||
use OCP\Files\NotFoundException;
|
||||
|
|
@ -43,21 +41,10 @@ use Symfony\Component\Console\Output\OutputInterface;
|
|||
use OCP\Files\Folder;
|
||||
|
||||
class FileUtils {
|
||||
private IRootFolder $rootFolder;
|
||||
private IUserMountCache $userMountCache;
|
||||
private IMountManager $mountManager;
|
||||
private SetupManager $setupManager;
|
||||
|
||||
public function __construct(
|
||||
IRootFolder $rootFolder,
|
||||
IUserMountCache $userMountCache,
|
||||
IMountManager $mountManager,
|
||||
SetupManager $setupManager
|
||||
private IRootFolder $rootFolder,
|
||||
private IUserMountCache $userMountCache,
|
||||
) {
|
||||
$this->rootFolder = $rootFolder;
|
||||
$this->userMountCache = $userMountCache;
|
||||
$this->mountManager = $mountManager;
|
||||
$this->setupManager = $setupManager;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -32,10 +32,9 @@ use Symfony\Component\Console\Input\InputOption;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class Space extends Command {
|
||||
private FileUtils $fileUtils;
|
||||
|
||||
public function __construct(FileUtils $fileUtils) {
|
||||
$this->fileUtils = $fileUtils;
|
||||
public function __construct(
|
||||
private FileUtils $fileUtils,
|
||||
) {
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,11 +40,10 @@ use Symfony\Component\Console\Output\OutputInterface;
|
|||
* @package OC\Core\Command\Integrity
|
||||
*/
|
||||
class CheckApp extends Base {
|
||||
private Checker $checker;
|
||||
|
||||
public function __construct(Checker $checker) {
|
||||
public function __construct(
|
||||
private Checker $checker,
|
||||
) {
|
||||
parent::__construct();
|
||||
$this->checker = $checker;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -36,11 +36,10 @@ use Symfony\Component\Console\Output\OutputInterface;
|
|||
* @package OC\Core\Command\Integrity
|
||||
*/
|
||||
class CheckCore extends Base {
|
||||
private Checker $checker;
|
||||
|
||||
public function __construct(Checker $checker) {
|
||||
public function __construct(
|
||||
private Checker $checker,
|
||||
) {
|
||||
parent::__construct();
|
||||
$this->checker = $checker;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -40,17 +40,12 @@ use Symfony\Component\Console\Output\OutputInterface;
|
|||
* @package OC\Core\Command\Integrity
|
||||
*/
|
||||
class SignApp extends Command {
|
||||
private Checker $checker;
|
||||
private FileAccessHelper $fileAccessHelper;
|
||||
private IURLGenerator $urlGenerator;
|
||||
|
||||
public function __construct(Checker $checker,
|
||||
FileAccessHelper $fileAccessHelper,
|
||||
IURLGenerator $urlGenerator) {
|
||||
public function __construct(
|
||||
private Checker $checker,
|
||||
private FileAccessHelper $fileAccessHelper,
|
||||
private IURLGenerator $urlGenerator,
|
||||
) {
|
||||
parent::__construct(null);
|
||||
$this->checker = $checker;
|
||||
$this->fileAccessHelper = $fileAccessHelper;
|
||||
$this->urlGenerator = $urlGenerator;
|
||||
}
|
||||
|
||||
protected function configure() {
|
||||
|
|
|
|||
|
|
@ -39,14 +39,11 @@ use Symfony\Component\Console\Output\OutputInterface;
|
|||
* @package OC\Core\Command\Integrity
|
||||
*/
|
||||
class SignCore extends Command {
|
||||
private Checker $checker;
|
||||
private FileAccessHelper $fileAccessHelper;
|
||||
|
||||
public function __construct(Checker $checker,
|
||||
FileAccessHelper $fileAccessHelper) {
|
||||
public function __construct(
|
||||
private Checker $checker,
|
||||
private FileAccessHelper $fileAccessHelper,
|
||||
) {
|
||||
parent::__construct(null);
|
||||
$this->checker = $checker;
|
||||
$this->fileAccessHelper = $fileAccessHelper;
|
||||
}
|
||||
|
||||
protected function configure() {
|
||||
|
|
|
|||
|
|
@ -36,15 +36,11 @@ use Symfony\Component\Console\Input\InputOption;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class Generate extends Command {
|
||||
private IRootFolder $rootFolder;
|
||||
private IUserMountCache $userMountCache;
|
||||
private IPreview $previewManager;
|
||||
|
||||
public function __construct(IRootFolder $rootFolder, IUserMountCache $userMountCache, IPreview $previewManager) {
|
||||
$this->rootFolder = $rootFolder;
|
||||
$this->userMountCache = $userMountCache;
|
||||
$this->previewManager = $previewManager;
|
||||
|
||||
public function __construct(
|
||||
private IRootFolder $rootFolder,
|
||||
private IUserMountCache $userMountCache,
|
||||
private IPreview $previewManager,
|
||||
) {
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -45,20 +45,17 @@ use Symfony\Component\Console\Question\ConfirmationQuestion;
|
|||
use function pcntl_signal;
|
||||
|
||||
class Repair extends Command {
|
||||
protected IConfig $config;
|
||||
private IRootFolder $rootFolder;
|
||||
private LoggerInterface $logger;
|
||||
private bool $stopSignalReceived = false;
|
||||
private int $memoryLimit;
|
||||
private int $memoryTreshold;
|
||||
private 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;
|
||||
|
||||
public function __construct(
|
||||
protected IConfig $config,
|
||||
private IRootFolder $rootFolder,
|
||||
private LoggerInterface $logger,
|
||||
IniGetWrapper $phpIni,
|
||||
private ILockingProvider $lockingProvider,
|
||||
) {
|
||||
$this->memoryLimit = (int)$phpIni->getBytes('memory_limit');
|
||||
$this->memoryTreshold = $this->memoryLimit - 25 * 1024 * 1024;
|
||||
|
||||
|
|
|
|||
|
|
@ -39,24 +39,14 @@ use Symfony\Component\Console\Input\InputOption;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class ResetRenderedTexts extends Command {
|
||||
protected IDBConnection $connection;
|
||||
protected IUserManager $userManager;
|
||||
protected IAvatarManager $avatarManager;
|
||||
private Root $previewFolder;
|
||||
private IMimeTypeLoader $mimeTypeLoader;
|
||||
|
||||
public function __construct(IDBConnection $connection,
|
||||
IUserManager $userManager,
|
||||
IAvatarManager $avatarManager,
|
||||
Root $previewFolder,
|
||||
IMimeTypeLoader $mimeTypeLoader) {
|
||||
public function __construct(
|
||||
protected IDBConnection $connection,
|
||||
protected IUserManager $userManager,
|
||||
protected IAvatarManager $avatarManager,
|
||||
private Root $previewFolder,
|
||||
private IMimeTypeLoader $mimeTypeLoader,
|
||||
) {
|
||||
parent::__construct();
|
||||
|
||||
$this->connection = $connection;
|
||||
$this->userManager = $userManager;
|
||||
$this->avatarManager = $avatarManager;
|
||||
$this->previewFolder = $previewFolder;
|
||||
$this->mimeTypeLoader = $mimeTypeLoader;
|
||||
}
|
||||
|
||||
protected function configure() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue