Skip to content

Commit

Permalink
Migrate activity app from ILogger
Browse files Browse the repository at this point in the history
Migrated files in:

- `lib\AppInfo`
- `lib\Controller`
- `lib\Command`

Resolves : nextcloud/server#32127

Signed-off-by: fenn-cs <[email protected]>
  • Loading branch information
nfebe committed Jul 9, 2023
1 parent a743f34 commit de54ea4
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 129 deletions.
4 changes: 2 additions & 2 deletions lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
use OCP\IConfig;
use OCP\IDateTimeFormatter;
use OCP\IDBConnection;
use OCP\ILogger;
use OCP\IURLGenerator;
use OCP\IUserManager;
use OCP\L10N\IFactory;
Expand All @@ -56,6 +55,7 @@
use OCP\User\Events\UserDeletedEvent;
use OCP\Util;
use Psr\Container\ContainerInterface;
use Psr\Log\LoggerInterface;

class Application extends App implements IBootstrap {
public const APP_ID = 'activity';
Expand Down Expand Up @@ -122,7 +122,7 @@ public function register(IRegistrationContext $context): void {
$c->get(IManager::class),
$c->get(IValidator::class),
$c->get(IConfig::class),
$c->get(ILogger::class)
$c->get(LoggerInterface::class),
);
});

Expand Down
18 changes: 5 additions & 13 deletions lib/Command/SendEmails.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,31 +27,23 @@
use OCA\Activity\MailQueueHandler;
use OCA\Activity\UserSettings;
use OCP\IConfig;
use OCP\ILogger;
use Psr\Log\LoggerInterface;
use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

class SendEmails extends Base {
/** @var MailQueueHandler */
protected $queueHandler;

/** @var IConfig */
protected $config;

/** @var ILogger */
protected $logger;

/**
* @param MailQueueHandler $queueHandler
* @param IConfig $config
* @param ILogger $logger
* @param LoggerInterface $logger
*/
public function __construct(MailQueueHandler $queueHandler,
IConfig $config,
ILogger $logger) {
public function __construct(protected MailQueueHandler $queueHandler,
protected IConfig $config,
protected LoggerInterface $logger) {
parent::__construct();

$this->queueHandler = $queueHandler;
Expand Down
25 changes: 4 additions & 21 deletions lib/Controller/APIv1Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,6 @@
use OCP\IRequest;

class APIv1Controller extends OCSController {
/** @var Data */
protected $data;

/** @var GroupHelper */
protected $groupHelper;

/** @var UserSettings */
protected $userSettings;

/** @var CurrentUser */
protected $currentUser;

/**
* @param string $appName
* @param IRequest $request
Expand All @@ -52,16 +40,11 @@ class APIv1Controller extends OCSController {
*/
public function __construct($appName,
IRequest $request,
Data $data,
GroupHelper $groupHelper,
UserSettings $userSettings,
CurrentUser $currentUser) {
protected Data $data,
protected GroupHelper $groupHelper,
protected UserSettings $userSettings,
protected CurrentUser $currentUser) {
parent::__construct($appName, $request);

$this->data = $data;
$this->userSettings = $userSettings;
$this->groupHelper = $groupHelper;
$this->currentUser = $currentUser;
}

/**
Expand Down
54 changes: 10 additions & 44 deletions lib/Controller/APIv2Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,54 +67,20 @@ class APIv2Controller extends OCSController {
/** @var bool */
protected $loadPreviews;

/** @var IManager */
protected $activityManager;

/** @var Data */
protected $data;

/** @var GroupHelper */
protected $helper;

/** @var UserSettings */
protected $settings;

/** @var IURLGenerator */
protected $urlGenerator;

/** @var IUserSession */
protected $userSession;

/** @var IPreview */
protected $preview;

/** @var IMimeTypeDetector */
protected $mimeTypeDetector;

/** @var ViewInfoCache */
protected $infoCache;

public function __construct($appName,
IRequest $request,
IManager $activityManager,
Data $data,
GroupHelper $helper,
UserSettings $settings,
IURLGenerator $urlGenerator,
IUserSession $userSession,
IPreview $preview,
IMimeTypeDetector $mimeTypeDetector,
ViewInfoCache $infoCache) {
protected IManager $activityManager,
protected Data $data,
protected GroupHelper $helper,
protected UserSettings $settings,
protected IURLGenerator $urlGenerator,
protected IUserSession $userSession,
protected IPreview $preview,
protected IMimeTypeDetector $mimeTypeDetector,
protected ViewInfoCache $infoCache,
) {
parent::__construct($appName, $request);
$this->activityManager = $activityManager;
$this->data = $data;
$this->helper = $helper;
$this->settings = $settings;
$this->urlGenerator = $urlGenerator;
$this->userSession = $userSession;
$this->preview = $preview;
$this->mimeTypeDetector = $mimeTypeDetector;
$this->infoCache = $infoCache;
}

/**
Expand Down
30 changes: 5 additions & 25 deletions lib/Controller/ActivitiesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,6 @@
use Symfony\Component\EventDispatcher\GenericEvent;

class ActivitiesController extends Controller {
/** @var IConfig */
protected $config;

/** @var Data */
protected $data;

/** @var IL10N */
private $l10n;

/** @var Navigation */
protected $navigation;

/** @var EventDispatcherInterface */
protected $eventDispatcher;

/**
* @param string $appName
* @param IRequest $request
Expand All @@ -59,17 +44,12 @@ class ActivitiesController extends Controller {
*/
public function __construct($appName,
IRequest $request,
IConfig $config,
Data $data,
Navigation $navigation,
EventDispatcherInterface $eventDispatcher,
IL10N $l10n) {
protected IConfig $config,
protected Data $data,
protected Navigation $navigation,
protected EventDispatcherInterface $eventDispatcher,
private IL10N $l10n) {
parent::__construct($appName, $request);
$this->data = $data;
$this->config = $config;
$this->navigation = $navigation;
$this->eventDispatcher = $eventDispatcher;
$this->l10n = $l10n;
}

/**
Expand Down
29 changes: 5 additions & 24 deletions lib/Controller/RemoteActivityController.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,34 +36,15 @@
use OCP\IUserManager;

class RemoteActivityController extends OCSController {
/** @var IDBConnection */
protected $db;

/** @var IUserManager */
protected $userManager;

/** @var IAppManager */
protected $appManager;

/** @var IRootFolder */
protected $rootFolder;

/** @var IActivityManager */
protected $activityManager;

public function __construct($appName,
IRequest $request,
IDBConnection $db,
IUserManager $userManager,
IAppManager $appManager,
IRootFolder $rootFolder,
IActivityManager $activityManager) {
protected IDBConnection $db,
protected IUserManager $userManager,
protected IAppManager $appManager,
protected IRootFolder $rootFolder,
protected IActivityManager $activityManager) {
parent::__construct($appName, $request);
$this->db = $db;
$this->userManager = $userManager;
$this->appManager = $appManager;
$this->rootFolder = $rootFolder;
$this->activityManager = $activityManager;
}

/**
Expand Down

0 comments on commit de54ea4

Please sign in to comment.