Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: php

php:
- '7.4'
- '8.1'

env:
global:
Expand All @@ -19,7 +19,7 @@ before_script:
- git clone https://github.com/nextcloud/server.git
- mv server/ nextcloud
- cd nextcloud
- git checkout origin/stable19 -b stable19
- git checkout origin/stable25 -b stable25
- mkdir custom_apps
- cp -pi ${TRAVIS_BUILD_DIR}/travis/apps.config.php config
- cd 3rdparty
Expand Down
2 changes: 1 addition & 1 deletion appinfo/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@

use OCA\FileUploadNotification\AppInfo\Application;

$app = \OC::$server->query(Application::class);
$app = \OC::$server->get(Application::class);
$app->register();
2 changes: 1 addition & 1 deletion appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<category>tools</category>
<bugs>https://github.com/RCOSDP/nextcloud-file_upload_notification/issues</bugs>
<dependencies>
<nextcloud min-version="18" max-version="19" />
<nextcloud min-version="25" max-version="26" />
</dependencies>
<settings>
<personal>OCA\FileUploadNotification\Settings\Personal</personal>
Expand Down
14 changes: 6 additions & 8 deletions lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,13 @@ public function __construct(array $urlParams = []) {
/**
* Controllers
*/
$container->registerService('UserHooks', function() {
$container = $this->getContainer();
$server = $container->getServer();
$container->registerService('UserHooks', function($c) {
return new UserHooks(
self::APP_ID,
$server->getConfig(),
$server->getRootFolder(),
new FileUpdateMapper($server->getDatabaseConnection()),
$server->getLogger()
$c->get('ServerContainer')->getConfig(),
$c->get('ServerContainer')->getRootFolder(),
new FileUpdateMapper($c->get('ServerContainer')->getDatabaseConnection()),
$c->get('ServerContainer')->getLogger()
);
});
}
Expand All @@ -38,6 +36,6 @@ public function register() {

public function registerHooks() {
$container = $this->getContainer();
$container->query('UserHooks')->register();
$container->get('UserHooks')->register();
}
}
3 changes: 2 additions & 1 deletion lib/Controller/ConfigController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use OCP\ILogger;
use OCP\IRequest;
use OCP\IUserSession;
use Psr\Log\LoggerInterface;

class ConfigController extends OCSController {

Expand All @@ -23,7 +24,7 @@ public function __construct($appName,
IRequest $request,
IConfig $config,
IUserSession $userSession,
ILogger $logger) {
LoggerInterface $logger) {
parent::__construct($appName, $request);
$this->config = $config;
$this->logger = $logger;
Expand Down
11 changes: 7 additions & 4 deletions lib/Controller/RecentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

use OCA\FileUploadNotification\Db\FileUpdateMapper;
use OCA\FileUploadNotification\Db\FileCacheExtendedMapper;
use Psr\Log\LoggerInterface;

class RecentController extends OCSController {

Expand All @@ -34,7 +35,7 @@ public function __construct($appName,
IUserSession $userSession,
FileUpdateMapper $updateMapper,
FileCacheExtendedMapper $cacheExtendedMapper,
ILogger $logger) {
LoggerInterface $logger) {
parent::__construct($appName, $request);
$this->config = $config;
$this->rootFolder = $rootFolder;
Expand Down Expand Up @@ -221,9 +222,11 @@ public function getRecent($since) {
/*
* set since value for hook function
*/
$sinceKey = $userId . '#since';
$this->config->setAppValue($this->appName, $sinceKey, $totalRecords[0]->getUploadTime());
$this->logger->info('set since: ' . strval($totalRecords[0]->getUploadTime()));
if ($totalRecords[0] !== null) {
$sinceKey = $userId . '#since';
$this->config->setAppValue($this->appName, $sinceKey, $totalRecords[0]->getUploadTime());
$this->logger->info('set since: ' . strval($totalRecords[0]->getUploadTime()));
}

return new DataResponse(
$data,
Expand Down
4 changes: 2 additions & 2 deletions tests/Controller/ConfigControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\JSONResponse;
use OCP\IConfig;
use OCP\ILogger;
use Psr\Log\LoggerInterface;
use OCP\IRequest;
use OCP\IUser;
use OCP\IUserSession;
Expand Down Expand Up @@ -37,7 +37,7 @@ protected function setUp() :void {
$this->userSession = $this->getMockBuilder(IUserSession::class)->disableOriginalConstructor()->getMock();
$this->userSession->method('getUser')->willReturn($this->user);

$this->logger = $this->getMockBuilder(ILogger::class)->getMock();
$this->logger = $this->getMockBuilder(LoggerInterface::class)->getMock();
}

protected function tearDown() :void {
Expand Down
4 changes: 2 additions & 2 deletions tests/Controller/RecentControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use OCP\AppFramework\Http\DataResponse;
use OCP\Files\NotFoundException;
use OCP\IConfig;
use OCP\ILogger;
use Psr\Log\LoggerInterface;
use OCP\IRequest;
use OCP\IUser;
use OCP\IUserSession;
Expand Down Expand Up @@ -54,7 +54,7 @@ protected function setUp() :void {

$this->cacheExtendedMapper = $this->getMockBuilder(FileCacheExtendedMapper::class)->disableOriginalConstructor()->getMock();

$this->logger = $this->getMockBuilder(ILogger::class)->getMock();
$this->logger = $this->getMockBuilder(LoggerInterface::class)->getMock();
}

protected function tearDown() :void {
Expand Down