Skip to content

Commit 78b8929

Browse files
Merge pull request #43 from nextcloud/release-20.1.0
removing composer libs
2 parents 5fa8561 + 018d4f2 commit 78b8929

25 files changed

+2568
-204
lines changed

CHANGELOG.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
# Changelog
22

33

4-
5-
### 21.0.0
4+
### 20.1.0
65

76
- compat nc23
87

Makefile

+3-9
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ cert_dir=$(HOME)/.nextcloud/certificates
1010
codecov_token_dir=$(HOME)/.nextcloud/codecov_token
1111
github_account=nextcloud
1212
branch=master
13-
version+=21.0.0
13+
version+=20.1.0
1414

1515
all: appstore
1616

@@ -40,18 +40,15 @@ clean:
4040
rm -rf $(build_dir)
4141
rm -rf node_modules
4242

43-
composer:
44-
composer install --prefer-dist
45-
4643
test: SHELL:=/bin/bash
47-
test: composer
44+
test:
4845
phpunit --coverage-clover=coverage.xml --configuration=tests/phpunit.xml tests
4946
@if [ -f $(codecov_token_dir)/$(app_name) ]; then \
5047
bash <(curl -s https://codecov.io/bash) -t @$(codecov_token_dir)/$(app_name) ; \
5148
fi
5249

5350

54-
appstore: composer clean
51+
appstore: clean
5552
mkdir -p $(sign_dir)
5653
rsync -a \
5754
--exclude=/build \
@@ -61,8 +58,6 @@ appstore: composer clean
6158
--exclude=/tests \
6259
--exclude=.git \
6360
--exclude=/.github \
64-
--exclude=/composer.json \
65-
--exclude=/composer.lock \
6661
--exclude=/l10n/l10n.pl \
6762
--exclude=/CONTRIBUTING.md \
6863
--exclude=/issue_template.md \
@@ -72,7 +67,6 @@ appstore: composer clean
7267
--exclude=/.scrutinizer.yml \
7368
--exclude=/.travis.yml \
7469
--exclude=/Makefile \
75-
--exclude=/vendor/picocms/pico/index.php \
7670
$(project_dir)/ $(sign_dir)/$(app_name)
7771
tar -czf $(build_dir)/$(app_name)-$(version).tar.gz \
7872
-C $(sign_dir) $(app_name)

appinfo/info.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Allow your users to temporary lock their files to avoid conflicts while working
1010
1111
]]>
1212
</description>
13-
<version>21.0.0</version>
13+
<version>20.1.0</version>
1414
<licence>agpl</licence>
1515
<author>Maxence Lange</author>
1616
<namespace>FilesLock</namespace>

composer.json

-15
This file was deleted.

composer.lock

-57
This file was deleted.

lib/AppInfo/Application.php

+4-7
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,6 @@
5252
use Throwable;
5353

5454

55-
require_once __DIR__ . '/../../vendor/autoload.php';
56-
57-
5855
/**
5956
* Class Application
6057
*
@@ -122,7 +119,7 @@ public function registerHooks(IServerContainer $container) {
122119
$this->lockService = $container->get(LockService::class);
123120

124121
$eventDispatcher->addListener(
125-
'OCA\DAV\Connector\Sabre::addPlugin', function(SabrePluginEvent $e) {
122+
'OCA\DAV\Connector\Sabre::addPlugin', function (SabrePluginEvent $e) {
126123
$server = $e->getServer();
127124
$absolute = false;
128125
switch (get_class($server->tree)) {
@@ -152,16 +149,16 @@ public function registerHooks(IServerContainer $container) {
152149
*/
153150
public function addStorageWrapper() {
154151
Filesystem::addStorageWrapper(
155-
'files_lock', function($mountPoint, $storage) {
152+
'files_lock', function ($mountPoint, $storage) {
156153
return new LockWrapper(
157154
[
158-
'storage' => $storage,
155+
'storage' => $storage,
159156
'user_session' => $this->userSession,
160157
'file_service' => $this->fileService,
161158
'lock_service' => $this->lockService
162159
]
163160
);
164-
}, 10
161+
}, 10
165162
);
166163
}
167164

lib/Controller/LockController.php

