summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2017-11-27 11:48:59 +0100
committerGitHub <noreply@github.com>2017-11-27 11:48:59 +0100
commit8ccb4868762b13adc02f49654a7867b556009a41 (patch)
treebfdbb3deea57edf49122c12c05ef28b7c61a25cf /apps
parentf0d809fddecd63ca16028222a355b1c7f5aca4d9 (diff)
parentdf61d43529418aace241b99be106ff9a35188dac (diff)
downloadnextcloud-server-8ccb4868762b13adc02f49654a7867b556009a41.tar.gz
nextcloud-server-8ccb4868762b13adc02f49654a7867b556009a41.zip
Merge pull request #7264 from nextcloud/cache-fetched-apps
Cache fetched apps in update check
Diffstat (limited to 'apps')
-rw-r--r--apps/updatenotification/lib/Notification/BackgroundJob.php9
-rw-r--r--apps/updatenotification/tests/Notification/BackgroundJobTest.php8
2 files changed, 14 insertions, 3 deletions
diff --git a/apps/updatenotification/lib/Notification/BackgroundJob.php b/apps/updatenotification/lib/Notification/BackgroundJob.php
index 08baa35664f..3c0cac60cde 100644
--- a/apps/updatenotification/lib/Notification/BackgroundJob.php
+++ b/apps/updatenotification/lib/Notification/BackgroundJob.php
@@ -53,6 +53,9 @@ class BackgroundJob extends TimedJob {
/** @var IClientService */
protected $client;
+ /** @var Installer */
+ protected $installer;
+
/** @var string[] */
protected $users;
@@ -64,8 +67,9 @@ class BackgroundJob extends TimedJob {
* @param IGroupManager $groupManager
* @param IAppManager $appManager
* @param IClientService $client
+ * @param Installer $installer
*/
- public function __construct(IConfig $config, IManager $notificationManager, IGroupManager $groupManager, IAppManager $appManager, IClientService $client) {
+ public function __construct(IConfig $config, IManager $notificationManager, IGroupManager $groupManager, IAppManager $appManager, IClientService $client, Installer $installer) {
// Run once a day
$this->setInterval(60 * 60 * 24);
@@ -74,6 +78,7 @@ class BackgroundJob extends TimedJob {
$this->groupManager = $groupManager;
$this->appManager = $appManager;
$this->client = $client;
+ $this->installer = $installer;
}
protected function run($argument) {
@@ -257,6 +262,6 @@ class BackgroundJob extends TimedJob {
* @return string|false
*/
protected function isUpdateAvailable($app) {
- return Installer::isUpdateAvailable($app, \OC::$server->getAppFetcher());
+ return $this->installer->isUpdateAvailable($app);
}
}
diff --git a/apps/updatenotification/tests/Notification/BackgroundJobTest.php b/apps/updatenotification/tests/Notification/BackgroundJobTest.php
index 92a8a687f5a..0355b10a09c 100644
--- a/apps/updatenotification/tests/Notification/BackgroundJobTest.php
+++ b/apps/updatenotification/tests/Notification/BackgroundJobTest.php
@@ -23,6 +23,7 @@
namespace OCA\UpdateNotification\Tests\Notification;
+use OC\Installer;
use OCA\UpdateNotification\Notification\BackgroundJob;
use OCP\App\IAppManager;
use OCP\Http\Client\IClientService;
@@ -47,6 +48,8 @@ class BackgroundJobTest extends TestCase {
protected $appManager;
/** @var IClientService|\PHPUnit_Framework_MockObject_MockObject */
protected $client;
+ /** @var Installer|\PHPUnit_Framework_MockObject_MockObject */
+ protected $installer;
public function setUp() {
parent::setUp();
@@ -56,6 +59,7 @@ class BackgroundJobTest extends TestCase {
$this->groupManager = $this->createMock(IGroupManager::class);
$this->appManager = $this->createMock(IAppManager::class);
$this->client = $this->createMock(IClientService::class);
+ $this->installer = $this->createMock(Installer::class);
}
/**
@@ -69,7 +73,8 @@ class BackgroundJobTest extends TestCase {
$this->notificationManager,
$this->groupManager,
$this->appManager,
- $this->client
+ $this->client,
+ $this->installer
);
} {
return $this->getMockBuilder(BackgroundJob::class)
@@ -79,6 +84,7 @@ class BackgroundJobTest extends TestCase {
$this->groupManager,
$this->appManager,
$this->client,
+ $this->installer,
])
->setMethods($methods)
->getMock();