-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1090 from nextcloud/fix/remove-oc-backgroundjob-use
chore: Migrate to OCP version of QueuedJob
- Loading branch information
Showing
2 changed files
with
19 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* @copyright Copyright (c) 2016 Joas Schilling <[email protected]> | ||
* | ||
|
@@ -21,25 +24,21 @@ | |
|
||
namespace OCA\FirstRunWizard\Notification; | ||
|
||
use OC\BackgroundJob\QueuedJob; | ||
use OCP\AppFramework\Utility\ITimeFactory; | ||
use OCP\BackgroundJob\QueuedJob; | ||
use OCP\Notification\IManager as INotificationManager; | ||
|
||
class BackgroundJob extends QueuedJob { | ||
|
||
/** @var INotificationManager */ | ||
protected $notificationManager; | ||
|
||
/** | ||
* BackgroundJob constructor. | ||
* | ||
* @param INotificationManager $notificationManager | ||
*/ | ||
public function __construct(INotificationManager $notificationManager) { | ||
$this->notificationManager = $notificationManager; | ||
public function __construct( | ||
ITimeFactory $time, | ||
protected INotificationManager $notificationManager, | ||
) { | ||
parent::__construct($time); | ||
} | ||
|
||
/** | ||
* @param array $argument | ||
* @return void | ||
*/ | ||
protected function run($argument) { | ||
$notification = $this->notificationManager->createNotification(); | ||
|
@@ -49,7 +48,7 @@ protected function run($argument) { | |
->setUser($argument['uid']); | ||
|
||
if ($this->notificationManager->getCount($notification) === 0) { | ||
$notification->setDateTime(new \DateTime()); | ||
$notification->setDateTime($this->time->getDateTime()); | ||
$this->notificationManager->notify($notification); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters