@@ -49,70 +49,70 @@ |
||
49 | 49 | * @package OC\Session |
50 | 50 | */ |
51 | 51 | class CryptoWrapper { |
52 | - public const COOKIE_NAME = 'oc_sessionPassphrase'; |
|
52 | + public const COOKIE_NAME = 'oc_sessionPassphrase'; |
|
53 | 53 | |
54 | - /** @var IConfig */ |
|
55 | - protected $config; |
|
56 | - /** @var ISession */ |
|
57 | - protected $session; |
|
58 | - /** @var ICrypto */ |
|
59 | - protected $crypto; |
|
60 | - /** @var ISecureRandom */ |
|
61 | - protected $random; |
|
62 | - /** @var string */ |
|
63 | - protected $passphrase; |
|
54 | + /** @var IConfig */ |
|
55 | + protected $config; |
|
56 | + /** @var ISession */ |
|
57 | + protected $session; |
|
58 | + /** @var ICrypto */ |
|
59 | + protected $crypto; |
|
60 | + /** @var ISecureRandom */ |
|
61 | + protected $random; |
|
62 | + /** @var string */ |
|
63 | + protected $passphrase; |
|
64 | 64 | |
65 | - /** |
|
66 | - * @param IConfig $config |
|
67 | - * @param ICrypto $crypto |
|
68 | - * @param ISecureRandom $random |
|
69 | - * @param IRequest $request |
|
70 | - */ |
|
71 | - public function __construct(IConfig $config, |
|
72 | - ICrypto $crypto, |
|
73 | - ISecureRandom $random, |
|
74 | - IRequest $request) { |
|
75 | - $this->crypto = $crypto; |
|
76 | - $this->config = $config; |
|
77 | - $this->random = $random; |
|
65 | + /** |
|
66 | + * @param IConfig $config |
|
67 | + * @param ICrypto $crypto |
|
68 | + * @param ISecureRandom $random |
|
69 | + * @param IRequest $request |
|
70 | + */ |
|
71 | + public function __construct(IConfig $config, |
|
72 | + ICrypto $crypto, |
|
73 | + ISecureRandom $random, |
|
74 | + IRequest $request) { |
|
75 | + $this->crypto = $crypto; |
|
76 | + $this->config = $config; |
|
77 | + $this->random = $random; |
|
78 | 78 | |
79 | - if (!is_null($request->getCookie(self::COOKIE_NAME))) { |
|
80 | - $this->passphrase = $request->getCookie(self::COOKIE_NAME); |
|
81 | - } else { |
|
82 | - $this->passphrase = $this->random->generate(128); |
|
83 | - $secureCookie = $request->getServerProtocol() === 'https'; |
|
84 | - // FIXME: Required for CI |
|
85 | - if (!defined('PHPUNIT_RUN')) { |
|
86 | - $webRoot = \OC::$WEBROOT; |
|
87 | - if ($webRoot === '') { |
|
88 | - $webRoot = '/'; |
|
89 | - } |
|
79 | + if (!is_null($request->getCookie(self::COOKIE_NAME))) { |
|
80 | + $this->passphrase = $request->getCookie(self::COOKIE_NAME); |
|
81 | + } else { |
|
82 | + $this->passphrase = $this->random->generate(128); |
|
83 | + $secureCookie = $request->getServerProtocol() === 'https'; |
|
84 | + // FIXME: Required for CI |
|
85 | + if (!defined('PHPUNIT_RUN')) { |
|
86 | + $webRoot = \OC::$WEBROOT; |
|
87 | + if ($webRoot === '') { |
|
88 | + $webRoot = '/'; |
|
89 | + } |
|
90 | 90 | |
91 | - setcookie( |
|
92 | - self::COOKIE_NAME, |
|
93 | - $this->passphrase, |
|
94 | - [ |
|
95 | - 'expires' => 0, |
|
96 | - 'path' => $webRoot, |
|
97 | - 'domain' => '', |
|
98 | - 'secure' => $secureCookie, |
|
99 | - 'httponly' => true, |
|
100 | - 'samesite' => 'Lax', |
|
101 | - ] |
|
102 | - ); |
|
103 | - } |
|
104 | - } |
|
105 | - } |
|
91 | + setcookie( |
|
92 | + self::COOKIE_NAME, |
|
93 | + $this->passphrase, |
|
94 | + [ |
|
95 | + 'expires' => 0, |
|
96 | + 'path' => $webRoot, |
|
97 | + 'domain' => '', |
|
98 | + 'secure' => $secureCookie, |
|
99 | + 'httponly' => true, |
|
100 | + 'samesite' => 'Lax', |
|
101 | + ] |
|
102 | + ); |
|
103 | + } |
|
104 | + } |
|
105 | + } |
|
106 | 106 | |
107 | - /** |
|
108 | - * @param ISession $session |
|
109 | - * @return ISession |
|
110 | - */ |
|
111 | - public function wrapSession(ISession $session) { |
|
112 | - if (!($session instanceof CryptoSessionData)) { |
|
113 | - return new CryptoSessionData($session, $this->crypto, $this->passphrase); |
|
114 | - } |
|
107 | + /** |
|
108 | + * @param ISession $session |
|
109 | + * @return ISession |
|
110 | + */ |
|
111 | + public function wrapSession(ISession $session) { |
|
112 | + if (!($session instanceof CryptoSessionData)) { |
|
113 | + return new CryptoSessionData($session, $this->crypto, $this->passphrase); |
|
114 | + } |
|
115 | 115 | |
116 | - return $session; |
|
117 | - } |
|
116 | + return $session; |
|
117 | + } |
|
118 | 118 | } |
@@ -32,77 +32,77 @@ |
||
32 | 32 | * Very thin wrapper class to make output testable |
33 | 33 | */ |
34 | 34 | class Output implements IOutput { |
35 | - /** @var string */ |
|
36 | - private $webRoot; |
|
35 | + /** @var string */ |
|
36 | + private $webRoot; |
|
37 | 37 | |
38 | - /** |
|
39 | - * @param $webRoot |
|
40 | - */ |
|
41 | - public function __construct($webRoot) { |
|
42 | - $this->webRoot = $webRoot; |
|
43 | - } |
|
38 | + /** |
|
39 | + * @param $webRoot |
|
40 | + */ |
|
41 | + public function __construct($webRoot) { |
|
42 | + $this->webRoot = $webRoot; |
|
43 | + } |
|
44 | 44 | |
45 | - /** |
|
46 | - * @param string $out |
|
47 | - */ |
|
48 | - public function setOutput($out) { |
|
49 | - print($out); |
|
50 | - } |
|
45 | + /** |
|
46 | + * @param string $out |
|
47 | + */ |
|
48 | + public function setOutput($out) { |
|
49 | + print($out); |
|
50 | + } |
|
51 | 51 | |
52 | - /** |
|
53 | - * @param string|resource $path or file handle |
|
54 | - * |
|
55 | - * @return bool false if an error occurred |
|
56 | - */ |
|
57 | - public function setReadfile($path) { |
|
58 | - if (is_resource($path)) { |
|
59 | - $output = fopen('php://output', 'w'); |
|
60 | - return stream_copy_to_stream($path, $output) > 0; |
|
61 | - } else { |
|
62 | - return @readfile($path); |
|
63 | - } |
|
64 | - } |
|
52 | + /** |
|
53 | + * @param string|resource $path or file handle |
|
54 | + * |
|
55 | + * @return bool false if an error occurred |
|
56 | + */ |
|
57 | + public function setReadfile($path) { |
|
58 | + if (is_resource($path)) { |
|
59 | + $output = fopen('php://output', 'w'); |
|
60 | + return stream_copy_to_stream($path, $output) > 0; |
|
61 | + } else { |
|
62 | + return @readfile($path); |
|
63 | + } |
|
64 | + } |
|
65 | 65 | |
66 | - /** |
|
67 | - * @param string $header |
|
68 | - */ |
|
69 | - public function setHeader($header) { |
|
70 | - header($header); |
|
71 | - } |
|
66 | + /** |
|
67 | + * @param string $header |
|
68 | + */ |
|
69 | + public function setHeader($header) { |
|
70 | + header($header); |
|
71 | + } |
|
72 | 72 | |
73 | - /** |
|
74 | - * @param int $code sets the http status code |
|
75 | - */ |
|
76 | - public function setHttpResponseCode($code) { |
|
77 | - http_response_code($code); |
|
78 | - } |
|
73 | + /** |
|
74 | + * @param int $code sets the http status code |
|
75 | + */ |
|
76 | + public function setHttpResponseCode($code) { |
|
77 | + http_response_code($code); |
|
78 | + } |
|
79 | 79 | |
80 | - /** |
|
81 | - * @return int returns the current http response code |
|
82 | - */ |
|
83 | - public function getHttpResponseCode() { |
|
84 | - return http_response_code(); |
|
85 | - } |
|
80 | + /** |
|
81 | + * @return int returns the current http response code |
|
82 | + */ |
|
83 | + public function getHttpResponseCode() { |
|
84 | + return http_response_code(); |
|
85 | + } |
|
86 | 86 | |
87 | - /** |
|
88 | - * @param string $name |
|
89 | - * @param string $value |
|
90 | - * @param int $expire |
|
91 | - * @param string $path |
|
92 | - * @param string $domain |
|
93 | - * @param bool $secure |
|
94 | - * @param bool $httpOnly |
|
95 | - */ |
|
96 | - public function setCookie($name, $value, $expire, $path, $domain, $secure, $httpOnly, $sameSite = 'Lax') { |
|
97 | - $path = $this->webRoot ? : '/'; |
|
87 | + /** |
|
88 | + * @param string $name |
|
89 | + * @param string $value |
|
90 | + * @param int $expire |
|
91 | + * @param string $path |
|
92 | + * @param string $domain |
|
93 | + * @param bool $secure |
|
94 | + * @param bool $httpOnly |
|
95 | + */ |
|
96 | + public function setCookie($name, $value, $expire, $path, $domain, $secure, $httpOnly, $sameSite = 'Lax') { |
|
97 | + $path = $this->webRoot ? : '/'; |
|
98 | 98 | |
99 | - setcookie($name, $value, [ |
|
100 | - 'expires' => $expire, |
|
101 | - 'path' => $path, |
|
102 | - 'domain' => $domain, |
|
103 | - 'secure' => $secure, |
|
104 | - 'httponly' => $httpOnly, |
|
105 | - 'samesite' => $sameSite |
|
106 | - ]); |
|
107 | - } |
|
99 | + setcookie($name, $value, [ |
|
100 | + 'expires' => $expire, |
|
101 | + 'path' => $path, |
|
102 | + 'domain' => $domain, |
|
103 | + 'secure' => $secure, |
|
104 | + 'httponly' => $httpOnly, |
|
105 | + 'samesite' => $sameSite |
|
106 | + ]); |
|
107 | + } |
|
108 | 108 | } |
@@ -34,8 +34,8 @@ |
||
34 | 34 | $prefix = (string)$_POST['ldap_serverconfig_chooser']; |
35 | 35 | $helper = new \OCA\User_LDAP\Helper(\OC::$server->getConfig(), \OC::$server->getDatabaseConnection()); |
36 | 36 | if ($helper->deleteServerConfiguration($prefix)) { |
37 | - \OC_JSON::success(); |
|
37 | + \OC_JSON::success(); |
|
38 | 38 | } else { |
39 | - $l = \OC::$server->getL10N('user_ldap'); |
|
40 | - \OC_JSON::error(['message' => $l->t('Failed to delete the server configuration')]); |
|
39 | + $l = \OC::$server->getL10N('user_ldap'); |
|
40 | + \OC_JSON::error(['message' => $l->t('Failed to delete the server configuration')]); |
|
41 | 41 | } |
@@ -37,57 +37,57 @@ |
||
37 | 37 | use Symfony\Component\Console\Output\OutputInterface; |
38 | 38 | |
39 | 39 | class SetConfig extends Command { |
40 | - protected function configure() { |
|
41 | - $this |
|
42 | - ->setName('ldap:set-config') |
|
43 | - ->setDescription('modifies an LDAP configuration') |
|
44 | - ->addArgument( |
|
45 | - 'configID', |
|
46 | - InputArgument::REQUIRED, |
|
47 | - 'the configuration ID' |
|
48 | - ) |
|
49 | - ->addArgument( |
|
50 | - 'configKey', |
|
51 | - InputArgument::REQUIRED, |
|
52 | - 'the configuration key' |
|
53 | - ) |
|
54 | - ->addArgument( |
|
55 | - 'configValue', |
|
56 | - InputArgument::REQUIRED, |
|
57 | - 'the new configuration value' |
|
58 | - ) |
|
59 | - ; |
|
60 | - } |
|
40 | + protected function configure() { |
|
41 | + $this |
|
42 | + ->setName('ldap:set-config') |
|
43 | + ->setDescription('modifies an LDAP configuration') |
|
44 | + ->addArgument( |
|
45 | + 'configID', |
|
46 | + InputArgument::REQUIRED, |
|
47 | + 'the configuration ID' |
|
48 | + ) |
|
49 | + ->addArgument( |
|
50 | + 'configKey', |
|
51 | + InputArgument::REQUIRED, |
|
52 | + 'the configuration key' |
|
53 | + ) |
|
54 | + ->addArgument( |
|
55 | + 'configValue', |
|
56 | + InputArgument::REQUIRED, |
|
57 | + 'the new configuration value' |
|
58 | + ) |
|
59 | + ; |
|
60 | + } |
|
61 | 61 | |
62 | - protected function execute(InputInterface $input, OutputInterface $output): int { |
|
63 | - $helper = new Helper(\OC::$server->getConfig(), \OC::$server->getDatabaseConnection()); |
|
64 | - $availableConfigs = $helper->getServerConfigurationPrefixes(); |
|
65 | - $configID = $input->getArgument('configID'); |
|
66 | - if (!in_array($configID, $availableConfigs)) { |
|
67 | - $output->writeln("Invalid configID"); |
|
68 | - return 1; |
|
69 | - } |
|
62 | + protected function execute(InputInterface $input, OutputInterface $output): int { |
|
63 | + $helper = new Helper(\OC::$server->getConfig(), \OC::$server->getDatabaseConnection()); |
|
64 | + $availableConfigs = $helper->getServerConfigurationPrefixes(); |
|
65 | + $configID = $input->getArgument('configID'); |
|
66 | + if (!in_array($configID, $availableConfigs)) { |
|
67 | + $output->writeln("Invalid configID"); |
|
68 | + return 1; |
|
69 | + } |
|
70 | 70 | |
71 | - $this->setValue( |
|
72 | - $configID, |
|
73 | - $input->getArgument('configKey'), |
|
74 | - $input->getArgument('configValue') |
|
75 | - ); |
|
76 | - return 0; |
|
77 | - } |
|
71 | + $this->setValue( |
|
72 | + $configID, |
|
73 | + $input->getArgument('configKey'), |
|
74 | + $input->getArgument('configValue') |
|
75 | + ); |
|
76 | + return 0; |
|
77 | + } |
|
78 | 78 | |
79 | - /** |
|
80 | - * save the configuration value as provided |
|
81 | - * @param string $configID |
|
82 | - * @param string $configKey |
|
83 | - * @param string $configValue |
|
84 | - */ |
|
85 | - protected function setValue($configID, $key, $value) { |
|
86 | - $configHolder = new Configuration($configID); |
|
87 | - $configHolder->$key = $value; |
|
88 | - $configHolder->saveConfiguration(); |
|
79 | + /** |
|
80 | + * save the configuration value as provided |
|
81 | + * @param string $configID |
|
82 | + * @param string $configKey |
|
83 | + * @param string $configValue |
|
84 | + */ |
|
85 | + protected function setValue($configID, $key, $value) { |
|
86 | + $configHolder = new Configuration($configID); |
|
87 | + $configHolder->$key = $value; |
|
88 | + $configHolder->saveConfiguration(); |
|
89 | 89 | |
90 | - $connectionFactory = new ConnectionFactory(new LDAP()); |
|
91 | - $connectionFactory->get($configID)->clearCache(); |
|
92 | - } |
|
90 | + $connectionFactory = new ConnectionFactory(new LDAP()); |
|
91 | + $connectionFactory->get($configID)->clearCache(); |
|
92 | + } |
|
93 | 93 | } |
@@ -5,18 +5,18 @@ |
||
5 | 5 | style('core', ['styles', 'header']); |
6 | 6 | |
7 | 7 | function print_exception(Throwable $e, \OCP\IL10N $l): void { |
8 | - print_unescaped('<pre>'); |
|
9 | - p($e->getTraceAsString()); |
|
10 | - print_unescaped('</pre>'); |
|
8 | + print_unescaped('<pre>'); |
|
9 | + p($e->getTraceAsString()); |
|
10 | + print_unescaped('</pre>'); |
|
11 | 11 | |
12 | - if ($e->getPrevious() !== null) { |
|
13 | - print_unescaped('<br />'); |
|
14 | - print_unescaped('<h4>'); |
|
15 | - p($l->t('Previous')); |
|
16 | - print_unescaped('</h4>'); |
|
12 | + if ($e->getPrevious() !== null) { |
|
13 | + print_unescaped('<br />'); |
|
14 | + print_unescaped('<h4>'); |
|
15 | + p($l->t('Previous')); |
|
16 | + print_unescaped('</h4>'); |
|
17 | 17 | |
18 | - print_exception($e->getPrevious(), $l); |
|
19 | - } |
|
18 | + print_exception($e->getPrevious(), $l); |
|
19 | + } |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | ?> |
@@ -32,34 +32,34 @@ |
||
32 | 32 | use OCP\Migration\SimpleMigrationStep; |
33 | 33 | |
34 | 34 | class Version20000Date20201109081915 extends SimpleMigrationStep { |
35 | - /** |
|
36 | - * @param IOutput $output |
|
37 | - * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
38 | - * @param array $options |
|
39 | - * @return null|ISchemaWrapper |
|
40 | - */ |
|
41 | - public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { |
|
42 | - /** @var ISchemaWrapper $schema */ |
|
43 | - $schema = $schemaClosure(); |
|
35 | + /** |
|
36 | + * @param IOutput $output |
|
37 | + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
38 | + * @param array $options |
|
39 | + * @return null|ISchemaWrapper |
|
40 | + */ |
|
41 | + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { |
|
42 | + /** @var ISchemaWrapper $schema */ |
|
43 | + $schema = $schemaClosure(); |
|
44 | 44 | |
45 | - $result = $this->ensureColumnIsNullable($schema, 'share', 'password_by_talk'); |
|
46 | - $result = $this->ensureColumnIsNullable($schema, 'share', 'hide_download') || $result; |
|
45 | + $result = $this->ensureColumnIsNullable($schema, 'share', 'password_by_talk'); |
|
46 | + $result = $this->ensureColumnIsNullable($schema, 'share', 'hide_download') || $result; |
|
47 | 47 | // $result = $this->ensureColumnIsNullable($schema, 'credentials', 'user') || $result; |
48 | - $result = $this->ensureColumnIsNullable($schema, 'authtoken', 'password_invalid') || $result; |
|
49 | - $result = $this->ensureColumnIsNullable($schema, 'collres_accesscache', 'access') || $result; |
|
48 | + $result = $this->ensureColumnIsNullable($schema, 'authtoken', 'password_invalid') || $result; |
|
49 | + $result = $this->ensureColumnIsNullable($schema, 'collres_accesscache', 'access') || $result; |
|
50 | 50 | |
51 | - return $result ? $schema : null; |
|
52 | - } |
|
51 | + return $result ? $schema : null; |
|
52 | + } |
|
53 | 53 | |
54 | - protected function ensureColumnIsNullable(ISchemaWrapper $schema, string $tableName, string $columnName): bool { |
|
55 | - $table = $schema->getTable($tableName); |
|
56 | - $column = $table->getColumn($columnName); |
|
54 | + protected function ensureColumnIsNullable(ISchemaWrapper $schema, string $tableName, string $columnName): bool { |
|
55 | + $table = $schema->getTable($tableName); |
|
56 | + $column = $table->getColumn($columnName); |
|
57 | 57 | |
58 | - if ($column->getNotnull()) { |
|
59 | - $column->setNotnull(false); |
|
60 | - return true; |
|
61 | - } |
|
58 | + if ($column->getNotnull()) { |
|
59 | + $column->setNotnull(false); |
|
60 | + return true; |
|
61 | + } |
|
62 | 62 | |
63 | - return false; |
|
64 | - } |
|
63 | + return false; |
|
64 | + } |
|
65 | 65 | } |
@@ -34,19 +34,19 @@ |
||
34 | 34 | use OCP\Migration\SimpleMigrationStep; |
35 | 35 | |
36 | 36 | class Version14000Date20180710092004 extends SimpleMigrationStep { |
37 | - public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { |
|
38 | - /** @var ISchemaWrapper $schema */ |
|
39 | - $schema = $schemaClosure(); |
|
37 | + public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { |
|
38 | + /** @var ISchemaWrapper $schema */ |
|
39 | + $schema = $schemaClosure(); |
|
40 | 40 | |
41 | - $table = $schema->getTable('share'); |
|
41 | + $table = $schema->getTable('share'); |
|
42 | 42 | |
43 | - if (!$table->hasColumn('password_by_talk')) { |
|
44 | - $table->addColumn('password_by_talk', Types::BOOLEAN, [ |
|
45 | - 'default' => 0, |
|
46 | - 'notnull' => false, |
|
47 | - ]); |
|
48 | - } |
|
43 | + if (!$table->hasColumn('password_by_talk')) { |
|
44 | + $table->addColumn('password_by_talk', Types::BOOLEAN, [ |
|
45 | + 'default' => 0, |
|
46 | + 'notnull' => false, |
|
47 | + ]); |
|
48 | + } |
|
49 | 49 | |
50 | - return $schema; |
|
51 | - } |
|
50 | + return $schema; |
|
51 | + } |
|
52 | 52 | } |
@@ -32,30 +32,30 @@ |
||
32 | 32 | use OCP\Migration\SimpleMigrationStep; |
33 | 33 | |
34 | 34 | class Version1016Date20201109085907 extends SimpleMigrationStep { |
35 | - /** |
|
36 | - * @param IOutput $output |
|
37 | - * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
38 | - * @param array $options |
|
39 | - * @return null|ISchemaWrapper |
|
40 | - */ |
|
41 | - public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { |
|
42 | - /** @var ISchemaWrapper $schema */ |
|
43 | - $schema = $schemaClosure(); |
|
44 | - |
|
45 | - $result = $this->ensureColumnIsNullable($schema, 'calendar_reminders', 'is_recurring'); |
|
46 | - |
|
47 | - return $result ? $schema : null; |
|
48 | - } |
|
49 | - |
|
50 | - protected function ensureColumnIsNullable(ISchemaWrapper $schema, string $tableName, string $columnName): bool { |
|
51 | - $table = $schema->getTable($tableName); |
|
52 | - $column = $table->getColumn($columnName); |
|
53 | - |
|
54 | - if ($column->getNotnull()) { |
|
55 | - $column->setNotnull(false); |
|
56 | - return true; |
|
57 | - } |
|
58 | - |
|
59 | - return false; |
|
60 | - } |
|
35 | + /** |
|
36 | + * @param IOutput $output |
|
37 | + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
38 | + * @param array $options |
|
39 | + * @return null|ISchemaWrapper |
|
40 | + */ |
|
41 | + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { |
|
42 | + /** @var ISchemaWrapper $schema */ |
|
43 | + $schema = $schemaClosure(); |
|
44 | + |
|
45 | + $result = $this->ensureColumnIsNullable($schema, 'calendar_reminders', 'is_recurring'); |
|
46 | + |
|
47 | + return $result ? $schema : null; |
|
48 | + } |
|
49 | + |
|
50 | + protected function ensureColumnIsNullable(ISchemaWrapper $schema, string $tableName, string $columnName): bool { |
|
51 | + $table = $schema->getTable($tableName); |
|
52 | + $column = $table->getColumn($columnName); |
|
53 | + |
|
54 | + if ($column->getNotnull()) { |
|
55 | + $column->setNotnull(false); |
|
56 | + return true; |
|
57 | + } |
|
58 | + |
|
59 | + return false; |
|
60 | + } |
|
61 | 61 | } |
@@ -38,86 +38,86 @@ |
||
38 | 38 | */ |
39 | 39 | class Version1012Date20190808122342 extends SimpleMigrationStep { |
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 17.0.0 |
|
47 | - */ |
|
48 | - public function changeSchema(IOutput $output, |
|
49 | - \Closure $schemaClosure, |
|
50 | - array $options):?ISchemaWrapper { |
|
51 | - /** @var ISchemaWrapper $schema */ |
|
52 | - $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 17.0.0 |
|
47 | + */ |
|
48 | + public function changeSchema(IOutput $output, |
|
49 | + \Closure $schemaClosure, |
|
50 | + array $options):?ISchemaWrapper { |
|
51 | + /** @var ISchemaWrapper $schema */ |
|
52 | + $schema = $schemaClosure(); |
|
53 | 53 | |
54 | - if (!$schema->hasTable('calendar_reminders')) { |
|
55 | - $table = $schema->createTable('calendar_reminders'); |
|
54 | + if (!$schema->hasTable('calendar_reminders')) { |
|
55 | + $table = $schema->createTable('calendar_reminders'); |
|
56 | 56 | |
57 | - $table->addColumn('id', Types::BIGINT, [ |
|
58 | - 'autoincrement' => true, |
|
59 | - 'notnull' => true, |
|
60 | - 'length' => 11, |
|
61 | - 'unsigned' => true, |
|
62 | - ]); |
|
63 | - $table->addColumn('calendar_id', Types::BIGINT, [ |
|
64 | - 'notnull' => true, |
|
65 | - 'length' => 11, |
|
66 | - ]); |
|
67 | - $table->addColumn('object_id', Types::BIGINT, [ |
|
68 | - 'notnull' => true, |
|
69 | - 'length' => 11, |
|
70 | - ]); |
|
71 | - $table->addColumn('is_recurring', Types::SMALLINT, [ |
|
72 | - 'notnull' => false, |
|
73 | - 'length' => 1, |
|
74 | - ]); |
|
75 | - $table->addColumn('uid', Types::STRING, [ |
|
76 | - 'notnull' => true, |
|
77 | - 'length' => 255, |
|
78 | - ]); |
|
79 | - $table->addColumn('recurrence_id', Types::BIGINT, [ |
|
80 | - 'notnull' => false, |
|
81 | - 'length' => 11, |
|
82 | - 'unsigned' => true, |
|
83 | - ]); |
|
84 | - $table->addColumn('is_recurrence_exception', Types::SMALLINT, [ |
|
85 | - 'notnull' => true, |
|
86 | - 'length' => 1, |
|
87 | - ]); |
|
88 | - $table->addColumn('event_hash', Types::STRING, [ |
|
89 | - 'notnull' => true, |
|
90 | - 'length' => 255, |
|
91 | - ]); |
|
92 | - $table->addColumn('alarm_hash', Types::STRING, [ |
|
93 | - 'notnull' => true, |
|
94 | - 'length' => 255, |
|
95 | - ]); |
|
96 | - $table->addColumn('type', Types::STRING, [ |
|
97 | - 'notnull' => true, |
|
98 | - 'length' => 255, |
|
99 | - ]); |
|
100 | - $table->addColumn('is_relative', Types::SMALLINT, [ |
|
101 | - 'notnull' => true, |
|
102 | - 'length' => 1, |
|
103 | - ]); |
|
104 | - $table->addColumn('notification_date', Types::BIGINT, [ |
|
105 | - 'notnull' => true, |
|
106 | - 'length' => 11, |
|
107 | - 'unsigned' => true, |
|
108 | - ]); |
|
109 | - $table->addColumn('is_repeat_based', Types::SMALLINT, [ |
|
110 | - 'notnull' => true, |
|
111 | - 'length' => 1, |
|
112 | - ]); |
|
57 | + $table->addColumn('id', Types::BIGINT, [ |
|
58 | + 'autoincrement' => true, |
|
59 | + 'notnull' => true, |
|
60 | + 'length' => 11, |
|
61 | + 'unsigned' => true, |
|
62 | + ]); |
|
63 | + $table->addColumn('calendar_id', Types::BIGINT, [ |
|
64 | + 'notnull' => true, |
|
65 | + 'length' => 11, |
|
66 | + ]); |
|
67 | + $table->addColumn('object_id', Types::BIGINT, [ |
|
68 | + 'notnull' => true, |
|
69 | + 'length' => 11, |
|
70 | + ]); |
|
71 | + $table->addColumn('is_recurring', Types::SMALLINT, [ |
|
72 | + 'notnull' => false, |
|
73 | + 'length' => 1, |
|
74 | + ]); |
|
75 | + $table->addColumn('uid', Types::STRING, [ |
|
76 | + 'notnull' => true, |
|
77 | + 'length' => 255, |
|
78 | + ]); |
|
79 | + $table->addColumn('recurrence_id', Types::BIGINT, [ |
|
80 | + 'notnull' => false, |
|
81 | + 'length' => 11, |
|
82 | + 'unsigned' => true, |
|
83 | + ]); |
|
84 | + $table->addColumn('is_recurrence_exception', Types::SMALLINT, [ |
|
85 | + 'notnull' => true, |
|
86 | + 'length' => 1, |
|
87 | + ]); |
|
88 | + $table->addColumn('event_hash', Types::STRING, [ |
|
89 | + 'notnull' => true, |
|
90 | + 'length' => 255, |
|
91 | + ]); |
|
92 | + $table->addColumn('alarm_hash', Types::STRING, [ |
|
93 | + 'notnull' => true, |
|
94 | + 'length' => 255, |
|
95 | + ]); |
|
96 | + $table->addColumn('type', Types::STRING, [ |
|
97 | + 'notnull' => true, |
|
98 | + 'length' => 255, |
|
99 | + ]); |
|
100 | + $table->addColumn('is_relative', Types::SMALLINT, [ |
|
101 | + 'notnull' => true, |
|
102 | + 'length' => 1, |
|
103 | + ]); |
|
104 | + $table->addColumn('notification_date', Types::BIGINT, [ |
|
105 | + 'notnull' => true, |
|
106 | + 'length' => 11, |
|
107 | + 'unsigned' => true, |
|
108 | + ]); |
|
109 | + $table->addColumn('is_repeat_based', Types::SMALLINT, [ |
|
110 | + 'notnull' => true, |
|
111 | + 'length' => 1, |
|
112 | + ]); |
|
113 | 113 | |
114 | - $table->setPrimaryKey(['id']); |
|
115 | - $table->addIndex(['object_id'], 'calendar_reminder_objid'); |
|
116 | - $table->addIndex(['uid', 'recurrence_id'], 'calendar_reminder_uidrec'); |
|
114 | + $table->setPrimaryKey(['id']); |
|
115 | + $table->addIndex(['object_id'], 'calendar_reminder_objid'); |
|
116 | + $table->addIndex(['uid', 'recurrence_id'], 'calendar_reminder_uidrec'); |
|
117 | 117 | |
118 | - return $schema; |
|
119 | - } |
|
118 | + return $schema; |
|
119 | + } |
|
120 | 120 | |
121 | - return null; |
|
122 | - } |
|
121 | + return null; |
|
122 | + } |
|
123 | 123 | } |