-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Bernhard Posselt
committed
May 13, 2017
1 parent
86c39a7
commit 53822bb
Showing
9 changed files
with
108 additions
and
248 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
This file was deleted.
Oops, something went wrong.
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
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
This file was deleted.
Oops, something went wrong.
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
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 |
---|---|---|
|
@@ -5,34 +5,46 @@ | |
* This file is licensed under the Affero General Public License version 3 or | ||
* later. See the COPYING file. | ||
* | ||
* @author Alessandro Cosentino <[email protected]> | ||
* @author Bernhard Posselt <[email protected]> | ||
* @copyright Alessandro Cosentino 2012 | ||
* @copyright Bernhard Posselt 2012, 2014 | ||
*/ | ||
|
||
namespace OCA\News\Cron; | ||
|
||
use OCA\News\AppInfo\Application; | ||
use OC\BackgroundJob\Job; | ||
|
||
use OCA\News\Config\Config; | ||
use OCA\News\Service\StatusService; | ||
use OCA\News\Utility\Updater as UpdaterService; | ||
|
||
class Updater { | ||
class Updater extends Job { | ||
|
||
public static function run() { | ||
$app = new Application(); | ||
/** | ||
* @var Config | ||
*/ | ||
private $config; | ||
/** | ||
* @var StatusService | ||
*/ | ||
private $status; | ||
/** | ||
* @var UpdaterService | ||
*/ | ||
private $updaterService; | ||
|
||
$container = $app->getContainer(); | ||
public function __construct(Config $config, StatusService $status, | ||
UpdaterService $updaterService) { | ||
$this->config = $config; | ||
$this->status = $status; | ||
$this->updaterService = $updaterService; | ||
} | ||
|
||
// make it possible to turn off cron updates if you use an external | ||
// script to execute updates in parallel | ||
$useCronUpdates = $container->query(Config::class)->getUseCronUpdates(); | ||
$isProperlyConfigured = $container->query(StatusService::class)->isProperlyConfigured(); | ||
if ($useCronUpdates && $isProperlyConfigured) { | ||
$container->query(UpdaterService::class)->update(); | ||
$container->query(UpdaterService::class)->beforeUpdate(); | ||
$container->query(UpdaterService::class)->afterUpdate(); | ||
protected function run($argument) { | ||
if ($this->config->getUseCronUpdates() && | ||
$this->status->isProperlyConfigured()) { | ||
$this->updaterService->update(); | ||
$this->updaterService->beforeUpdate(); | ||
$this->updaterService->afterUpdate(); | ||
} | ||
} | ||
|
||
|
Oops, something went wrong.