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\ChecksumAPI\AppInfo\Application;

$app = \OC::$server->query(Application::class);
$app = \OC::$server->get(Application::class);
$app->register();
50 changes: 0 additions & 50 deletions appinfo/database.xml

This file was deleted.

2 changes: 1 addition & 1 deletion appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
<category>tools</category>
<bugs>https://github.com/RCOSDP/nextcloud-checksum_api/issues</bugs>
<dependencies>
<nextcloud min-version="15" max-version="19" />
<nextcloud min-version="25" max-version="26" />
</dependencies>
</info>
12 changes: 5 additions & 7 deletions lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,11 @@ public function __construct(array $urlParams = []) {
/**
* Controllers
*/
$container->registerService('UserHooks', function() {
$container = $this->getContainer();
$server = $container->getServer();
$container->registerService('UserHooks', function($c) {
return new UserHooks(
$server->getLogger(),
$server->getRootFolder(),
$server->getDatabaseConnection()
$c->get('ServerContainer')->getLogger(),
$c->get('ServerContainer')->getRootFolder(),
$c->get('ServerContainer')->getDatabaseConnection(),
);
});
}
Expand All @@ -34,6 +32,6 @@ public function register() {

public function registerHooks() {
$container = $this->getContainer();
$container->query('UserHooks')->register();
$container->get('UserHooks')->register();
}
}
8 changes: 3 additions & 5 deletions lib/Controller/ChecksumAPIController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@

namespace OCA\ChecksumAPI\Controller;

use OC\Files\Filesystem;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\OCSController;
use OCP\Files\IRootFolder;
use OCP\Files\NotFoundException;
use OCP\IDBConnection;
use OCP\ILogger;
use Psr\Log\LoggerInterface;
use OCP\IRequest;
use OCP\IUserSession;

Expand All @@ -32,7 +30,7 @@ public function __construct($appName,
IRootFolder $rootFolder,
IUserSession $userSession,
HashMapper $mapper,
ILogger $logger) {
LoggerInterface $logger) {
parent::__construct($appName, $request);
$this->rootFolder = $rootFolder;
$this->userSession = $userSession;
Expand Down Expand Up @@ -140,7 +138,7 @@ public function checksum($hash, $path, $revision) {
$this->logger->info('latest version matches');
} else {
// check if version function is enabled
if (!\OCP\App::isEnabled($this->versionAppId)) {
if (!\OC_App::isEnabled($this->versionAppId)) {
$this->logger->error('version function is not enabled');
return new DataResponse(
'version function is not enabled',
Expand Down
2 changes: 1 addition & 1 deletion lib/Hooks/UserHooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
use OCP\Files\IRootFolder;
use OCP\IDBConnection;
use OCP\ILogger;
use OC\Files\Filesystem;
use OC\Files\Node\Node;

use OC\Files\View;
use OCA\ChecksumAPI\Db\HashMapper;

class UserHooks {
Expand Down
2 changes: 1 addition & 1 deletion lib/Migration/Version00001Date20201016095257.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
]);
$table->addColumn('hash', 'string', [
'notnull' => true,
'length' => 64,
'length' => 128,
'default' => '',
]);
$table->setPrimaryKey(['id']);
Expand Down
10 changes: 5 additions & 5 deletions tests/Controller/ChecksumAPIControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataResponse;
use OCP\Files\NotFoundException;
use OCP\ILogger;
use Psr\Log\LoggerInterface;
use OCP\IRequest;
use OCP\IUser;
use OCP\IUserManager;
Expand Down Expand Up @@ -45,7 +45,7 @@ protected function setUp() :void {

$this->mapper = $this->getMockBuilder(HashMapper::class)->disableOriginalConstructor()->getMock();

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

$this->file = $this->getMockBuilder('OCP\Files\File')->disableOriginalConstructor()->getMock();
$this->file->method('getId')->willReturn(1);
Expand Down Expand Up @@ -168,7 +168,7 @@ public function testChecksumVersionAppIsDisabled() :void {
$this->logger
);

$status = \OCP\App::isEnabled($this->versionAppId);
$status = \OC_App::isEnabled($this->versionAppId);
if ($status) {
\OC::$server->getAppManager()->disableApp($this->versionAppId);
}
Expand Down Expand Up @@ -201,7 +201,7 @@ public function testChecksumMatchesNoVersion() :void {
$this->logger
);

$status = \OCP\App::isEnabled($this->versionAppId);
$status = \OC::$server->getAppManager()->isEnabledForUser($this->versionAppId);
if (!$status) {
\OC::$server->getAppManager()->disableApp($this->versionAppId);
}
Expand Down Expand Up @@ -246,7 +246,7 @@ public function testChecksumSucceedWithoutRevision() :void {
$this->logger
);

$status = \OCP\App::isEnabled($this->versionAppId);
$status = \OC::$server->getAppManager()->isEnabledForUser($this->versionAppId);
if (!$status) {
\OC::$server->getAppManager()->disableApp($this->versionAppId);
}
Expand Down