diff options
author | brantje <brantje@gmail.com> | 2016-12-19 19:51:59 +0300 |
---|---|---|
committer | brantje <brantje@gmail.com> | 2016-12-19 20:04:00 +0300 |
commit | 892965e86998248f4da87fcc5a1268c37b26a0f3 (patch) | |
tree | 7a12dc8ee7a263b98ae73f1727bc0e1ae4e9df7c /lib | |
parent | c573f2d3de69095e095027d146a1662f31bbe21e (diff) |
Fix for NC12 $container->getDb()
Diffstat (limited to 'lib')
-rw-r--r-- | lib/AppInfo/Application.php | 6 | ||||
-rw-r--r-- | lib/Service/CronService.php | 10 |
2 files changed, 8 insertions, 8 deletions
diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index c7d70f3f..c2840294 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -36,6 +36,7 @@ use OCA\Passman\Service\FileService; use OCA\Passman\Service\VaultService; use OCA\Passman\Utility\Utils; use OCA\Passman\Service\NotificationService; +use OCP\IDBConnection; use OCP\AppFramework\App; use OCP\IL10N; @@ -75,7 +76,7 @@ class Application extends App { - /** Cron **/ + /** Cron **/ $container->registerService('CronService', function ($c) { return new CronService( $c->query('CredentialService'), @@ -83,7 +84,7 @@ class Application extends App { $c->query('Utils'), $c->query('NotificationService'), $c->query('ActivityService'), - $c->query('ServerContainer')->getDb() + $c->query('IDBConnection') ); }); @@ -107,6 +108,7 @@ class Application extends App { $container->registerAlias('FileService', FileService::class); $container->registerAlias('ShareService', ShareService::class); $container->registerAlias('Utils', Utils::class); + $container->registerAlias('IDBConnection', IDBConnection::class); } /** diff --git a/lib/Service/CronService.php b/lib/Service/CronService.php index eb9733b3..3ee3660e 100644 --- a/lib/Service/CronService.php +++ b/lib/Service/CronService.php @@ -37,7 +37,7 @@ class CronService { private $notificationService; private $activityService; private $db; - public function __construct(CredentialService $credentialService, ILogger $logger, Utils $utils, NotificationService $notificationService, ActivityService $activityService, $db) { + public function __construct(CredentialService $credentialService, ILogger $logger, Utils $utils, NotificationService $notificationService, ActivityService $activityService, IDBConnection $db) { $this->credentialService = $credentialService; $this->logger = $logger; $this->utils = $utils; @@ -54,14 +54,12 @@ class CronService { $link = ''; // @TODO create direct link to credential $sql = 'SELECT count(*) as rows from `*PREFIX*notifications` WHERE `subject`= \'credential_expired\' AND object_id=?'; - $query = $this->db->prepareQuery($sql); $id = $credential->getId(); - $query->bindParam(1, $id, \PDO::PARAM_INT); - $result = $query->execute(); + $result = $this->db->executeQuery($sql, array($id)); $this->logger->debug($credential->getLabel() .' is expired, checking notifications!', array('app' => 'passman')); - if($result->fetchRow()['rows'] === 0) { + $notifications = intval($result->fetch()['rows']); + if($notifications === 0) { $this->logger->debug($credential->getLabel() .' is expired, adding notification!', array('app' => 'passman')); - $this->activityService->add( Activity::SUBJECT_ITEM_EXPIRED, array($credential->getLabel(), $credential->getUserId()), '', array(), |