@@ -36,44 +36,44 @@ |
||
36 | 36 | |
37 | 37 | class SetTokenExpiration implements IRepairStep { |
38 | 38 | |
39 | - /** @var IDBConnection */ |
|
40 | - private $connection; |
|
39 | + /** @var IDBConnection */ |
|
40 | + private $connection; |
|
41 | 41 | |
42 | - /** @var ITimeFactory */ |
|
43 | - private $time; |
|
42 | + /** @var ITimeFactory */ |
|
43 | + private $time; |
|
44 | 44 | |
45 | - /** @var TokenProvider */ |
|
46 | - private $tokenProvider; |
|
45 | + /** @var TokenProvider */ |
|
46 | + private $tokenProvider; |
|
47 | 47 | |
48 | - public function __construct(IDBConnection $connection, |
|
49 | - ITimeFactory $timeFactory, |
|
50 | - TokenProvider $tokenProvider) { |
|
51 | - $this->connection = $connection; |
|
52 | - $this->time = $timeFactory; |
|
53 | - $this->tokenProvider = $tokenProvider; |
|
54 | - } |
|
48 | + public function __construct(IDBConnection $connection, |
|
49 | + ITimeFactory $timeFactory, |
|
50 | + TokenProvider $tokenProvider) { |
|
51 | + $this->connection = $connection; |
|
52 | + $this->time = $timeFactory; |
|
53 | + $this->tokenProvider = $tokenProvider; |
|
54 | + } |
|
55 | 55 | |
56 | - public function getName(): string { |
|
57 | - return 'Update OAuth token expiration times'; |
|
58 | - } |
|
56 | + public function getName(): string { |
|
57 | + return 'Update OAuth token expiration times'; |
|
58 | + } |
|
59 | 59 | |
60 | - public function run(IOutput $output) { |
|
61 | - $qb = $this->connection->getQueryBuilder(); |
|
62 | - $qb->select('*') |
|
63 | - ->from('oauth2_access_tokens'); |
|
60 | + public function run(IOutput $output) { |
|
61 | + $qb = $this->connection->getQueryBuilder(); |
|
62 | + $qb->select('*') |
|
63 | + ->from('oauth2_access_tokens'); |
|
64 | 64 | |
65 | - $cursor = $qb->execute(); |
|
65 | + $cursor = $qb->execute(); |
|
66 | 66 | |
67 | - while ($row = $cursor->fetch()) { |
|
68 | - $token = AccessToken::fromRow($row); |
|
69 | - try { |
|
70 | - $appToken = $this->tokenProvider->getTokenById($token->getTokenId()); |
|
71 | - $appToken->setExpires($this->time->getTime() + 3600); |
|
72 | - $this->tokenProvider->updateToken($appToken); |
|
73 | - } catch (InvalidTokenException $e) { |
|
74 | - //Skip this token |
|
75 | - } |
|
76 | - } |
|
77 | - $cursor->closeCursor(); |
|
78 | - } |
|
67 | + while ($row = $cursor->fetch()) { |
|
68 | + $token = AccessToken::fromRow($row); |
|
69 | + try { |
|
70 | + $appToken = $this->tokenProvider->getTokenById($token->getTokenId()); |
|
71 | + $appToken->setExpires($this->time->getTime() + 3600); |
|
72 | + $this->tokenProvider->updateToken($appToken); |
|
73 | + } catch (InvalidTokenException $e) { |
|
74 | + //Skip this token |
|
75 | + } |
|
76 | + } |
|
77 | + $cursor->closeCursor(); |
|
78 | + } |
|
79 | 79 | } |
@@ -35,99 +35,99 @@ |
||
35 | 35 | use OCP\IUser; |
36 | 36 | |
37 | 37 | class LegacyTrashBackend implements ITrashBackend { |
38 | - /** @var array */ |
|
39 | - private $deletedFiles = []; |
|
38 | + /** @var array */ |
|
39 | + private $deletedFiles = []; |
|
40 | 40 | |
41 | - /** @var IRootFolder */ |
|
42 | - private $rootFolder; |
|
41 | + /** @var IRootFolder */ |
|
42 | + private $rootFolder; |
|
43 | 43 | |
44 | - public function __construct(IRootFolder $rootFolder) { |
|
45 | - $this->rootFolder = $rootFolder; |
|
46 | - } |
|
44 | + public function __construct(IRootFolder $rootFolder) { |
|
45 | + $this->rootFolder = $rootFolder; |
|
46 | + } |
|
47 | 47 | |
48 | - /** |
|
49 | - * @param array $items |
|
50 | - * @param IUser $user |
|
51 | - * @param ITrashItem $parent |
|
52 | - * @return ITrashItem[] |
|
53 | - */ |
|
54 | - private function mapTrashItems(array $items, IUser $user, ITrashItem $parent = null): array { |
|
55 | - $parentTrashPath = ($parent instanceof ITrashItem) ? $parent->getTrashPath() : ''; |
|
56 | - $isRoot = $parent === null; |
|
57 | - return array_map(function (FileInfo $file) use ($parent, $parentTrashPath, $isRoot, $user) { |
|
58 | - $originalLocation = $isRoot ? $file['extraData'] : $parent->getOriginalLocation() . '/' . $file->getName(); |
|
59 | - if (!$originalLocation) { |
|
60 | - $originalLocation = $file->getName(); |
|
61 | - } |
|
62 | - return new TrashItem( |
|
63 | - $this, |
|
64 | - $originalLocation, |
|
65 | - $file->getMTime(), |
|
66 | - $parentTrashPath . '/' . $file->getName() . ($isRoot ? '.d' . $file->getMtime() : ''), |
|
67 | - $file, |
|
68 | - $user |
|
69 | - ); |
|
70 | - }, $items); |
|
71 | - } |
|
48 | + /** |
|
49 | + * @param array $items |
|
50 | + * @param IUser $user |
|
51 | + * @param ITrashItem $parent |
|
52 | + * @return ITrashItem[] |
|
53 | + */ |
|
54 | + private function mapTrashItems(array $items, IUser $user, ITrashItem $parent = null): array { |
|
55 | + $parentTrashPath = ($parent instanceof ITrashItem) ? $parent->getTrashPath() : ''; |
|
56 | + $isRoot = $parent === null; |
|
57 | + return array_map(function (FileInfo $file) use ($parent, $parentTrashPath, $isRoot, $user) { |
|
58 | + $originalLocation = $isRoot ? $file['extraData'] : $parent->getOriginalLocation() . '/' . $file->getName(); |
|
59 | + if (!$originalLocation) { |
|
60 | + $originalLocation = $file->getName(); |
|
61 | + } |
|
62 | + return new TrashItem( |
|
63 | + $this, |
|
64 | + $originalLocation, |
|
65 | + $file->getMTime(), |
|
66 | + $parentTrashPath . '/' . $file->getName() . ($isRoot ? '.d' . $file->getMtime() : ''), |
|
67 | + $file, |
|
68 | + $user |
|
69 | + ); |
|
70 | + }, $items); |
|
71 | + } |
|
72 | 72 | |
73 | - public function listTrashRoot(IUser $user): array { |
|
74 | - $entries = Helper::getTrashFiles('/', $user->getUID()); |
|
75 | - return $this->mapTrashItems($entries, $user); |
|
76 | - } |
|
73 | + public function listTrashRoot(IUser $user): array { |
|
74 | + $entries = Helper::getTrashFiles('/', $user->getUID()); |
|
75 | + return $this->mapTrashItems($entries, $user); |
|
76 | + } |
|
77 | 77 | |
78 | - public function listTrashFolder(ITrashItem $folder): array { |
|
79 | - $user = $folder->getUser(); |
|
80 | - $entries = Helper::getTrashFiles($folder->getTrashPath(), $user->getUID()); |
|
81 | - return $this->mapTrashItems($entries, $user ,$folder); |
|
82 | - } |
|
78 | + public function listTrashFolder(ITrashItem $folder): array { |
|
79 | + $user = $folder->getUser(); |
|
80 | + $entries = Helper::getTrashFiles($folder->getTrashPath(), $user->getUID()); |
|
81 | + return $this->mapTrashItems($entries, $user ,$folder); |
|
82 | + } |
|
83 | 83 | |
84 | - public function restoreItem(ITrashItem $item) { |
|
85 | - Trashbin::restore($item->getTrashPath(), $item->getName(), $item->isRootItem() ? $item->getDeletedTime() : null); |
|
86 | - } |
|
84 | + public function restoreItem(ITrashItem $item) { |
|
85 | + Trashbin::restore($item->getTrashPath(), $item->getName(), $item->isRootItem() ? $item->getDeletedTime() : null); |
|
86 | + } |
|
87 | 87 | |
88 | - public function removeItem(ITrashItem $item) { |
|
89 | - $user = $item->getUser(); |
|
90 | - if ($item->isRootItem()) { |
|
91 | - $path = substr($item->getTrashPath(), 0, -strlen('.d' . $item->getDeletedTime())); |
|
92 | - Trashbin::delete($path, $user->getUID(), $item->getDeletedTime()); |
|
93 | - } else { |
|
94 | - Trashbin::delete($item->getTrashPath(), $user->getUID(), null); |
|
95 | - } |
|
96 | - } |
|
88 | + public function removeItem(ITrashItem $item) { |
|
89 | + $user = $item->getUser(); |
|
90 | + if ($item->isRootItem()) { |
|
91 | + $path = substr($item->getTrashPath(), 0, -strlen('.d' . $item->getDeletedTime())); |
|
92 | + Trashbin::delete($path, $user->getUID(), $item->getDeletedTime()); |
|
93 | + } else { |
|
94 | + Trashbin::delete($item->getTrashPath(), $user->getUID(), null); |
|
95 | + } |
|
96 | + } |
|
97 | 97 | |
98 | - public function moveToTrash(IStorage $storage, string $internalPath): bool { |
|
99 | - if (!$storage instanceof Storage) { |
|
100 | - return false; |
|
101 | - } |
|
102 | - $normalized = Filesystem::normalizePath($storage->getMountPoint() . '/' . $internalPath, true, false, true); |
|
103 | - $view = Filesystem::getView(); |
|
104 | - if (!isset($this->deletedFiles[$normalized]) && $view instanceof View) { |
|
105 | - $this->deletedFiles[$normalized] = $normalized; |
|
106 | - if ($filesPath = $view->getRelativePath($normalized)) { |
|
107 | - $filesPath = trim($filesPath, '/'); |
|
108 | - $result = \OCA\Files_Trashbin\Trashbin::move2trash($filesPath); |
|
109 | - } else { |
|
110 | - $result = false; |
|
111 | - } |
|
112 | - unset($this->deletedFiles[$normalized]); |
|
113 | - } else { |
|
114 | - $result = false; |
|
115 | - } |
|
98 | + public function moveToTrash(IStorage $storage, string $internalPath): bool { |
|
99 | + if (!$storage instanceof Storage) { |
|
100 | + return false; |
|
101 | + } |
|
102 | + $normalized = Filesystem::normalizePath($storage->getMountPoint() . '/' . $internalPath, true, false, true); |
|
103 | + $view = Filesystem::getView(); |
|
104 | + if (!isset($this->deletedFiles[$normalized]) && $view instanceof View) { |
|
105 | + $this->deletedFiles[$normalized] = $normalized; |
|
106 | + if ($filesPath = $view->getRelativePath($normalized)) { |
|
107 | + $filesPath = trim($filesPath, '/'); |
|
108 | + $result = \OCA\Files_Trashbin\Trashbin::move2trash($filesPath); |
|
109 | + } else { |
|
110 | + $result = false; |
|
111 | + } |
|
112 | + unset($this->deletedFiles[$normalized]); |
|
113 | + } else { |
|
114 | + $result = false; |
|
115 | + } |
|
116 | 116 | |
117 | - return $result; |
|
118 | - } |
|
117 | + return $result; |
|
118 | + } |
|
119 | 119 | |
120 | - public function getTrashNodeById(IUser $user, int $fileId) { |
|
121 | - try { |
|
122 | - $userFolder = $this->rootFolder->getUserFolder($user->getUID()); |
|
123 | - $trash = $userFolder->getParent()->get('files_trashbin/files'); |
|
124 | - $trashFiles = $trash->getById($fileId); |
|
125 | - if (!$trashFiles) { |
|
126 | - return null; |
|
127 | - } |
|
128 | - return $trashFiles ? array_pop($trashFiles) : null; |
|
129 | - } catch (NotFoundException $e) { |
|
130 | - return null; |
|
131 | - } |
|
132 | - } |
|
120 | + public function getTrashNodeById(IUser $user, int $fileId) { |
|
121 | + try { |
|
122 | + $userFolder = $this->rootFolder->getUserFolder($user->getUID()); |
|
123 | + $trash = $userFolder->getParent()->get('files_trashbin/files'); |
|
124 | + $trashFiles = $trash->getById($fileId); |
|
125 | + if (!$trashFiles) { |
|
126 | + return null; |
|
127 | + } |
|
128 | + return $trashFiles ? array_pop($trashFiles) : null; |
|
129 | + } catch (NotFoundException $e) { |
|
130 | + return null; |
|
131 | + } |
|
132 | + } |
|
133 | 133 | } |
@@ -28,42 +28,42 @@ |
||
28 | 28 | use OCP\Migration\SimpleMigrationStep; |
29 | 29 | |
30 | 30 | class Version14000Date20180626223656 extends SimpleMigrationStep { |
31 | - public function changeSchema(\OCP\Migration\IOutput $output, \Closure $schemaClosure, array $options) { |
|
32 | - /** @var ISchemaWrapper $schema */ |
|
33 | - $schema = $schemaClosure(); |
|
34 | - if (!$schema->hasTable('whats_new')) { |
|
35 | - $table = $schema->createTable('whats_new'); |
|
36 | - $table->addColumn('id', 'integer', [ |
|
37 | - 'autoincrement' => true, |
|
38 | - 'notnull' => true, |
|
39 | - 'length' => 4, |
|
40 | - 'unsigned' => true, |
|
41 | - ]); |
|
42 | - $table->addColumn('version', 'string', [ |
|
43 | - 'notnull' => true, |
|
44 | - 'length' => 64, |
|
45 | - 'default' => '11', |
|
46 | - ]); |
|
47 | - $table->addColumn('etag', 'string', [ |
|
48 | - 'notnull' => true, |
|
49 | - 'length' => 64, |
|
50 | - 'default' => '', |
|
51 | - ]); |
|
52 | - $table->addColumn('last_check', 'integer', [ |
|
53 | - 'notnull' => true, |
|
54 | - 'length' => 4, |
|
55 | - 'unsigned' => true, |
|
56 | - 'default' => 0, |
|
57 | - ]); |
|
58 | - $table->addColumn('data', 'text', [ |
|
59 | - 'notnull' => true, |
|
60 | - 'default' => '', |
|
61 | - ]); |
|
62 | - $table->setPrimaryKey(['id']); |
|
63 | - $table->addUniqueIndex(['version'], 'version'); |
|
64 | - $table->addIndex(['version', 'etag'], 'version_etag_idx'); |
|
65 | - } |
|
31 | + public function changeSchema(\OCP\Migration\IOutput $output, \Closure $schemaClosure, array $options) { |
|
32 | + /** @var ISchemaWrapper $schema */ |
|
33 | + $schema = $schemaClosure(); |
|
34 | + if (!$schema->hasTable('whats_new')) { |
|
35 | + $table = $schema->createTable('whats_new'); |
|
36 | + $table->addColumn('id', 'integer', [ |
|
37 | + 'autoincrement' => true, |
|
38 | + 'notnull' => true, |
|
39 | + 'length' => 4, |
|
40 | + 'unsigned' => true, |
|
41 | + ]); |
|
42 | + $table->addColumn('version', 'string', [ |
|
43 | + 'notnull' => true, |
|
44 | + 'length' => 64, |
|
45 | + 'default' => '11', |
|
46 | + ]); |
|
47 | + $table->addColumn('etag', 'string', [ |
|
48 | + 'notnull' => true, |
|
49 | + 'length' => 64, |
|
50 | + 'default' => '', |
|
51 | + ]); |
|
52 | + $table->addColumn('last_check', 'integer', [ |
|
53 | + 'notnull' => true, |
|
54 | + 'length' => 4, |
|
55 | + 'unsigned' => true, |
|
56 | + 'default' => 0, |
|
57 | + ]); |
|
58 | + $table->addColumn('data', 'text', [ |
|
59 | + 'notnull' => true, |
|
60 | + 'default' => '', |
|
61 | + ]); |
|
62 | + $table->setPrimaryKey(['id']); |
|
63 | + $table->addUniqueIndex(['version'], 'version'); |
|
64 | + $table->addIndex(['version', 'etag'], 'version_etag_idx'); |
|
65 | + } |
|
66 | 66 | |
67 | - return $schema; |
|
68 | - } |
|
67 | + return $schema; |
|
68 | + } |
|
69 | 69 | } |
@@ -10,36 +10,36 @@ |
||
10 | 10 | use OCP\Migration\SimpleMigrationStep; |
11 | 11 | |
12 | 12 | class Version19000Date20200211083441 extends SimpleMigrationStep { |
13 | - public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { |
|
14 | - /** @var ISchemaWrapper $schema */ |
|
15 | - $schema = $schemaClosure(); |
|
13 | + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { |
|
14 | + /** @var ISchemaWrapper $schema */ |
|
15 | + $schema = $schemaClosure(); |
|
16 | 16 | |
17 | - if (!$schema->hasTable('webauthn')) { |
|
18 | - $table = $schema->createTable('webauthn'); |
|
19 | - $table->addColumn('id', 'integer', [ |
|
20 | - 'autoincrement' => true, |
|
21 | - 'notnull' => true, |
|
22 | - 'length' => 64, |
|
23 | - ]); |
|
24 | - $table->addColumn('uid', 'string', [ |
|
25 | - 'notnull' => true, |
|
26 | - 'length' => 64, |
|
27 | - ]); |
|
28 | - $table->addColumn('name', 'string', [ |
|
29 | - 'notnull' => true, |
|
30 | - 'length' => 64, |
|
31 | - ]); |
|
32 | - $table->addColumn('public_key_credential_id', 'string', [ |
|
33 | - 'notnull' => true, |
|
34 | - 'length' => 255 |
|
35 | - ]); |
|
36 | - $table->addColumn('data', 'text', [ |
|
37 | - 'notnull' => true, |
|
38 | - ]); |
|
39 | - $table->setPrimaryKey(['id']); |
|
40 | - $table->addIndex(['uid'], 'webauthn_uid'); |
|
41 | - $table->addIndex(['public_key_credential_id'], 'webauthn_publicKeyCredentialId'); |
|
42 | - } |
|
43 | - return $schema; |
|
44 | - } |
|
17 | + if (!$schema->hasTable('webauthn')) { |
|
18 | + $table = $schema->createTable('webauthn'); |
|
19 | + $table->addColumn('id', 'integer', [ |
|
20 | + 'autoincrement' => true, |
|
21 | + 'notnull' => true, |
|
22 | + 'length' => 64, |
|
23 | + ]); |
|
24 | + $table->addColumn('uid', 'string', [ |
|
25 | + 'notnull' => true, |
|
26 | + 'length' => 64, |
|
27 | + ]); |
|
28 | + $table->addColumn('name', 'string', [ |
|
29 | + 'notnull' => true, |
|
30 | + 'length' => 64, |
|
31 | + ]); |
|
32 | + $table->addColumn('public_key_credential_id', 'string', [ |
|
33 | + 'notnull' => true, |
|
34 | + 'length' => 255 |
|
35 | + ]); |
|
36 | + $table->addColumn('data', 'text', [ |
|
37 | + 'notnull' => true, |
|
38 | + ]); |
|
39 | + $table->setPrimaryKey(['id']); |
|
40 | + $table->addIndex(['uid'], 'webauthn_uid'); |
|
41 | + $table->addIndex(['public_key_credential_id'], 'webauthn_publicKeyCredentialId'); |
|
42 | + } |
|
43 | + return $schema; |
|
44 | + } |
|
45 | 45 | } |
@@ -33,31 +33,31 @@ |
||
33 | 33 | use OCP\Migration\SimpleMigrationStep; |
34 | 34 | |
35 | 35 | class Version14000Date20180522074438 extends SimpleMigrationStep { |
36 | - public function changeSchema(IOutput $output, Closure $schemaClosure, |
|
37 | - array $options): ISchemaWrapper { |
|
38 | - $schema = $schemaClosure(); |
|
36 | + public function changeSchema(IOutput $output, Closure $schemaClosure, |
|
37 | + array $options): ISchemaWrapper { |
|
38 | + $schema = $schemaClosure(); |
|
39 | 39 | |
40 | - if (!$schema->hasTable('twofactor_providers')) { |
|
41 | - $table = $schema->createTable('twofactor_providers'); |
|
42 | - $table->addColumn('provider_id', 'string', |
|
43 | - [ |
|
44 | - 'notnull' => true, |
|
45 | - 'length' => 32, |
|
46 | - ]); |
|
47 | - $table->addColumn('uid', 'string', |
|
48 | - [ |
|
49 | - 'notnull' => true, |
|
50 | - 'length' => 64, |
|
51 | - ]); |
|
52 | - $table->addColumn('enabled', 'smallint', |
|
53 | - [ |
|
54 | - 'notnull' => true, |
|
55 | - 'length' => 1, |
|
56 | - ]); |
|
57 | - $table->setPrimaryKey(['provider_id', 'uid']); |
|
58 | - $table->addIndex(['uid'], 'twofactor_providers_uid'); |
|
59 | - } |
|
40 | + if (!$schema->hasTable('twofactor_providers')) { |
|
41 | + $table = $schema->createTable('twofactor_providers'); |
|
42 | + $table->addColumn('provider_id', 'string', |
|
43 | + [ |
|
44 | + 'notnull' => true, |
|
45 | + 'length' => 32, |
|
46 | + ]); |
|
47 | + $table->addColumn('uid', 'string', |
|
48 | + [ |
|
49 | + 'notnull' => true, |
|
50 | + 'length' => 64, |
|
51 | + ]); |
|
52 | + $table->addColumn('enabled', 'smallint', |
|
53 | + [ |
|
54 | + 'notnull' => true, |
|
55 | + 'length' => 1, |
|
56 | + ]); |
|
57 | + $table->setPrimaryKey(['provider_id', 'uid']); |
|
58 | + $table->addIndex(['uid'], 'twofactor_providers_uid'); |
|
59 | + } |
|
60 | 60 | |
61 | - return $schema; |
|
62 | - } |
|
61 | + return $schema; |
|
62 | + } |
|
63 | 63 | } |
@@ -28,56 +28,56 @@ |
||
28 | 28 | * @since 9.0.0 |
29 | 29 | */ |
30 | 30 | interface IWatcher { |
31 | - public const CHECK_NEVER = 0; // never check the underlying filesystem for updates |
|
32 | - public const CHECK_ONCE = 1; // check the underlying filesystem for updates once every request for each file |
|
33 | - public const CHECK_ALWAYS = 2; // always check the underlying filesystem for updates |
|
31 | + public const CHECK_NEVER = 0; // never check the underlying filesystem for updates |
|
32 | + public const CHECK_ONCE = 1; // check the underlying filesystem for updates once every request for each file |
|
33 | + public const CHECK_ALWAYS = 2; // always check the underlying filesystem for updates |
|
34 | 34 | |
35 | - /** |
|
36 | - * @param int $policy either IWatcher::CHECK_NEVER, IWatcher::CHECK_ONCE, IWatcher::CHECK_ALWAYS |
|
37 | - * @since 9.0.0 |
|
38 | - */ |
|
39 | - public function setPolicy($policy); |
|
35 | + /** |
|
36 | + * @param int $policy either IWatcher::CHECK_NEVER, IWatcher::CHECK_ONCE, IWatcher::CHECK_ALWAYS |
|
37 | + * @since 9.0.0 |
|
38 | + */ |
|
39 | + public function setPolicy($policy); |
|
40 | 40 | |
41 | - /** |
|
42 | - * @return int either IWatcher::CHECK_NEVER, IWatcher::CHECK_ONCE, IWatcher::CHECK_ALWAYS |
|
43 | - * @since 9.0.0 |
|
44 | - */ |
|
45 | - public function getPolicy(); |
|
41 | + /** |
|
42 | + * @return int either IWatcher::CHECK_NEVER, IWatcher::CHECK_ONCE, IWatcher::CHECK_ALWAYS |
|
43 | + * @since 9.0.0 |
|
44 | + */ |
|
45 | + public function getPolicy(); |
|
46 | 46 | |
47 | - /** |
|
48 | - * check $path for updates and update if needed |
|
49 | - * |
|
50 | - * @param string $path |
|
51 | - * @param ICacheEntry|null $cachedEntry |
|
52 | - * @return boolean true if path was updated |
|
53 | - * @since 9.0.0 |
|
54 | - */ |
|
55 | - public function checkUpdate($path, $cachedEntry = null); |
|
47 | + /** |
|
48 | + * check $path for updates and update if needed |
|
49 | + * |
|
50 | + * @param string $path |
|
51 | + * @param ICacheEntry|null $cachedEntry |
|
52 | + * @return boolean true if path was updated |
|
53 | + * @since 9.0.0 |
|
54 | + */ |
|
55 | + public function checkUpdate($path, $cachedEntry = null); |
|
56 | 56 | |
57 | - /** |
|
58 | - * Update the cache for changes to $path |
|
59 | - * |
|
60 | - * @param string $path |
|
61 | - * @param ICacheEntry $cachedData |
|
62 | - * @since 9.0.0 |
|
63 | - */ |
|
64 | - public function update($path, $cachedData); |
|
57 | + /** |
|
58 | + * Update the cache for changes to $path |
|
59 | + * |
|
60 | + * @param string $path |
|
61 | + * @param ICacheEntry $cachedData |
|
62 | + * @since 9.0.0 |
|
63 | + */ |
|
64 | + public function update($path, $cachedData); |
|
65 | 65 | |
66 | - /** |
|
67 | - * Check if the cache for $path needs to be updated |
|
68 | - * |
|
69 | - * @param string $path |
|
70 | - * @param ICacheEntry $cachedData |
|
71 | - * @return bool |
|
72 | - * @since 9.0.0 |
|
73 | - */ |
|
74 | - public function needsUpdate($path, $cachedData); |
|
66 | + /** |
|
67 | + * Check if the cache for $path needs to be updated |
|
68 | + * |
|
69 | + * @param string $path |
|
70 | + * @param ICacheEntry $cachedData |
|
71 | + * @return bool |
|
72 | + * @since 9.0.0 |
|
73 | + */ |
|
74 | + public function needsUpdate($path, $cachedData); |
|
75 | 75 | |
76 | - /** |
|
77 | - * remove deleted files in $path from the cache |
|
78 | - * |
|
79 | - * @param string $path |
|
80 | - * @since 9.0.0 |
|
81 | - */ |
|
82 | - public function cleanFolder($path); |
|
76 | + /** |
|
77 | + * remove deleted files in $path from the cache |
|
78 | + * |
|
79 | + * @param string $path |
|
80 | + * @since 9.0.0 |
|
81 | + */ |
|
82 | + public function cleanFolder($path); |
|
83 | 83 | } |
@@ -29,28 +29,28 @@ |
||
29 | 29 | * @since 12.0.0 |
30 | 30 | */ |
31 | 31 | interface IChange { |
32 | - public const ADDED = 1; |
|
33 | - public const REMOVED = 2; |
|
34 | - public const MODIFIED = 3; |
|
35 | - public const RENAMED = 4; |
|
32 | + public const ADDED = 1; |
|
33 | + public const REMOVED = 2; |
|
34 | + public const MODIFIED = 3; |
|
35 | + public const RENAMED = 4; |
|
36 | 36 | |
37 | - /** |
|
38 | - * Get the type of the change |
|
39 | - * |
|
40 | - * @return int IChange::ADDED, IChange::REMOVED, IChange::MODIFIED or IChange::RENAMED |
|
41 | - * |
|
42 | - * @since 12.0.0 |
|
43 | - */ |
|
44 | - public function getType(); |
|
37 | + /** |
|
38 | + * Get the type of the change |
|
39 | + * |
|
40 | + * @return int IChange::ADDED, IChange::REMOVED, IChange::MODIFIED or IChange::RENAMED |
|
41 | + * |
|
42 | + * @since 12.0.0 |
|
43 | + */ |
|
44 | + public function getType(); |
|
45 | 45 | |
46 | - /** |
|
47 | - * Get the path of the file that was changed relative to the root of the storage |
|
48 | - * |
|
49 | - * Note, for rename changes this path is the old path for the file |
|
50 | - * |
|
51 | - * @return mixed |
|
52 | - * |
|
53 | - * @since 12.0.0 |
|
54 | - */ |
|
55 | - public function getPath(); |
|
46 | + /** |
|
47 | + * Get the path of the file that was changed relative to the root of the storage |
|
48 | + * |
|
49 | + * Note, for rename changes this path is the old path for the file |
|
50 | + * |
|
51 | + * @return mixed |
|
52 | + * |
|
53 | + * @since 12.0.0 |
|
54 | + */ |
|
55 | + public function getPath(); |
|
56 | 56 | } |
@@ -44,50 +44,50 @@ |
||
44 | 44 | * @since 6.0.0 - since 8.2.1 based on HintException |
45 | 45 | */ |
46 | 46 | class StorageNotAvailableException extends HintException { |
47 | - public const STATUS_SUCCESS = 0; |
|
48 | - public const STATUS_ERROR = 1; |
|
49 | - public const STATUS_INDETERMINATE = 2; |
|
50 | - public const STATUS_INCOMPLETE_CONF = 3; |
|
51 | - public const STATUS_UNAUTHORIZED = 4; |
|
52 | - public const STATUS_TIMEOUT = 5; |
|
53 | - public const STATUS_NETWORK_ERROR = 6; |
|
47 | + public const STATUS_SUCCESS = 0; |
|
48 | + public const STATUS_ERROR = 1; |
|
49 | + public const STATUS_INDETERMINATE = 2; |
|
50 | + public const STATUS_INCOMPLETE_CONF = 3; |
|
51 | + public const STATUS_UNAUTHORIZED = 4; |
|
52 | + public const STATUS_TIMEOUT = 5; |
|
53 | + public const STATUS_NETWORK_ERROR = 6; |
|
54 | 54 | |
55 | - /** |
|
56 | - * StorageNotAvailableException constructor. |
|
57 | - * |
|
58 | - * @param string $message |
|
59 | - * @param int $code |
|
60 | - * @param \Exception|null $previous |
|
61 | - * @since 6.0.0 |
|
62 | - */ |
|
63 | - public function __construct($message = '', $code = self::STATUS_ERROR, \Exception $previous = null) { |
|
64 | - $l = \OC::$server->getL10N('core'); |
|
65 | - parent::__construct($message, $l->t('Storage is temporarily not available'), $code, $previous); |
|
66 | - } |
|
55 | + /** |
|
56 | + * StorageNotAvailableException constructor. |
|
57 | + * |
|
58 | + * @param string $message |
|
59 | + * @param int $code |
|
60 | + * @param \Exception|null $previous |
|
61 | + * @since 6.0.0 |
|
62 | + */ |
|
63 | + public function __construct($message = '', $code = self::STATUS_ERROR, \Exception $previous = null) { |
|
64 | + $l = \OC::$server->getL10N('core'); |
|
65 | + parent::__construct($message, $l->t('Storage is temporarily not available'), $code, $previous); |
|
66 | + } |
|
67 | 67 | |
68 | - /** |
|
69 | - * Get the name for a status code |
|
70 | - * |
|
71 | - * @param int $code |
|
72 | - * @return string |
|
73 | - * @since 9.0.0 |
|
74 | - */ |
|
75 | - public static function getStateCodeName($code) { |
|
76 | - switch ($code) { |
|
77 | - case self::STATUS_SUCCESS: |
|
78 | - return 'ok'; |
|
79 | - case self::STATUS_ERROR: |
|
80 | - return 'error'; |
|
81 | - case self::STATUS_INDETERMINATE: |
|
82 | - return 'indeterminate'; |
|
83 | - case self::STATUS_UNAUTHORIZED: |
|
84 | - return 'unauthorized'; |
|
85 | - case self::STATUS_TIMEOUT: |
|
86 | - return 'timeout'; |
|
87 | - case self::STATUS_NETWORK_ERROR: |
|
88 | - return 'network error'; |
|
89 | - default: |
|
90 | - return 'unknown'; |
|
91 | - } |
|
92 | - } |
|
68 | + /** |
|
69 | + * Get the name for a status code |
|
70 | + * |
|
71 | + * @param int $code |
|
72 | + * @return string |
|
73 | + * @since 9.0.0 |
|
74 | + */ |
|
75 | + public static function getStateCodeName($code) { |
|
76 | + switch ($code) { |
|
77 | + case self::STATUS_SUCCESS: |
|
78 | + return 'ok'; |
|
79 | + case self::STATUS_ERROR: |
|
80 | + return 'error'; |
|
81 | + case self::STATUS_INDETERMINATE: |
|
82 | + return 'indeterminate'; |
|
83 | + case self::STATUS_UNAUTHORIZED: |
|
84 | + return 'unauthorized'; |
|
85 | + case self::STATUS_TIMEOUT: |
|
86 | + return 'timeout'; |
|
87 | + case self::STATUS_NETWORK_ERROR: |
|
88 | + return 'network error'; |
|
89 | + default: |
|
90 | + return 'unknown'; |
|
91 | + } |
|
92 | + } |
|
93 | 93 | } |
@@ -27,27 +27,27 @@ |
||
27 | 27 | * @since 12.0.0 |
28 | 28 | */ |
29 | 29 | interface ISearchBinaryOperator extends ISearchOperator { |
30 | - public const OPERATOR_AND = 'and'; |
|
31 | - public const OPERATOR_OR = 'or'; |
|
32 | - public const OPERATOR_NOT = 'not'; |
|
30 | + public const OPERATOR_AND = 'and'; |
|
31 | + public const OPERATOR_OR = 'or'; |
|
32 | + public const OPERATOR_NOT = 'not'; |
|
33 | 33 | |
34 | - /** |
|
35 | - * The type of binary operator |
|
36 | - * |
|
37 | - * One of the ISearchBinaryOperator::OPERATOR_* constants |
|
38 | - * |
|
39 | - * @return string |
|
40 | - * @since 12.0.0 |
|
41 | - */ |
|
42 | - public function getType(); |
|
34 | + /** |
|
35 | + * The type of binary operator |
|
36 | + * |
|
37 | + * One of the ISearchBinaryOperator::OPERATOR_* constants |
|
38 | + * |
|
39 | + * @return string |
|
40 | + * @since 12.0.0 |
|
41 | + */ |
|
42 | + public function getType(); |
|
43 | 43 | |
44 | - /** |
|
45 | - * The arguments for the binary operator |
|
46 | - * |
|
47 | - * One argument for the 'not' operator and two for 'and' and 'or' |
|
48 | - * |
|
49 | - * @return ISearchOperator[] |
|
50 | - * @since 12.0.0 |
|
51 | - */ |
|
52 | - public function getArguments(); |
|
44 | + /** |
|
45 | + * The arguments for the binary operator |
|
46 | + * |
|
47 | + * One argument for the 'not' operator and two for 'and' and 'or' |
|
48 | + * |
|
49 | + * @return ISearchOperator[] |
|
50 | + * @since 12.0.0 |
|
51 | + */ |
|
52 | + public function getArguments(); |
|
53 | 53 | } |