@@ -35,25 +35,25 @@ |
||
35 | 35 | * @package OC\Http |
36 | 36 | */ |
37 | 37 | class ClientService implements IClientService { |
38 | - /** @var IConfig */ |
|
39 | - private $config; |
|
40 | - /** @var ICertificateManager */ |
|
41 | - private $certificateManager; |
|
38 | + /** @var IConfig */ |
|
39 | + private $config; |
|
40 | + /** @var ICertificateManager */ |
|
41 | + private $certificateManager; |
|
42 | 42 | |
43 | - /** |
|
44 | - * @param IConfig $config |
|
45 | - * @param ICertificateManager $certificateManager |
|
46 | - */ |
|
47 | - public function __construct(IConfig $config, |
|
48 | - ICertificateManager $certificateManager) { |
|
49 | - $this->config = $config; |
|
50 | - $this->certificateManager = $certificateManager; |
|
51 | - } |
|
43 | + /** |
|
44 | + * @param IConfig $config |
|
45 | + * @param ICertificateManager $certificateManager |
|
46 | + */ |
|
47 | + public function __construct(IConfig $config, |
|
48 | + ICertificateManager $certificateManager) { |
|
49 | + $this->config = $config; |
|
50 | + $this->certificateManager = $certificateManager; |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * @return Client |
|
55 | - */ |
|
56 | - public function newClient(): IClient { |
|
57 | - return new Client($this->config, $this->certificateManager, new GuzzleClient()); |
|
58 | - } |
|
53 | + /** |
|
54 | + * @return Client |
|
55 | + */ |
|
56 | + public function newClient(): IClient { |
|
57 | + return new Client($this->config, $this->certificateManager, new GuzzleClient()); |
|
58 | + } |
|
59 | 59 | } |
@@ -30,100 +30,100 @@ |
||
30 | 30 | * to release any left over locks at the end of the request |
31 | 31 | */ |
32 | 32 | abstract class AbstractLockingProvider implements ILockingProvider { |
33 | - /** @var int $ttl */ |
|
34 | - protected $ttl; // how long until we clear stray locks in seconds |
|
33 | + /** @var int $ttl */ |
|
34 | + protected $ttl; // how long until we clear stray locks in seconds |
|
35 | 35 | |
36 | - protected $acquiredLocks = [ |
|
37 | - 'shared' => [], |
|
38 | - 'exclusive' => [] |
|
39 | - ]; |
|
36 | + protected $acquiredLocks = [ |
|
37 | + 'shared' => [], |
|
38 | + 'exclusive' => [] |
|
39 | + ]; |
|
40 | 40 | |
41 | - /** |
|
42 | - * Check if we've locally acquired a lock |
|
43 | - * |
|
44 | - * @param string $path |
|
45 | - * @param int $type |
|
46 | - * @return bool |
|
47 | - */ |
|
48 | - protected function hasAcquiredLock(string $path, int $type): bool { |
|
49 | - if ($type === self::LOCK_SHARED) { |
|
50 | - return isset($this->acquiredLocks['shared'][$path]) && $this->acquiredLocks['shared'][$path] > 0; |
|
51 | - } else { |
|
52 | - return isset($this->acquiredLocks['exclusive'][$path]) && $this->acquiredLocks['exclusive'][$path] === true; |
|
53 | - } |
|
54 | - } |
|
41 | + /** |
|
42 | + * Check if we've locally acquired a lock |
|
43 | + * |
|
44 | + * @param string $path |
|
45 | + * @param int $type |
|
46 | + * @return bool |
|
47 | + */ |
|
48 | + protected function hasAcquiredLock(string $path, int $type): bool { |
|
49 | + if ($type === self::LOCK_SHARED) { |
|
50 | + return isset($this->acquiredLocks['shared'][$path]) && $this->acquiredLocks['shared'][$path] > 0; |
|
51 | + } else { |
|
52 | + return isset($this->acquiredLocks['exclusive'][$path]) && $this->acquiredLocks['exclusive'][$path] === true; |
|
53 | + } |
|
54 | + } |
|
55 | 55 | |
56 | - /** |
|
57 | - * Mark a locally acquired lock |
|
58 | - * |
|
59 | - * @param string $path |
|
60 | - * @param int $type self::LOCK_SHARED or self::LOCK_EXCLUSIVE |
|
61 | - */ |
|
62 | - protected function markAcquire(string $path, int $type) { |
|
63 | - if ($type === self::LOCK_SHARED) { |
|
64 | - if (!isset($this->acquiredLocks['shared'][$path])) { |
|
65 | - $this->acquiredLocks['shared'][$path] = 0; |
|
66 | - } |
|
67 | - $this->acquiredLocks['shared'][$path]++; |
|
68 | - } else { |
|
69 | - $this->acquiredLocks['exclusive'][$path] = true; |
|
70 | - } |
|
71 | - } |
|
56 | + /** |
|
57 | + * Mark a locally acquired lock |
|
58 | + * |
|
59 | + * @param string $path |
|
60 | + * @param int $type self::LOCK_SHARED or self::LOCK_EXCLUSIVE |
|
61 | + */ |
|
62 | + protected function markAcquire(string $path, int $type) { |
|
63 | + if ($type === self::LOCK_SHARED) { |
|
64 | + if (!isset($this->acquiredLocks['shared'][$path])) { |
|
65 | + $this->acquiredLocks['shared'][$path] = 0; |
|
66 | + } |
|
67 | + $this->acquiredLocks['shared'][$path]++; |
|
68 | + } else { |
|
69 | + $this->acquiredLocks['exclusive'][$path] = true; |
|
70 | + } |
|
71 | + } |
|
72 | 72 | |
73 | - /** |
|
74 | - * Mark a release of a locally acquired lock |
|
75 | - * |
|
76 | - * @param string $path |
|
77 | - * @param int $type self::LOCK_SHARED or self::LOCK_EXCLUSIVE |
|
78 | - */ |
|
79 | - protected function markRelease(string $path, int $type) { |
|
80 | - if ($type === self::LOCK_SHARED) { |
|
81 | - if (isset($this->acquiredLocks['shared'][$path]) and $this->acquiredLocks['shared'][$path] > 0) { |
|
82 | - $this->acquiredLocks['shared'][$path]--; |
|
83 | - if ($this->acquiredLocks['shared'][$path] === 0) { |
|
84 | - unset($this->acquiredLocks['shared'][$path]); |
|
85 | - } |
|
86 | - } |
|
87 | - } else if ($type === self::LOCK_EXCLUSIVE) { |
|
88 | - unset($this->acquiredLocks['exclusive'][$path]); |
|
89 | - } |
|
90 | - } |
|
73 | + /** |
|
74 | + * Mark a release of a locally acquired lock |
|
75 | + * |
|
76 | + * @param string $path |
|
77 | + * @param int $type self::LOCK_SHARED or self::LOCK_EXCLUSIVE |
|
78 | + */ |
|
79 | + protected function markRelease(string $path, int $type) { |
|
80 | + if ($type === self::LOCK_SHARED) { |
|
81 | + if (isset($this->acquiredLocks['shared'][$path]) and $this->acquiredLocks['shared'][$path] > 0) { |
|
82 | + $this->acquiredLocks['shared'][$path]--; |
|
83 | + if ($this->acquiredLocks['shared'][$path] === 0) { |
|
84 | + unset($this->acquiredLocks['shared'][$path]); |
|
85 | + } |
|
86 | + } |
|
87 | + } else if ($type === self::LOCK_EXCLUSIVE) { |
|
88 | + unset($this->acquiredLocks['exclusive'][$path]); |
|
89 | + } |
|
90 | + } |
|
91 | 91 | |
92 | - /** |
|
93 | - * Change the type of an existing tracked lock |
|
94 | - * |
|
95 | - * @param string $path |
|
96 | - * @param int $targetType self::LOCK_SHARED or self::LOCK_EXCLUSIVE |
|
97 | - */ |
|
98 | - protected function markChange(string $path, int $targetType) { |
|
99 | - if ($targetType === self::LOCK_SHARED) { |
|
100 | - unset($this->acquiredLocks['exclusive'][$path]); |
|
101 | - if (!isset($this->acquiredLocks['shared'][$path])) { |
|
102 | - $this->acquiredLocks['shared'][$path] = 0; |
|
103 | - } |
|
104 | - $this->acquiredLocks['shared'][$path]++; |
|
105 | - } else if ($targetType === self::LOCK_EXCLUSIVE) { |
|
106 | - $this->acquiredLocks['exclusive'][$path] = true; |
|
107 | - $this->acquiredLocks['shared'][$path]--; |
|
108 | - } |
|
109 | - } |
|
92 | + /** |
|
93 | + * Change the type of an existing tracked lock |
|
94 | + * |
|
95 | + * @param string $path |
|
96 | + * @param int $targetType self::LOCK_SHARED or self::LOCK_EXCLUSIVE |
|
97 | + */ |
|
98 | + protected function markChange(string $path, int $targetType) { |
|
99 | + if ($targetType === self::LOCK_SHARED) { |
|
100 | + unset($this->acquiredLocks['exclusive'][$path]); |
|
101 | + if (!isset($this->acquiredLocks['shared'][$path])) { |
|
102 | + $this->acquiredLocks['shared'][$path] = 0; |
|
103 | + } |
|
104 | + $this->acquiredLocks['shared'][$path]++; |
|
105 | + } else if ($targetType === self::LOCK_EXCLUSIVE) { |
|
106 | + $this->acquiredLocks['exclusive'][$path] = true; |
|
107 | + $this->acquiredLocks['shared'][$path]--; |
|
108 | + } |
|
109 | + } |
|
110 | 110 | |
111 | - /** |
|
112 | - * release all lock acquired by this instance which were marked using the mark* methods |
|
113 | - */ |
|
114 | - public function releaseAll() { |
|
115 | - foreach ($this->acquiredLocks['shared'] as $path => $count) { |
|
116 | - for ($i = 0; $i < $count; $i++) { |
|
117 | - $this->releaseLock($path, self::LOCK_SHARED); |
|
118 | - } |
|
119 | - } |
|
111 | + /** |
|
112 | + * release all lock acquired by this instance which were marked using the mark* methods |
|
113 | + */ |
|
114 | + public function releaseAll() { |
|
115 | + foreach ($this->acquiredLocks['shared'] as $path => $count) { |
|
116 | + for ($i = 0; $i < $count; $i++) { |
|
117 | + $this->releaseLock($path, self::LOCK_SHARED); |
|
118 | + } |
|
119 | + } |
|
120 | 120 | |
121 | - foreach ($this->acquiredLocks['exclusive'] as $path => $hasLock) { |
|
122 | - $this->releaseLock($path, self::LOCK_EXCLUSIVE); |
|
123 | - } |
|
124 | - } |
|
121 | + foreach ($this->acquiredLocks['exclusive'] as $path => $hasLock) { |
|
122 | + $this->releaseLock($path, self::LOCK_EXCLUSIVE); |
|
123 | + } |
|
124 | + } |
|
125 | 125 | |
126 | - protected function getOwnSharedLockCount(string $path) { |
|
127 | - return isset($this->acquiredLocks['shared'][$path]) ? $this->acquiredLocks['shared'][$path] : 0; |
|
128 | - } |
|
126 | + protected function getOwnSharedLockCount(string $path) { |
|
127 | + return isset($this->acquiredLocks['shared'][$path]) ? $this->acquiredLocks['shared'][$path] : 0; |
|
128 | + } |
|
129 | 129 | } |
@@ -31,51 +31,51 @@ |
||
31 | 31 | * @since 8.1.0 |
32 | 32 | */ |
33 | 33 | interface ILockingProvider { |
34 | - /** |
|
35 | - * @since 8.1.0 |
|
36 | - */ |
|
37 | - const LOCK_SHARED = 1; |
|
38 | - /** |
|
39 | - * @since 8.1.0 |
|
40 | - */ |
|
41 | - const LOCK_EXCLUSIVE = 2; |
|
34 | + /** |
|
35 | + * @since 8.1.0 |
|
36 | + */ |
|
37 | + const LOCK_SHARED = 1; |
|
38 | + /** |
|
39 | + * @since 8.1.0 |
|
40 | + */ |
|
41 | + const LOCK_EXCLUSIVE = 2; |
|
42 | 42 | |
43 | - /** |
|
44 | - * @param string $path |
|
45 | - * @param int $type self::LOCK_SHARED or self::LOCK_EXCLUSIVE |
|
46 | - * @return bool |
|
47 | - * @since 8.1.0 |
|
48 | - */ |
|
49 | - public function isLocked(string $path, int $type): bool; |
|
43 | + /** |
|
44 | + * @param string $path |
|
45 | + * @param int $type self::LOCK_SHARED or self::LOCK_EXCLUSIVE |
|
46 | + * @return bool |
|
47 | + * @since 8.1.0 |
|
48 | + */ |
|
49 | + public function isLocked(string $path, int $type): bool; |
|
50 | 50 | |
51 | - /** |
|
52 | - * @param string $path |
|
53 | - * @param int $type self::LOCK_SHARED or self::LOCK_EXCLUSIVE |
|
54 | - * @throws \OCP\Lock\LockedException |
|
55 | - * @since 8.1.0 |
|
56 | - */ |
|
57 | - public function acquireLock(string $path, int $type); |
|
51 | + /** |
|
52 | + * @param string $path |
|
53 | + * @param int $type self::LOCK_SHARED or self::LOCK_EXCLUSIVE |
|
54 | + * @throws \OCP\Lock\LockedException |
|
55 | + * @since 8.1.0 |
|
56 | + */ |
|
57 | + public function acquireLock(string $path, int $type); |
|
58 | 58 | |
59 | - /** |
|
60 | - * @param string $path |
|
61 | - * @param int $type self::LOCK_SHARED or self::LOCK_EXCLUSIVE |
|
62 | - * @since 8.1.0 |
|
63 | - */ |
|
64 | - public function releaseLock(string $path, int $type); |
|
59 | + /** |
|
60 | + * @param string $path |
|
61 | + * @param int $type self::LOCK_SHARED or self::LOCK_EXCLUSIVE |
|
62 | + * @since 8.1.0 |
|
63 | + */ |
|
64 | + public function releaseLock(string $path, int $type); |
|
65 | 65 | |
66 | - /** |
|
67 | - * Change the type of an existing lock |
|
68 | - * |
|
69 | - * @param string $path |
|
70 | - * @param int $targetType self::LOCK_SHARED or self::LOCK_EXCLUSIVE |
|
71 | - * @throws \OCP\Lock\LockedException |
|
72 | - * @since 8.1.0 |
|
73 | - */ |
|
74 | - public function changeLock(string $path, int $targetType); |
|
66 | + /** |
|
67 | + * Change the type of an existing lock |
|
68 | + * |
|
69 | + * @param string $path |
|
70 | + * @param int $targetType self::LOCK_SHARED or self::LOCK_EXCLUSIVE |
|
71 | + * @throws \OCP\Lock\LockedException |
|
72 | + * @since 8.1.0 |
|
73 | + */ |
|
74 | + public function changeLock(string $path, int $targetType); |
|
75 | 75 | |
76 | - /** |
|
77 | - * release all lock acquired by this instance |
|
78 | - * @since 8.1.0 |
|
79 | - */ |
|
80 | - public function releaseAll(); |
|
76 | + /** |
|
77 | + * release all lock acquired by this instance |
|
78 | + * @since 8.1.0 |
|
79 | + */ |
|
80 | + public function releaseAll(); |
|
81 | 81 | } |
@@ -27,44 +27,44 @@ |
||
27 | 27 | use OCP\ILogger; |
28 | 28 | |
29 | 29 | class FakeDBLockingProvider extends \OC\Lock\DBLockingProvider { |
30 | - // Lock for 10 hours just to be sure |
|
31 | - const TTL = 36000; |
|
30 | + // Lock for 10 hours just to be sure |
|
31 | + const TTL = 36000; |
|
32 | 32 | |
33 | - /** |
|
34 | - * Need a new child, because parent::connection is private instead of protected... |
|
35 | - * @var IDBConnection |
|
36 | - */ |
|
37 | - protected $db; |
|
33 | + /** |
|
34 | + * Need a new child, because parent::connection is private instead of protected... |
|
35 | + * @var IDBConnection |
|
36 | + */ |
|
37 | + protected $db; |
|
38 | 38 | |
39 | - /** |
|
40 | - * @param \OCP\IDBConnection $connection |
|
41 | - * @param \OCP\ILogger $logger |
|
42 | - * @param \OCP\AppFramework\Utility\ITimeFactory $timeFactory |
|
43 | - */ |
|
44 | - public function __construct(IDBConnection $connection, ILogger $logger, ITimeFactory $timeFactory) { |
|
45 | - parent::__construct($connection, $logger, $timeFactory); |
|
46 | - $this->db = $connection; |
|
47 | - } |
|
39 | + /** |
|
40 | + * @param \OCP\IDBConnection $connection |
|
41 | + * @param \OCP\ILogger $logger |
|
42 | + * @param \OCP\AppFramework\Utility\ITimeFactory $timeFactory |
|
43 | + */ |
|
44 | + public function __construct(IDBConnection $connection, ILogger $logger, ITimeFactory $timeFactory) { |
|
45 | + parent::__construct($connection, $logger, $timeFactory); |
|
46 | + $this->db = $connection; |
|
47 | + } |
|
48 | 48 | |
49 | 49 | |
50 | - /** |
|
51 | - * @param string $path |
|
52 | - * @param int $type self::LOCK_SHARED or self::LOCK_EXCLUSIVE |
|
53 | - */ |
|
54 | - public function releaseLock(string $path, int $type) { |
|
55 | - // we DONT keep shared locks till the end of the request |
|
56 | - if ($type === self::LOCK_SHARED) { |
|
57 | - $this->db->executeUpdate( |
|
58 | - 'UPDATE `*PREFIX*file_locks` SET `lock` = 0 WHERE `key` = ? AND `lock` = 1', |
|
59 | - [$path] |
|
60 | - ); |
|
61 | - } |
|
50 | + /** |
|
51 | + * @param string $path |
|
52 | + * @param int $type self::LOCK_SHARED or self::LOCK_EXCLUSIVE |
|
53 | + */ |
|
54 | + public function releaseLock(string $path, int $type) { |
|
55 | + // we DONT keep shared locks till the end of the request |
|
56 | + if ($type === self::LOCK_SHARED) { |
|
57 | + $this->db->executeUpdate( |
|
58 | + 'UPDATE `*PREFIX*file_locks` SET `lock` = 0 WHERE `key` = ? AND `lock` = 1', |
|
59 | + [$path] |
|
60 | + ); |
|
61 | + } |
|
62 | 62 | |
63 | - parent::releaseLock($path, $type); |
|
64 | - } |
|
63 | + parent::releaseLock($path, $type); |
|
64 | + } |
|
65 | 65 | |
66 | - public function __destruct() { |
|
67 | - // Prevent cleaning up at the end of the live time. |
|
68 | - // parent::__destruct(); |
|
69 | - } |
|
66 | + public function __destruct() { |
|
67 | + // Prevent cleaning up at the end of the live time. |
|
68 | + // parent::__destruct(); |
|
69 | + } |
|
70 | 70 | } |
@@ -45,23 +45,23 @@ |
||
45 | 45 | * @since 8.0.0 |
46 | 46 | */ |
47 | 47 | interface IHasher { |
48 | - /** |
|
49 | - * Hashes a message using PHP's `password_hash` functionality. |
|
50 | - * Please note that the size of the returned string is not guaranteed |
|
51 | - * and can be up to 255 characters. |
|
52 | - * |
|
53 | - * @param string $message Message to generate hash from |
|
54 | - * @return string Hash of the message with appended version parameter |
|
55 | - * @since 8.0.0 |
|
56 | - */ |
|
57 | - public function hash(string $message): string; |
|
48 | + /** |
|
49 | + * Hashes a message using PHP's `password_hash` functionality. |
|
50 | + * Please note that the size of the returned string is not guaranteed |
|
51 | + * and can be up to 255 characters. |
|
52 | + * |
|
53 | + * @param string $message Message to generate hash from |
|
54 | + * @return string Hash of the message with appended version parameter |
|
55 | + * @since 8.0.0 |
|
56 | + */ |
|
57 | + public function hash(string $message): string; |
|
58 | 58 | |
59 | - /** |
|
60 | - * @param string $message Message to verify |
|
61 | - * @param string $hash Assumed hash of the message |
|
62 | - * @param null|string &$newHash Reference will contain the updated hash if necessary. Update the existing hash with this one. |
|
63 | - * @return bool Whether $hash is a valid hash of $message |
|
64 | - * @since 8.0.0 |
|
65 | - */ |
|
66 | - public function verify(string $message, string $hash, &$newHash = null): bool ; |
|
59 | + /** |
|
60 | + * @param string $message Message to verify |
|
61 | + * @param string $hash Assumed hash of the message |
|
62 | + * @param null|string &$newHash Reference will contain the updated hash if necessary. Update the existing hash with this one. |
|
63 | + * @return bool Whether $hash is a valid hash of $message |
|
64 | + * @since 8.0.0 |
|
65 | + */ |
|
66 | + public function verify(string $message, string $hash, &$newHash = null): bool ; |
|
67 | 67 | } |
@@ -33,38 +33,38 @@ |
||
33 | 33 | */ |
34 | 34 | class NoopLockingProvider implements ILockingProvider { |
35 | 35 | |
36 | - /** |
|
37 | - * {@inheritdoc} |
|
38 | - */ |
|
39 | - public function isLocked(string $path, int $type): bool { |
|
40 | - return false; |
|
41 | - } |
|
36 | + /** |
|
37 | + * {@inheritdoc} |
|
38 | + */ |
|
39 | + public function isLocked(string $path, int $type): bool { |
|
40 | + return false; |
|
41 | + } |
|
42 | 42 | |
43 | - /** |
|
44 | - * {@inheritdoc} |
|
45 | - */ |
|
46 | - public function acquireLock(string $path, int $type) { |
|
47 | - // do nothing |
|
48 | - } |
|
43 | + /** |
|
44 | + * {@inheritdoc} |
|
45 | + */ |
|
46 | + public function acquireLock(string $path, int $type) { |
|
47 | + // do nothing |
|
48 | + } |
|
49 | 49 | |
50 | - /** |
|
51 | - * {@inheritdoc} |
|
52 | - */ |
|
53 | - public function releaseLock(string $path, int $type) { |
|
54 | - // do nothing |
|
55 | - } |
|
50 | + /** |
|
51 | + * {@inheritdoc} |
|
52 | + */ |
|
53 | + public function releaseLock(string $path, int $type) { |
|
54 | + // do nothing |
|
55 | + } |
|
56 | 56 | |
57 | - /**1 |
|
57 | + /**1 |
|
58 | 58 | * {@inheritdoc} |
59 | 59 | */ |
60 | - public function releaseAll() { |
|
61 | - // do nothing |
|
62 | - } |
|
60 | + public function releaseAll() { |
|
61 | + // do nothing |
|
62 | + } |
|
63 | 63 | |
64 | - /** |
|
65 | - * {@inheritdoc} |
|
66 | - */ |
|
67 | - public function changeLock(string $path, int $targetType) { |
|
68 | - // do nothing |
|
69 | - } |
|
64 | + /** |
|
65 | + * {@inheritdoc} |
|
66 | + */ |
|
67 | + public function changeLock(string $path, int $targetType) { |
|
68 | + // do nothing |
|
69 | + } |
|
70 | 70 | } |
@@ -29,50 +29,50 @@ |
||
29 | 29 | |
30 | 30 | class Version13000Date20170814074715 extends SimpleMigrationStep { |
31 | 31 | |
32 | - /** |
|
33 | - * @param IOutput $output |
|
34 | - * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
35 | - * @param array $options |
|
36 | - * @since 13.0.0 |
|
37 | - */ |
|
38 | - public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) { |
|
39 | - } |
|
32 | + /** |
|
33 | + * @param IOutput $output |
|
34 | + * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
35 | + * @param array $options |
|
36 | + * @since 13.0.0 |
|
37 | + */ |
|
38 | + public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) { |
|
39 | + } |
|
40 | 40 | |
41 | - /** |
|
42 | - * @param IOutput $output |
|
43 | - * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
44 | - * @param array $options |
|
45 | - * @return null|ISchemaWrapper |
|
46 | - * @since 13.0.0 |
|
47 | - */ |
|
48 | - public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { |
|
49 | - /** @var ISchemaWrapper $schema */ |
|
50 | - $schema = $schemaClosure(); |
|
41 | + /** |
|
42 | + * @param IOutput $output |
|
43 | + * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
44 | + * @param array $options |
|
45 | + * @return null|ISchemaWrapper |
|
46 | + * @since 13.0.0 |
|
47 | + */ |
|
48 | + public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { |
|
49 | + /** @var ISchemaWrapper $schema */ |
|
50 | + $schema = $schemaClosure(); |
|
51 | 51 | |
52 | 52 | |
53 | - if (!$schema->hasTable('accounts')) { |
|
54 | - $table = $schema->createTable('accounts'); |
|
55 | - $table->addColumn('uid', 'string', [ |
|
56 | - 'notnull' => true, |
|
57 | - 'length' => 64, |
|
58 | - 'default' => '', |
|
59 | - ]); |
|
60 | - $table->addColumn('data', 'text', [ |
|
61 | - 'notnull' => true, |
|
62 | - 'default' => '', |
|
63 | - ]); |
|
64 | - $table->setPrimaryKey(['uid']); |
|
65 | - } |
|
53 | + if (!$schema->hasTable('accounts')) { |
|
54 | + $table = $schema->createTable('accounts'); |
|
55 | + $table->addColumn('uid', 'string', [ |
|
56 | + 'notnull' => true, |
|
57 | + 'length' => 64, |
|
58 | + 'default' => '', |
|
59 | + ]); |
|
60 | + $table->addColumn('data', 'text', [ |
|
61 | + 'notnull' => true, |
|
62 | + 'default' => '', |
|
63 | + ]); |
|
64 | + $table->setPrimaryKey(['uid']); |
|
65 | + } |
|
66 | 66 | |
67 | - return $schema; |
|
68 | - } |
|
67 | + return $schema; |
|
68 | + } |
|
69 | 69 | |
70 | - /** |
|
71 | - * @param IOutput $output |
|
72 | - * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
73 | - * @param array $options |
|
74 | - * @since 13.0.0 |
|
75 | - */ |
|
76 | - public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) { |
|
77 | - } |
|
70 | + /** |
|
71 | + * @param IOutput $output |
|
72 | + * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
73 | + * @param array $options |
|
74 | + * @since 13.0.0 |
|
75 | + */ |
|
76 | + public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) { |
|
77 | + } |
|
78 | 78 | } |
@@ -32,93 +32,93 @@ |
||
32 | 32 | */ |
33 | 33 | class Version13000Date20170919121250 extends SimpleMigrationStep { |
34 | 34 | |
35 | - /** |
|
36 | - * @param IOutput $output |
|
37 | - * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
38 | - * @param array $options |
|
39 | - * @since 13.0.0 |
|
40 | - */ |
|
41 | - public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) { |
|
42 | - } |
|
43 | - |
|
44 | - /** |
|
45 | - * @param IOutput $output |
|
46 | - * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
47 | - * @param array $options |
|
48 | - * @return null|ISchemaWrapper |
|
49 | - * @since 13.0.0 |
|
50 | - */ |
|
51 | - public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { |
|
52 | - /** @var ISchemaWrapper $schema */ |
|
53 | - $schema = $schemaClosure(); |
|
54 | - |
|
55 | - $table = $schema->getTable('jobs'); |
|
56 | - $column = $table->getColumn('id'); |
|
57 | - $column->setUnsigned(true); |
|
58 | - |
|
59 | - $table = $schema->getTable('authtoken'); |
|
60 | - $column = $table->getColumn('id'); |
|
61 | - $column->setUnsigned(true); |
|
62 | - $column = $table->getColumn('type'); |
|
63 | - $column->setUnsigned(true); |
|
64 | - $column = $table->getColumn('remember'); |
|
65 | - $column->setUnsigned(true); |
|
66 | - $column = $table->getColumn('last_activity'); |
|
67 | - $column->setUnsigned(true); |
|
68 | - $column = $table->getColumn('last_check'); |
|
69 | - $column->setUnsigned(true); |
|
70 | - |
|
71 | - $table = $schema->getTable('bruteforce_attempts'); |
|
72 | - $column = $table->getColumn('id'); |
|
73 | - $column->setUnsigned(true); |
|
74 | - $column = $table->getColumn('occurred'); |
|
75 | - $column->setUnsigned(true); |
|
76 | - |
|
77 | - $table = $schema->getTable('comments'); |
|
78 | - $column = $table->getColumn('id'); |
|
79 | - $column->setUnsigned(true); |
|
80 | - $column = $table->getColumn('parent_id'); |
|
81 | - $column->setUnsigned(true); |
|
82 | - $column = $table->getColumn('topmost_parent_id'); |
|
83 | - $column->setUnsigned(true); |
|
84 | - $column = $table->getColumn('children_count'); |
|
85 | - $column->setUnsigned(true); |
|
86 | - |
|
87 | - $table = $schema->getTable('file_locks'); |
|
88 | - $column = $table->getColumn('id'); |
|
89 | - $column->setUnsigned(true); |
|
90 | - |
|
91 | - $table = $schema->getTable('systemtag'); |
|
92 | - $column = $table->getColumn('id'); |
|
93 | - $column->setUnsigned(true); |
|
94 | - |
|
95 | - $table = $schema->getTable('systemtag_object_mapping'); |
|
96 | - $column = $table->getColumn('systemtagid'); |
|
97 | - $column->setUnsigned(true); |
|
98 | - |
|
99 | - $table = $schema->getTable('systemtag_group'); |
|
100 | - $column = $table->getColumn('systemtagid'); |
|
101 | - $column->setUnsigned(true); |
|
102 | - |
|
103 | - $table = $schema->getTable('vcategory'); |
|
104 | - $column = $table->getColumn('id'); |
|
105 | - $column->setUnsigned(true); |
|
106 | - |
|
107 | - $table = $schema->getTable('vcategory_to_object'); |
|
108 | - $column = $table->getColumn('objid'); |
|
109 | - $column->setUnsigned(true); |
|
110 | - $column = $table->getColumn('categoryid'); |
|
111 | - $column->setUnsigned(true); |
|
112 | - |
|
113 | - return $schema; |
|
114 | - } |
|
115 | - |
|
116 | - /** |
|
117 | - * @param IOutput $output |
|
118 | - * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
119 | - * @param array $options |
|
120 | - * @since 13.0.0 |
|
121 | - */ |
|
122 | - public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) { |
|
123 | - } |
|
35 | + /** |
|
36 | + * @param IOutput $output |
|
37 | + * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
38 | + * @param array $options |
|
39 | + * @since 13.0.0 |
|
40 | + */ |
|
41 | + public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) { |
|
42 | + } |
|
43 | + |
|
44 | + /** |
|
45 | + * @param IOutput $output |
|
46 | + * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
47 | + * @param array $options |
|
48 | + * @return null|ISchemaWrapper |
|
49 | + * @since 13.0.0 |
|
50 | + */ |
|
51 | + public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { |
|
52 | + /** @var ISchemaWrapper $schema */ |
|
53 | + $schema = $schemaClosure(); |
|
54 | + |
|
55 | + $table = $schema->getTable('jobs'); |
|
56 | + $column = $table->getColumn('id'); |
|
57 | + $column->setUnsigned(true); |
|
58 | + |
|
59 | + $table = $schema->getTable('authtoken'); |
|
60 | + $column = $table->getColumn('id'); |
|
61 | + $column->setUnsigned(true); |
|
62 | + $column = $table->getColumn('type'); |
|
63 | + $column->setUnsigned(true); |
|
64 | + $column = $table->getColumn('remember'); |
|
65 | + $column->setUnsigned(true); |
|
66 | + $column = $table->getColumn('last_activity'); |
|
67 | + $column->setUnsigned(true); |
|
68 | + $column = $table->getColumn('last_check'); |
|
69 | + $column->setUnsigned(true); |
|
70 | + |
|
71 | + $table = $schema->getTable('bruteforce_attempts'); |
|
72 | + $column = $table->getColumn('id'); |
|
73 | + $column->setUnsigned(true); |
|
74 | + $column = $table->getColumn('occurred'); |
|
75 | + $column->setUnsigned(true); |
|
76 | + |
|
77 | + $table = $schema->getTable('comments'); |
|
78 | + $column = $table->getColumn('id'); |
|
79 | + $column->setUnsigned(true); |
|
80 | + $column = $table->getColumn('parent_id'); |
|
81 | + $column->setUnsigned(true); |
|
82 | + $column = $table->getColumn('topmost_parent_id'); |
|
83 | + $column->setUnsigned(true); |
|
84 | + $column = $table->getColumn('children_count'); |
|
85 | + $column->setUnsigned(true); |
|
86 | + |
|
87 | + $table = $schema->getTable('file_locks'); |
|
88 | + $column = $table->getColumn('id'); |
|
89 | + $column->setUnsigned(true); |
|
90 | + |
|
91 | + $table = $schema->getTable('systemtag'); |
|
92 | + $column = $table->getColumn('id'); |
|
93 | + $column->setUnsigned(true); |
|
94 | + |
|
95 | + $table = $schema->getTable('systemtag_object_mapping'); |
|
96 | + $column = $table->getColumn('systemtagid'); |
|
97 | + $column->setUnsigned(true); |
|
98 | + |
|
99 | + $table = $schema->getTable('systemtag_group'); |
|
100 | + $column = $table->getColumn('systemtagid'); |
|
101 | + $column->setUnsigned(true); |
|
102 | + |
|
103 | + $table = $schema->getTable('vcategory'); |
|
104 | + $column = $table->getColumn('id'); |
|
105 | + $column->setUnsigned(true); |
|
106 | + |
|
107 | + $table = $schema->getTable('vcategory_to_object'); |
|
108 | + $column = $table->getColumn('objid'); |
|
109 | + $column->setUnsigned(true); |
|
110 | + $column = $table->getColumn('categoryid'); |
|
111 | + $column->setUnsigned(true); |
|
112 | + |
|
113 | + return $schema; |
|
114 | + } |
|
115 | + |
|
116 | + /** |
|
117 | + * @param IOutput $output |
|
118 | + * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
119 | + * @param array $options |
|
120 | + * @since 13.0.0 |
|
121 | + */ |
|
122 | + public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) { |
|
123 | + } |
|
124 | 124 | } |
@@ -31,75 +31,75 @@ |
||
31 | 31 | |
32 | 32 | class Version1002Date20170607113030 extends SimpleMigrationStep { |
33 | 33 | |
34 | - /** @var IDBConnection */ |
|
35 | - protected $connection; |
|
34 | + /** @var IDBConnection */ |
|
35 | + protected $connection; |
|
36 | 36 | |
37 | - /** |
|
38 | - * @param IDBConnection $connection |
|
39 | - */ |
|
40 | - public function __construct(IDBConnection $connection) { |
|
41 | - $this->connection = $connection; |
|
42 | - } |
|
37 | + /** |
|
38 | + * @param IDBConnection $connection |
|
39 | + */ |
|
40 | + public function __construct(IDBConnection $connection) { |
|
41 | + $this->connection = $connection; |
|
42 | + } |
|
43 | 43 | |
44 | - /** |
|
45 | - * @param IOutput $output |
|
46 | - * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
47 | - * @param array $options |
|
48 | - * @since 13.0.0 |
|
49 | - */ |
|
50 | - public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) { |
|
51 | - /** @var ISchemaWrapper $schema */ |
|
52 | - $schema = $schemaClosure(); |
|
44 | + /** |
|
45 | + * @param IOutput $output |
|
46 | + * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
47 | + * @param array $options |
|
48 | + * @since 13.0.0 |
|
49 | + */ |
|
50 | + public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) { |
|
51 | + /** @var ISchemaWrapper $schema */ |
|
52 | + $schema = $schemaClosure(); |
|
53 | 53 | |
54 | - if (!$schema->hasTable('twofactor_backup_codes')) { |
|
55 | - // Legacy table does not exist |
|
56 | - return; |
|
57 | - } |
|
54 | + if (!$schema->hasTable('twofactor_backup_codes')) { |
|
55 | + // Legacy table does not exist |
|
56 | + return; |
|
57 | + } |
|
58 | 58 | |
59 | - $insert = $this->connection->getQueryBuilder(); |
|
60 | - $insert->insert('twofactor_backupcodes') |
|
61 | - ->values([ |
|
62 | - // Inserting with id might fail: 'id' => $insert->createParameter('id'), |
|
63 | - 'user_id' => $insert->createParameter('user_id'), |
|
64 | - 'code' => $insert->createParameter('code'), |
|
65 | - 'used' => $insert->createParameter('used'), |
|
66 | - ]); |
|
59 | + $insert = $this->connection->getQueryBuilder(); |
|
60 | + $insert->insert('twofactor_backupcodes') |
|
61 | + ->values([ |
|
62 | + // Inserting with id might fail: 'id' => $insert->createParameter('id'), |
|
63 | + 'user_id' => $insert->createParameter('user_id'), |
|
64 | + 'code' => $insert->createParameter('code'), |
|
65 | + 'used' => $insert->createParameter('used'), |
|
66 | + ]); |
|
67 | 67 | |
68 | - $query = $this->connection->getQueryBuilder(); |
|
69 | - $query->select('*') |
|
70 | - ->from('twofactor_backup_codes') |
|
71 | - ->orderBy('id', 'ASC'); |
|
72 | - $result = $query->execute(); |
|
68 | + $query = $this->connection->getQueryBuilder(); |
|
69 | + $query->select('*') |
|
70 | + ->from('twofactor_backup_codes') |
|
71 | + ->orderBy('id', 'ASC'); |
|
72 | + $result = $query->execute(); |
|
73 | 73 | |
74 | - $output->startProgress(); |
|
75 | - while ($row = $result->fetch()) { |
|
76 | - $output->advance(); |
|
74 | + $output->startProgress(); |
|
75 | + while ($row = $result->fetch()) { |
|
76 | + $output->advance(); |
|
77 | 77 | |
78 | - $insert |
|
79 | - // Inserting with id might fail: ->setParameter('id', $row['id'], IQueryBuilder::PARAM_INT) |
|
80 | - ->setParameter('user_id', $row['user_id'], IQueryBuilder::PARAM_STR) |
|
81 | - ->setParameter('code', $row['code'], IQueryBuilder::PARAM_STR) |
|
82 | - ->setParameter('used', $row['used'], IQueryBuilder::PARAM_INT) |
|
83 | - ->execute(); |
|
84 | - } |
|
85 | - $output->finishProgress(); |
|
86 | - } |
|
78 | + $insert |
|
79 | + // Inserting with id might fail: ->setParameter('id', $row['id'], IQueryBuilder::PARAM_INT) |
|
80 | + ->setParameter('user_id', $row['user_id'], IQueryBuilder::PARAM_STR) |
|
81 | + ->setParameter('code', $row['code'], IQueryBuilder::PARAM_STR) |
|
82 | + ->setParameter('used', $row['used'], IQueryBuilder::PARAM_INT) |
|
83 | + ->execute(); |
|
84 | + } |
|
85 | + $output->finishProgress(); |
|
86 | + } |
|
87 | 87 | |
88 | - /** |
|
89 | - * @param IOutput $output |
|
90 | - * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
91 | - * @param array $options |
|
92 | - * @return null|ISchemaWrapper |
|
93 | - * @since 13.0.0 |
|
94 | - */ |
|
95 | - public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { |
|
96 | - /** @var ISchemaWrapper $schema */ |
|
97 | - $schema = $schemaClosure(); |
|
88 | + /** |
|
89 | + * @param IOutput $output |
|
90 | + * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
91 | + * @param array $options |
|
92 | + * @return null|ISchemaWrapper |
|
93 | + * @since 13.0.0 |
|
94 | + */ |
|
95 | + public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { |
|
96 | + /** @var ISchemaWrapper $schema */ |
|
97 | + $schema = $schemaClosure(); |
|
98 | 98 | |
99 | - if ($schema->hasTable('twofactor_backup_codes')) { |
|
100 | - $schema->dropTable('twofactor_backup_codes'); |
|
101 | - return $schema; |
|
102 | - } |
|
103 | - return null; |
|
104 | - } |
|
99 | + if ($schema->hasTable('twofactor_backup_codes')) { |
|
100 | + $schema->dropTable('twofactor_backup_codes'); |
|
101 | + return $schema; |
|
102 | + } |
|
103 | + return null; |
|
104 | + } |
|
105 | 105 | } |