From 438142790dc88d0b8e977ad5f6deb76eab99634f Mon Sep 17 00:00:00 2001 From: ndnhat Date: Fri, 3 Feb 2023 16:47:28 +0700 Subject: [PATCH 1/4] =?UTF-8?q?-=20Update=20source=20to=20support=20Nextcl?= =?UTF-8?q?oud=20v.25=20(Issue=20#8=20(B).1.4=20[=E6=A9=9F=E9=96=A2?= =?UTF-8?q?=E3=82=B9=E3=83=88=E3=83=AC=E3=83=BC=E3=82=B8]=E6=9C=80?= =?UTF-8?q?=E6=96=B0=E3=83=90=E3=83=BC=E3=82=B8=E3=83=A7=E3=83=B3=E3=81=B8?= =?UTF-8?q?=E3=81=AE=E5=AF=BE=E5=BF=9C)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- appinfo/app.php | 2 +- appinfo/info.xml | 2 +- lib/AppInfo/Application.php | 14 ++++++-------- lib/Controller/ConfigController.php | 3 ++- lib/Controller/RecentController.php | 3 ++- tests/Controller/ConfigControllerTest.php | 4 ++-- tests/Controller/RecentControllerTest.php | 4 ++-- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/appinfo/app.php b/appinfo/app.php index f0d09c4..826e646 100644 --- a/appinfo/app.php +++ b/appinfo/app.php @@ -4,5 +4,5 @@ use OCA\FileUploadNotification\AppInfo\Application; -$app = \OC::$server->query(Application::class); +$app = \OC::$server->get(Application::class); $app->register(); \ No newline at end of file diff --git a/appinfo/info.xml b/appinfo/info.xml index 3ce2729..c2f77da 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -16,7 +16,7 @@ tools https://github.com/RCOSDP/nextcloud-file_upload_notification/issues - + OCA\FileUploadNotification\Settings\Personal diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index 047a793..de28da9 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -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() ); }); } @@ -38,6 +36,6 @@ public function register() { public function registerHooks() { $container = $this->getContainer(); - $container->query('UserHooks')->register(); + $container->get('UserHooks')->register(); } } \ No newline at end of file diff --git a/lib/Controller/ConfigController.php b/lib/Controller/ConfigController.php index 58c47db..cf1ff48 100644 --- a/lib/Controller/ConfigController.php +++ b/lib/Controller/ConfigController.php @@ -12,6 +12,7 @@ use OCP\ILogger; use OCP\IRequest; use OCP\IUserSession; +use Psr\Log\LoggerInterface; class ConfigController extends OCSController { @@ -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; diff --git a/lib/Controller/RecentController.php b/lib/Controller/RecentController.php index 0ebe900..b3aea8c 100644 --- a/lib/Controller/RecentController.php +++ b/lib/Controller/RecentController.php @@ -17,6 +17,7 @@ use OCA\FileUploadNotification\Db\FileUpdateMapper; use OCA\FileUploadNotification\Db\FileCacheExtendedMapper; +use Psr\Log\LoggerInterface; class RecentController extends OCSController { @@ -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; diff --git a/tests/Controller/ConfigControllerTest.php b/tests/Controller/ConfigControllerTest.php index e2101ca..38ac717 100644 --- a/tests/Controller/ConfigControllerTest.php +++ b/tests/Controller/ConfigControllerTest.php @@ -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; @@ -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 { diff --git a/tests/Controller/RecentControllerTest.php b/tests/Controller/RecentControllerTest.php index 943e04b..6e1bbf6 100644 --- a/tests/Controller/RecentControllerTest.php +++ b/tests/Controller/RecentControllerTest.php @@ -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; @@ -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 { From 992d998b7cf9b29d30fb2a8853e0c651c3b4a209 Mon Sep 17 00:00:00 2001 From: ndnhat Date: Tue, 28 Feb 2023 09:55:42 +0700 Subject: [PATCH 2/4] =?UTF-8?q?refs=20(B)1.5=20[=E6=A9=9F=E9=96=A2?= =?UTF-8?q?=E3=82=B9=E3=83=88=E3=83=AC=E3=83=BC=E3=82=B8]=E6=9C=80?= =?UTF-8?q?=E6=96=B0=E3=83=90=E3=83=BC=E3=82=B8=E3=83=A7=E3=83=B3=E3=81=B8?= =?UTF-8?q?=E3=81=AE=E5=AF=BE=E5=BF=9C:=20Travis=20CI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index b19b76b..5c37ce1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: php php: - - '7.4' + - '8.1' env: global: @@ -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 From 49d5095f17e6101550677aef4ca5dec291daa829 Mon Sep 17 00:00:00 2001 From: ndnhat Date: Fri, 17 Mar 2023 20:53:29 +0700 Subject: [PATCH 3/4] =?UTF-8?q?refs=20(B)1.6=20[=E6=A9=9F=E9=96=A2?= =?UTF-8?q?=E3=82=B9=E3=83=88=E3=83=AC=E3=83=BC=E3=82=B8]=E6=9C=80?= =?UTF-8?q?=E6=96=B0=E3=83=90=E3=83=BC=E3=82=B8=E3=83=A7=E3=83=B3=E3=81=B8?= =?UTF-8?q?=E3=81=AE=E5=AF=BE=E5=BF=9C:=20Fix=20bug=20IT=20-=20Fix=20error?= =?UTF-8?q?=20occurs=20when=20no=20file=20uploaded=20sine=20specify=20time?= =?UTF-8?q?.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/Controller/RecentController.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/Controller/RecentController.php b/lib/Controller/RecentController.php index b3aea8c..04f7fa3 100644 --- a/lib/Controller/RecentController.php +++ b/lib/Controller/RecentController.php @@ -1,4 +1,4 @@ -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, From 4d59db8c906261f6ebb3edd2993eccda6ac2fd5c Mon Sep 17 00:00:00 2001 From: ndnhat Date: Wed, 5 Apr 2023 09:52:55 +0700 Subject: [PATCH 4/4] =?UTF-8?q?refs=20(B)1.6=20[=E6=A9=9F=E9=96=A2?= =?UTF-8?q?=E3=82=B9=E3=83=88=E3=83=AC=E3=83=BC=E3=82=B8]=E6=9C=80?= =?UTF-8?q?=E6=96=B0=E3=83=90=E3=83=BC=E3=82=B8=E3=83=A7=E3=83=B3=E3=81=B8?= =?UTF-8?q?=E3=81=AE=E5=AF=BE=E5=BF=9C:=20Fix=20Travis=20CI:=20Change=20fi?= =?UTF-8?q?le=20encoding=20to=20UTF8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/Controller/RecentController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Controller/RecentController.php b/lib/Controller/RecentController.php index 04f7fa3..2a34a4f 100644 --- a/lib/Controller/RecentController.php +++ b/lib/Controller/RecentController.php @@ -1,4 +1,4 @@ -