+36-5
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,13 @@
3030
namespace OCA\FilesLock\Controller;
3131

3232

33-
use daita\MySmallPhpTools\Traits\Nextcloud\TNCDataResponse;
3433
use Exception;
3534
use OCA\FilesLock\AppInfo\Application;
3635
use OCA\FilesLock\Service\FileService;
3736
use OCA\FilesLock\Service\LockService;
37+
use OCA\FilesLock\Tools\Traits\TLogger;
3838
use OCP\AppFramework\Controller;
39+
use OCP\AppFramework\Http;
3940
use OCP\AppFramework\Http\DataResponse;
4041
use OCP\IRequest;
4142
use OCP\IUserSession;
@@ -49,7 +50,7 @@
4950
class LockController extends Controller {
5051

5152

52-
use TNCDataResponse;
53+
use TLogger;
5354

5455

5556
/** @var IUserSession */
@@ -95,7 +96,7 @@ public function locking(string $fileId): DataResponse {
9596

9697
$lock = $this->lockService->lockFile($file, $user);
9798

98-
return $this->directSuccess($lock);
99+
return new DataResponse($lock, Http::STATUS_OK);
99100
} catch (Exception $e) {
100101
return $this->fail($e);
101102
}
@@ -115,11 +116,41 @@ public function unlocking(string $fileId): DataResponse {
115116
$user = $this->userSession->getUser();
116117
$this->lockService->unlockFile((int)$fileId, $user->getUID());
117118

118-
return $this->success();
119+
return new DataResponse();
119120
} catch (Exception $e) {
120121
return $this->fail($e);
121122
}
122123
}
123124

124-
}
125125

126+
/**
127+
* @param Exception $e
128+
* @param array $more
129+
* @param int $status
130+
*
131+
* @param bool $log
132+
*
133+
* @return DataResponse
134+
*/
135+
protected function fail(
136+
Exception $e,
137+
array $more = [],
138+
int $status = Http::STATUS_INTERNAL_SERVER_ERROR,
139+
bool $log = true
140+
): DataResponse {
141+
$data = array_merge(
142+
$more,
143+
[
144+
'status' => -1,
145+
'exception' => get_class($e),
146+
'message' => $e->getMessage()
147+
]
148+
);
149+
150+
if ($log) {
151+
$this->log(2, $status . ' - ' . json_encode($data));
152+
}
153+
154+
return new DataResponse($data, $status);
155+
}
156+
}

lib/Db/LocksQueryBuilder.php lib/Db/CoreQueryBuilder.php

+7-16
Original file line numberDiff line numberDiff line change
@@ -30,39 +30,30 @@
3030
namespace OCA\FilesLock\Db;
3131

3232

33-
use daita\MySmallPhpTools\Db\ExtendedQueryBuilder;
34-
use daita\MySmallPhpTools\IExtendedQueryBuilder;
33+
use OCA\FilesLock\Tools\Db\ExtendedQueryBuilder;
3534

3635

3736
/**
38-
* Class LocksQueryBuilder
3937
*
40-
* @package OCA\FilesLock\Db
4138
*/
42-
class LocksQueryBuilder extends ExtendedQueryBuilder {
39+
class CoreQueryBuilder extends ExtendedQueryBuilder {
4340

4441

4542
/**
4643
* @param int $fileId
4744
*
48-
* @return IExtendedQueryBuilder
45+
* @return CoreQueryBuilder
4946
*/
50-
public function limitToFileId(int $fileId): IExtendedQueryBuilder {
51-
$this->limitToDBFieldInt('file_id', $fileId);
52-
53-
return $this;
47+
public function limitToFileId(int $fileId): void {
48+
$this->limitInt('file_id', $fileId);
5449
}
5550

5651

5752
/**
5853
* @param array $ids
59-
*
60-
* @return IExtendedQueryBuilder
6154
*/
62-
public function limitToIds(array $ids): IExtendedQueryBuilder {
63-
$this->limitToDBFieldArray('id', $ids);
64-
65-
return $this;
55+
public function limitToIds(array $ids): void {
56+
$this->limitArray('id', $ids);
6657
}
6758

6859
}

0 commit comments

Comments
 (0)