@@ -29,25 +29,25 @@ |
||
29 | 29 | use OCP\IUserSession; |
30 | 30 | |
31 | 31 | class PersonalSection extends Section { |
32 | - /** @var IUserSession */ |
|
33 | - private $userSession; |
|
32 | + /** @var IUserSession */ |
|
33 | + private $userSession; |
|
34 | 34 | |
35 | - /** @var UserGlobalStoragesService */ |
|
36 | - private $userGlobalStoragesService; |
|
35 | + /** @var UserGlobalStoragesService */ |
|
36 | + private $userGlobalStoragesService; |
|
37 | 37 | |
38 | - /** @var BackendService */ |
|
39 | - private $backendService; |
|
38 | + /** @var BackendService */ |
|
39 | + private $backendService; |
|
40 | 40 | |
41 | - public function __construct( |
|
42 | - IURLGenerator $url, |
|
43 | - IL10N $l, |
|
44 | - IUserSession $userSession, |
|
45 | - UserGlobalStoragesService $userGlobalStoragesService, |
|
46 | - BackendService $backendService |
|
47 | - ) { |
|
48 | - parent::__construct($url, $l); |
|
49 | - $this->userSession = $userSession; |
|
50 | - $this->userGlobalStoragesService = $userGlobalStoragesService; |
|
51 | - $this->backendService = $backendService; |
|
52 | - } |
|
41 | + public function __construct( |
|
42 | + IURLGenerator $url, |
|
43 | + IL10N $l, |
|
44 | + IUserSession $userSession, |
|
45 | + UserGlobalStoragesService $userGlobalStoragesService, |
|
46 | + BackendService $backendService |
|
47 | + ) { |
|
48 | + parent::__construct($url, $l); |
|
49 | + $this->userSession = $userSession; |
|
50 | + $this->userGlobalStoragesService = $userGlobalStoragesService; |
|
51 | + $this->backendService = $backendService; |
|
52 | + } |
|
53 | 53 | } |
@@ -29,68 +29,68 @@ |
||
29 | 29 | use OCP\Diagnostics\IQueryLogger; |
30 | 30 | |
31 | 31 | class QueryLogger implements IQueryLogger { |
32 | - /** |
|
33 | - * @var \OC\Diagnostics\Query |
|
34 | - */ |
|
35 | - protected $activeQuery; |
|
32 | + /** |
|
33 | + * @var \OC\Diagnostics\Query |
|
34 | + */ |
|
35 | + protected $activeQuery; |
|
36 | 36 | |
37 | - /** |
|
38 | - * @var CappedMemoryCache |
|
39 | - */ |
|
40 | - protected $queries; |
|
37 | + /** |
|
38 | + * @var CappedMemoryCache |
|
39 | + */ |
|
40 | + protected $queries; |
|
41 | 41 | |
42 | - /** |
|
43 | - * QueryLogger constructor. |
|
44 | - */ |
|
45 | - public function __construct() { |
|
46 | - $this->queries = new CappedMemoryCache(1024); |
|
47 | - } |
|
42 | + /** |
|
43 | + * QueryLogger constructor. |
|
44 | + */ |
|
45 | + public function __construct() { |
|
46 | + $this->queries = new CappedMemoryCache(1024); |
|
47 | + } |
|
48 | 48 | |
49 | 49 | |
50 | - /** |
|
51 | - * @var bool - Module needs to be activated by some app |
|
52 | - */ |
|
53 | - private $activated = false; |
|
50 | + /** |
|
51 | + * @var bool - Module needs to be activated by some app |
|
52 | + */ |
|
53 | + private $activated = false; |
|
54 | 54 | |
55 | - /** |
|
56 | - * @inheritdoc |
|
57 | - */ |
|
58 | - public function startQuery($sql, array $params = null, array $types = null) { |
|
59 | - if ($this->activated) { |
|
60 | - $this->activeQuery = new Query($sql, $params, microtime(true), $this->getStack()); |
|
61 | - } |
|
62 | - } |
|
55 | + /** |
|
56 | + * @inheritdoc |
|
57 | + */ |
|
58 | + public function startQuery($sql, array $params = null, array $types = null) { |
|
59 | + if ($this->activated) { |
|
60 | + $this->activeQuery = new Query($sql, $params, microtime(true), $this->getStack()); |
|
61 | + } |
|
62 | + } |
|
63 | 63 | |
64 | - private function getStack() { |
|
65 | - $stack = debug_backtrace(); |
|
66 | - array_shift($stack); |
|
67 | - array_shift($stack); |
|
68 | - array_shift($stack); |
|
69 | - return $stack; |
|
70 | - } |
|
64 | + private function getStack() { |
|
65 | + $stack = debug_backtrace(); |
|
66 | + array_shift($stack); |
|
67 | + array_shift($stack); |
|
68 | + array_shift($stack); |
|
69 | + return $stack; |
|
70 | + } |
|
71 | 71 | |
72 | - /** |
|
73 | - * @inheritdoc |
|
74 | - */ |
|
75 | - public function stopQuery() { |
|
76 | - if ($this->activated && $this->activeQuery) { |
|
77 | - $this->activeQuery->end(microtime(true)); |
|
78 | - $this->queries[] = $this->activeQuery; |
|
79 | - $this->activeQuery = null; |
|
80 | - } |
|
81 | - } |
|
72 | + /** |
|
73 | + * @inheritdoc |
|
74 | + */ |
|
75 | + public function stopQuery() { |
|
76 | + if ($this->activated && $this->activeQuery) { |
|
77 | + $this->activeQuery->end(microtime(true)); |
|
78 | + $this->queries[] = $this->activeQuery; |
|
79 | + $this->activeQuery = null; |
|
80 | + } |
|
81 | + } |
|
82 | 82 | |
83 | - /** |
|
84 | - * @inheritdoc |
|
85 | - */ |
|
86 | - public function getQueries() { |
|
87 | - return $this->queries->getData(); |
|
88 | - } |
|
83 | + /** |
|
84 | + * @inheritdoc |
|
85 | + */ |
|
86 | + public function getQueries() { |
|
87 | + return $this->queries->getData(); |
|
88 | + } |
|
89 | 89 | |
90 | - /** |
|
91 | - * @inheritdoc |
|
92 | - */ |
|
93 | - public function activate() { |
|
94 | - $this->activated = true; |
|
95 | - } |
|
90 | + /** |
|
91 | + * @inheritdoc |
|
92 | + */ |
|
93 | + public function activate() { |
|
94 | + $this->activated = true; |
|
95 | + } |
|
96 | 96 | } |
@@ -60,14 +60,14 @@ discard block |
||
60 | 60 | $appName = $input->getArgument('app'); |
61 | 61 | $version = $input->getArgument('version'); |
62 | 62 | |
63 | - if (!preg_match('/^\d{1,16}$/',$version)) { |
|
63 | + if (!preg_match('/^\d{1,16}$/', $version)) { |
|
64 | 64 | $output->writeln('<error>The given version is invalid. Only 0-9 are allowed (max. 16 digits)</error>'); |
65 | 65 | return 1; |
66 | 66 | } |
67 | 67 | |
68 | - $schemaFile = $this->appManager->getAppPath($appName) . '/appinfo/database.xml'; |
|
68 | + $schemaFile = $this->appManager->getAppPath($appName).'/appinfo/database.xml'; |
|
69 | 69 | if (!file_exists($schemaFile)) { |
70 | - $output->writeln('<error>App ' . $appName . ' does not have a database.xml file</error>'); |
|
70 | + $output->writeln('<error>App '.$appName.' does not have a database.xml file</error>'); |
|
71 | 71 | return 2; |
72 | 72 | } |
73 | 73 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $ms = new MigrationService($appName, $this->connection, new ConsoleOutput($output)); |
81 | 81 | |
82 | 82 | $date = date('YmdHis'); |
83 | - $path = $this->generateMigration($ms, 'Version' . $version . 'Date' . $date, $schemaBody); |
|
83 | + $path = $this->generateMigration($ms, 'Version'.$version.'Date'.$date, $schemaBody); |
|
84 | 84 | |
85 | 85 | $output->writeln("New migration class has been generated to <info>$path</info>"); |
86 | 86 | return 0; |
@@ -37,170 +37,170 @@ |
||
37 | 37 | |
38 | 38 | class GenerateFromSchemaFileCommand extends GenerateCommand { |
39 | 39 | |
40 | - /** @var IConfig */ |
|
41 | - protected $config; |
|
40 | + /** @var IConfig */ |
|
41 | + protected $config; |
|
42 | 42 | |
43 | - public function __construct(IConfig $config, IAppManager $appManager, Connection $connection) { |
|
44 | - parent::__construct($connection, $appManager); |
|
45 | - $this->config = $config; |
|
46 | - } |
|
43 | + public function __construct(IConfig $config, IAppManager $appManager, Connection $connection) { |
|
44 | + parent::__construct($connection, $appManager); |
|
45 | + $this->config = $config; |
|
46 | + } |
|
47 | 47 | |
48 | 48 | |
49 | - protected function configure() { |
|
50 | - parent::configure(); |
|
49 | + protected function configure() { |
|
50 | + parent::configure(); |
|
51 | 51 | |
52 | - $this->setName('migrations:generate-from-schema'); |
|
53 | - } |
|
52 | + $this->setName('migrations:generate-from-schema'); |
|
53 | + } |
|
54 | 54 | |
55 | - public function execute(InputInterface $input, OutputInterface $output): int { |
|
56 | - $appName = $input->getArgument('app'); |
|
57 | - $version = $input->getArgument('version'); |
|
55 | + public function execute(InputInterface $input, OutputInterface $output): int { |
|
56 | + $appName = $input->getArgument('app'); |
|
57 | + $version = $input->getArgument('version'); |
|
58 | 58 | |
59 | - if (!preg_match('/^\d{1,16}$/',$version)) { |
|
60 | - $output->writeln('<error>The given version is invalid. Only 0-9 are allowed (max. 16 digits)</error>'); |
|
61 | - return 1; |
|
62 | - } |
|
59 | + if (!preg_match('/^\d{1,16}$/',$version)) { |
|
60 | + $output->writeln('<error>The given version is invalid. Only 0-9 are allowed (max. 16 digits)</error>'); |
|
61 | + return 1; |
|
62 | + } |
|
63 | 63 | |
64 | - $schemaFile = $this->appManager->getAppPath($appName) . '/appinfo/database.xml'; |
|
65 | - if (!file_exists($schemaFile)) { |
|
66 | - $output->writeln('<error>App ' . $appName . ' does not have a database.xml file</error>'); |
|
67 | - return 2; |
|
68 | - } |
|
64 | + $schemaFile = $this->appManager->getAppPath($appName) . '/appinfo/database.xml'; |
|
65 | + if (!file_exists($schemaFile)) { |
|
66 | + $output->writeln('<error>App ' . $appName . ' does not have a database.xml file</error>'); |
|
67 | + return 2; |
|
68 | + } |
|
69 | 69 | |
70 | - $reader = new MDB2SchemaReader($this->config, $this->connection->getDatabasePlatform()); |
|
71 | - $schema = new Schema(); |
|
72 | - $reader->loadSchemaFromFile($schemaFile, $schema); |
|
70 | + $reader = new MDB2SchemaReader($this->config, $this->connection->getDatabasePlatform()); |
|
71 | + $schema = new Schema(); |
|
72 | + $reader->loadSchemaFromFile($schemaFile, $schema); |
|
73 | 73 | |
74 | - $schemaBody = $this->schemaToMigration($schema); |
|
74 | + $schemaBody = $this->schemaToMigration($schema); |
|
75 | 75 | |
76 | - $ms = new MigrationService($appName, $this->connection, new ConsoleOutput($output)); |
|
76 | + $ms = new MigrationService($appName, $this->connection, new ConsoleOutput($output)); |
|
77 | 77 | |
78 | - $date = date('YmdHis'); |
|
79 | - $path = $this->generateMigration($ms, 'Version' . $version . 'Date' . $date, $schemaBody); |
|
78 | + $date = date('YmdHis'); |
|
79 | + $path = $this->generateMigration($ms, 'Version' . $version . 'Date' . $date, $schemaBody); |
|
80 | 80 | |
81 | - $output->writeln("New migration class has been generated to <info>$path</info>"); |
|
82 | - return 0; |
|
83 | - } |
|
81 | + $output->writeln("New migration class has been generated to <info>$path</info>"); |
|
82 | + return 0; |
|
83 | + } |
|
84 | 84 | |
85 | - /** |
|
86 | - * @param Schema $schema |
|
87 | - * @return string |
|
88 | - */ |
|
89 | - protected function schemaToMigration(Schema $schema) { |
|
90 | - $content = <<<'EOT' |
|
85 | + /** |
|
86 | + * @param Schema $schema |
|
87 | + * @return string |
|
88 | + */ |
|
89 | + protected function schemaToMigration(Schema $schema) { |
|
90 | + $content = <<<'EOT' |
|
91 | 91 | /** @var ISchemaWrapper $schema */ |
92 | 92 | $schema = $schemaClosure(); |
93 | 93 | |
94 | 94 | EOT; |
95 | 95 | |
96 | - foreach ($schema->getTables() as $table) { |
|
97 | - $content .= str_replace('{{table-name}}', substr($table->getName(), 3), <<<'EOT' |
|
96 | + foreach ($schema->getTables() as $table) { |
|
97 | + $content .= str_replace('{{table-name}}', substr($table->getName(), 3), <<<'EOT' |
|
98 | 98 | |
99 | 99 | if (!$schema->hasTable('{{table-name}}')) { |
100 | 100 | $table = $schema->createTable('{{table-name}}'); |
101 | 101 | |
102 | 102 | EOT |
103 | - ); |
|
103 | + ); |
|
104 | 104 | |
105 | - foreach ($table->getColumns() as $column) { |
|
106 | - $content .= str_replace(['{{name}}', '{{type}}'], [$column->getName(), $column->getType()->getName()], <<<'EOT' |
|
105 | + foreach ($table->getColumns() as $column) { |
|
106 | + $content .= str_replace(['{{name}}', '{{type}}'], [$column->getName(), $column->getType()->getName()], <<<'EOT' |
|
107 | 107 | $table->addColumn('{{name}}', '{{type}}', [ |
108 | 108 | |
109 | 109 | EOT |
110 | - ); |
|
111 | - if ($column->getAutoincrement()) { |
|
112 | - $content .= <<<'EOT' |
|
110 | + ); |
|
111 | + if ($column->getAutoincrement()) { |
|
112 | + $content .= <<<'EOT' |
|
113 | 113 | 'autoincrement' => true, |
114 | 114 | |
115 | 115 | EOT; |
116 | - } |
|
117 | - $content .= str_replace('{{notnull}}', $column->getNotnull() ? 'true' : 'false', <<<'EOT' |
|
116 | + } |
|
117 | + $content .= str_replace('{{notnull}}', $column->getNotnull() ? 'true' : 'false', <<<'EOT' |
|
118 | 118 | 'notnull' => {{notnull}}, |
119 | 119 | |
120 | 120 | EOT |
121 | - ); |
|
122 | - if ($column->getLength() !== null) { |
|
123 | - $content .= str_replace('{{length}}', $column->getLength(), <<<'EOT' |
|
121 | + ); |
|
122 | + if ($column->getLength() !== null) { |
|
123 | + $content .= str_replace('{{length}}', $column->getLength(), <<<'EOT' |
|
124 | 124 | 'length' => {{length}}, |
125 | 125 | |
126 | 126 | EOT |
127 | - ); |
|
128 | - } |
|
129 | - $default = $column->getDefault(); |
|
130 | - if ($default !== null) { |
|
131 | - if (is_string($default)) { |
|
132 | - $default = "'$default'"; |
|
133 | - } elseif (is_bool($default)) { |
|
134 | - $default = ($default === true) ? 'true' : 'false'; |
|
135 | - } |
|
136 | - $content .= str_replace('{{default}}', $default, <<<'EOT' |
|
127 | + ); |
|
128 | + } |
|
129 | + $default = $column->getDefault(); |
|
130 | + if ($default !== null) { |
|
131 | + if (is_string($default)) { |
|
132 | + $default = "'$default'"; |
|
133 | + } elseif (is_bool($default)) { |
|
134 | + $default = ($default === true) ? 'true' : 'false'; |
|
135 | + } |
|
136 | + $content .= str_replace('{{default}}', $default, <<<'EOT' |
|
137 | 137 | 'default' => {{default}}, |
138 | 138 | |
139 | 139 | EOT |
140 | - ); |
|
141 | - } |
|
142 | - if ($column->getUnsigned()) { |
|
143 | - $content .= <<<'EOT' |
|
140 | + ); |
|
141 | + } |
|
142 | + if ($column->getUnsigned()) { |
|
143 | + $content .= <<<'EOT' |
|
144 | 144 | 'unsigned' => true, |
145 | 145 | |
146 | 146 | EOT; |
147 | - } |
|
147 | + } |
|
148 | 148 | |
149 | - $content .= <<<'EOT' |
|
149 | + $content .= <<<'EOT' |
|
150 | 150 | ]); |
151 | 151 | |
152 | 152 | EOT; |
153 | - } |
|
153 | + } |
|
154 | 154 | |
155 | - $content .= <<<'EOT' |
|
155 | + $content .= <<<'EOT' |
|
156 | 156 | |
157 | 157 | EOT; |
158 | 158 | |
159 | - $primaryKey = $table->getPrimaryKey(); |
|
160 | - if ($primaryKey !== null) { |
|
161 | - $content .= str_replace('{{columns}}', implode('\', \'', $primaryKey->getUnquotedColumns()), <<<'EOT' |
|
159 | + $primaryKey = $table->getPrimaryKey(); |
|
160 | + if ($primaryKey !== null) { |
|
161 | + $content .= str_replace('{{columns}}', implode('\', \'', $primaryKey->getUnquotedColumns()), <<<'EOT' |
|
162 | 162 | $table->setPrimaryKey(['{{columns}}']); |
163 | 163 | |
164 | 164 | EOT |
165 | - ); |
|
166 | - } |
|
167 | - |
|
168 | - foreach ($table->getIndexes() as $index) { |
|
169 | - if ($index->isPrimary()) { |
|
170 | - continue; |
|
171 | - } |
|
172 | - |
|
173 | - if ($index->isUnique()) { |
|
174 | - $content .= str_replace( |
|
175 | - ['{{columns}}', '{{name}}'], |
|
176 | - [implode('\', \'', $index->getUnquotedColumns()), $index->getName()], |
|
177 | - <<<'EOT' |
|
165 | + ); |
|
166 | + } |
|
167 | + |
|
168 | + foreach ($table->getIndexes() as $index) { |
|
169 | + if ($index->isPrimary()) { |
|
170 | + continue; |
|
171 | + } |
|
172 | + |
|
173 | + if ($index->isUnique()) { |
|
174 | + $content .= str_replace( |
|
175 | + ['{{columns}}', '{{name}}'], |
|
176 | + [implode('\', \'', $index->getUnquotedColumns()), $index->getName()], |
|
177 | + <<<'EOT' |
|
178 | 178 | $table->addUniqueIndex(['{{columns}}'], '{{name}}'); |
179 | 179 | |
180 | 180 | EOT |
181 | - ); |
|
182 | - } else { |
|
183 | - $content .= str_replace( |
|
184 | - ['{{columns}}', '{{name}}'], |
|
185 | - [implode('\', \'', $index->getUnquotedColumns()), $index->getName()], |
|
186 | - <<<'EOT' |
|
181 | + ); |
|
182 | + } else { |
|
183 | + $content .= str_replace( |
|
184 | + ['{{columns}}', '{{name}}'], |
|
185 | + [implode('\', \'', $index->getUnquotedColumns()), $index->getName()], |
|
186 | + <<<'EOT' |
|
187 | 187 | $table->addIndex(['{{columns}}'], '{{name}}'); |
188 | 188 | |
189 | 189 | EOT |
190 | - ); |
|
191 | - } |
|
192 | - } |
|
190 | + ); |
|
191 | + } |
|
192 | + } |
|
193 | 193 | |
194 | - $content .= <<<'EOT' |
|
194 | + $content .= <<<'EOT' |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | EOT; |
198 | - } |
|
198 | + } |
|
199 | 199 | |
200 | - $content .= <<<'EOT' |
|
200 | + $content .= <<<'EOT' |
|
201 | 201 | return $schema; |
202 | 202 | EOT; |
203 | 203 | |
204 | - return $content; |
|
205 | - } |
|
204 | + return $content; |
|
205 | + } |
|
206 | 206 | } |
@@ -29,39 +29,39 @@ |
||
29 | 29 | |
30 | 30 | class ConfigController extends OCSController { |
31 | 31 | |
32 | - /** @var IConfig */ |
|
33 | - private $config; |
|
32 | + /** @var IConfig */ |
|
33 | + private $config; |
|
34 | 34 | |
35 | - /** |
|
36 | - * @param string $appName |
|
37 | - * @param IRequest $request |
|
38 | - * @param IConfig $config |
|
39 | - */ |
|
40 | - public function __construct($appName, |
|
41 | - IRequest $request, |
|
42 | - IConfig $config) { |
|
43 | - parent::__construct($appName, $request); |
|
44 | - $this->config = $config; |
|
45 | - } |
|
35 | + /** |
|
36 | + * @param string $appName |
|
37 | + * @param IRequest $request |
|
38 | + * @param IConfig $config |
|
39 | + */ |
|
40 | + public function __construct($appName, |
|
41 | + IRequest $request, |
|
42 | + IConfig $config) { |
|
43 | + parent::__construct($appName, $request); |
|
44 | + $this->config = $config; |
|
45 | + } |
|
46 | 46 | |
47 | - /** |
|
48 | - * @param string $appid |
|
49 | - * @param string $configkey |
|
50 | - * @param string $value |
|
51 | - * @return DataResponse |
|
52 | - */ |
|
53 | - public function setAppValue($appid, $configkey, $value) { |
|
54 | - $this->config->setAppValue($appid, $configkey, $value); |
|
55 | - return new DataResponse(); |
|
56 | - } |
|
47 | + /** |
|
48 | + * @param string $appid |
|
49 | + * @param string $configkey |
|
50 | + * @param string $value |
|
51 | + * @return DataResponse |
|
52 | + */ |
|
53 | + public function setAppValue($appid, $configkey, $value) { |
|
54 | + $this->config->setAppValue($appid, $configkey, $value); |
|
55 | + return new DataResponse(); |
|
56 | + } |
|
57 | 57 | |
58 | - /** |
|
59 | - * @param string $appid |
|
60 | - * @param string $configkey |
|
61 | - * @return DataResponse |
|
62 | - */ |
|
63 | - public function deleteAppValue($appid, $configkey) { |
|
64 | - $this->config->deleteAppValue($appid, $configkey); |
|
65 | - return new DataResponse(); |
|
66 | - } |
|
58 | + /** |
|
59 | + * @param string $appid |
|
60 | + * @param string $configkey |
|
61 | + * @return DataResponse |
|
62 | + */ |
|
63 | + public function deleteAppValue($appid, $configkey) { |
|
64 | + $this->config->deleteAppValue($appid, $configkey); |
|
65 | + return new DataResponse(); |
|
66 | + } |
|
67 | 67 | } |
@@ -33,12 +33,12 @@ |
||
33 | 33 | */ |
34 | 34 | interface ICallbackResponse { |
35 | 35 | |
36 | - /** |
|
37 | - * Outputs the content that should be printed |
|
38 | - * |
|
39 | - * @param IOutput $output a small wrapper that handles output |
|
40 | - * @since 8.1.0 |
|
41 | - */ |
|
42 | - public function callback(IOutput $output); |
|
36 | + /** |
|
37 | + * Outputs the content that should be printed |
|
38 | + * |
|
39 | + * @param IOutput $output a small wrapper that handles output |
|
40 | + * @since 8.1.0 |
|
41 | + */ |
|
42 | + public function callback(IOutput $output); |
|
43 | 43 | |
44 | 44 | } |
@@ -25,16 +25,16 @@ |
||
25 | 25 | |
26 | 26 | class Exception extends \Exception { |
27 | 27 | |
28 | - /** @var Result */ |
|
29 | - private $result; |
|
28 | + /** @var Result */ |
|
29 | + private $result; |
|
30 | 30 | |
31 | - public function __construct(Result $result) { |
|
32 | - parent::__construct(); |
|
33 | - $this->result = $result; |
|
34 | - } |
|
31 | + public function __construct(Result $result) { |
|
32 | + parent::__construct(); |
|
33 | + $this->result = $result; |
|
34 | + } |
|
35 | 35 | |
36 | - public function getResult() { |
|
37 | - return $this->result; |
|
38 | - } |
|
36 | + public function getResult() { |
|
37 | + return $this->result; |
|
38 | + } |
|
39 | 39 | |
40 | 40 | } |
@@ -32,14 +32,14 @@ |
||
32 | 32 | * @package OC\BackgroundJob |
33 | 33 | */ |
34 | 34 | abstract class QueuedJob extends Job { |
35 | - /** |
|
36 | - * run the job, then remove it from the joblist |
|
37 | - * |
|
38 | - * @param JobList $jobList |
|
39 | - * @param ILogger|null $logger |
|
40 | - */ |
|
41 | - public function execute($jobList, ILogger $logger = null) { |
|
42 | - $jobList->remove($this, $this->argument); |
|
43 | - parent::execute($jobList, $logger); |
|
44 | - } |
|
35 | + /** |
|
36 | + * run the job, then remove it from the joblist |
|
37 | + * |
|
38 | + * @param JobList $jobList |
|
39 | + * @param ILogger|null $logger |
|
40 | + */ |
|
41 | + public function execute($jobList, ILogger $logger = null) { |
|
42 | + $jobList->remove($this, $this->argument); |
|
43 | + parent::execute($jobList, $logger); |
|
44 | + } |
|
45 | 45 | } |
@@ -30,114 +30,114 @@ |
||
30 | 30 | * @since 8.0.0 |
31 | 31 | */ |
32 | 32 | interface IDateTimeFormatter { |
33 | - /** |
|
34 | - * Formats the date of the given timestamp |
|
35 | - * |
|
36 | - * @param int|\DateTime $timestamp |
|
37 | - * @param string $format Either 'full', 'long', 'medium' or 'short' |
|
38 | - * full: e.g. 'EEEE, MMMM d, y' => 'Wednesday, August 20, 2014' |
|
39 | - * long: e.g. 'MMMM d, y' => 'August 20, 2014' |
|
40 | - * medium: e.g. 'MMM d, y' => 'Aug 20, 2014' |
|
41 | - * short: e.g. 'M/d/yy' => '8/20/14' |
|
42 | - * The exact format is dependent on the language |
|
43 | - * @param \DateTimeZone|null $timeZone The timezone to use |
|
44 | - * @param \OCP\IL10N|null $l The locale to use |
|
45 | - * @return string Formatted date string |
|
46 | - * @since 8.0.0 |
|
47 | - */ |
|
48 | - public function formatDate($timestamp, $format = 'long', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null); |
|
33 | + /** |
|
34 | + * Formats the date of the given timestamp |
|
35 | + * |
|
36 | + * @param int|\DateTime $timestamp |
|
37 | + * @param string $format Either 'full', 'long', 'medium' or 'short' |
|
38 | + * full: e.g. 'EEEE, MMMM d, y' => 'Wednesday, August 20, 2014' |
|
39 | + * long: e.g. 'MMMM d, y' => 'August 20, 2014' |
|
40 | + * medium: e.g. 'MMM d, y' => 'Aug 20, 2014' |
|
41 | + * short: e.g. 'M/d/yy' => '8/20/14' |
|
42 | + * The exact format is dependent on the language |
|
43 | + * @param \DateTimeZone|null $timeZone The timezone to use |
|
44 | + * @param \OCP\IL10N|null $l The locale to use |
|
45 | + * @return string Formatted date string |
|
46 | + * @since 8.0.0 |
|
47 | + */ |
|
48 | + public function formatDate($timestamp, $format = 'long', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null); |
|
49 | 49 | |
50 | - /** |
|
51 | - * Formats the date of the given timestamp |
|
52 | - * |
|
53 | - * @param int|\DateTime $timestamp |
|
54 | - * @param string $format Either 'full', 'long', 'medium' or 'short' |
|
55 | - * full: e.g. 'EEEE, MMMM d, y' => 'Wednesday, August 20, 2014' |
|
56 | - * long: e.g. 'MMMM d, y' => 'August 20, 2014' |
|
57 | - * medium: e.g. 'MMM d, y' => 'Aug 20, 2014' |
|
58 | - * short: e.g. 'M/d/yy' => '8/20/14' |
|
59 | - * The exact format is dependent on the language |
|
60 | - * Uses 'Today', 'Yesterday' and 'Tomorrow' when applicable |
|
61 | - * @param \DateTimeZone|null $timeZone The timezone to use |
|
62 | - * @param \OCP\IL10N|null $l The locale to use |
|
63 | - * @return string Formatted relative date string |
|
64 | - * @since 8.0.0 |
|
65 | - */ |
|
66 | - public function formatDateRelativeDay($timestamp, $format = 'long', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null); |
|
50 | + /** |
|
51 | + * Formats the date of the given timestamp |
|
52 | + * |
|
53 | + * @param int|\DateTime $timestamp |
|
54 | + * @param string $format Either 'full', 'long', 'medium' or 'short' |
|
55 | + * full: e.g. 'EEEE, MMMM d, y' => 'Wednesday, August 20, 2014' |
|
56 | + * long: e.g. 'MMMM d, y' => 'August 20, 2014' |
|
57 | + * medium: e.g. 'MMM d, y' => 'Aug 20, 2014' |
|
58 | + * short: e.g. 'M/d/yy' => '8/20/14' |
|
59 | + * The exact format is dependent on the language |
|
60 | + * Uses 'Today', 'Yesterday' and 'Tomorrow' when applicable |
|
61 | + * @param \DateTimeZone|null $timeZone The timezone to use |
|
62 | + * @param \OCP\IL10N|null $l The locale to use |
|
63 | + * @return string Formatted relative date string |
|
64 | + * @since 8.0.0 |
|
65 | + */ |
|
66 | + public function formatDateRelativeDay($timestamp, $format = 'long', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null); |
|
67 | 67 | |
68 | - /** |
|
69 | - * Gives the relative date of the timestamp |
|
70 | - * Only works for past dates |
|
71 | - * |
|
72 | - * @param int|\DateTime $timestamp |
|
73 | - * @param int|\DateTime|null $baseTimestamp Timestamp to compare $timestamp against, defaults to current time |
|
74 | - * @param \OCP\IL10N|null $l The locale to use |
|
75 | - * @return string Dates returned are: |
|
76 | - * < 1 month => Today, Yesterday, n days ago |
|
77 | - * < 13 month => last month, n months ago |
|
78 | - * >= 13 month => last year, n years ago |
|
79 | - * @since 8.0.0 |
|
80 | - */ |
|
81 | - public function formatDateSpan($timestamp, $baseTimestamp = null, \OCP\IL10N $l = null); |
|
68 | + /** |
|
69 | + * Gives the relative date of the timestamp |
|
70 | + * Only works for past dates |
|
71 | + * |
|
72 | + * @param int|\DateTime $timestamp |
|
73 | + * @param int|\DateTime|null $baseTimestamp Timestamp to compare $timestamp against, defaults to current time |
|
74 | + * @param \OCP\IL10N|null $l The locale to use |
|
75 | + * @return string Dates returned are: |
|
76 | + * < 1 month => Today, Yesterday, n days ago |
|
77 | + * < 13 month => last month, n months ago |
|
78 | + * >= 13 month => last year, n years ago |
|
79 | + * @since 8.0.0 |
|
80 | + */ |
|
81 | + public function formatDateSpan($timestamp, $baseTimestamp = null, \OCP\IL10N $l = null); |
|
82 | 82 | |
83 | - /** |
|
84 | - * Formats the time of the given timestamp |
|
85 | - * |
|
86 | - * @param int|\DateTime $timestamp |
|
87 | - * @param string $format Either 'full', 'long', 'medium' or 'short' |
|
88 | - * full: e.g. 'h:mm:ss a zzzz' => '11:42:13 AM GMT+0:00' |
|
89 | - * long: e.g. 'h:mm:ss a z' => '11:42:13 AM GMT' |
|
90 | - * medium: e.g. 'h:mm:ss a' => '11:42:13 AM' |
|
91 | - * short: e.g. 'h:mm a' => '11:42 AM' |
|
92 | - * The exact format is dependent on the language |
|
93 | - * @param \DateTimeZone|null $timeZone The timezone to use |
|
94 | - * @param \OCP\IL10N|null $l The locale to use |
|
95 | - * @return string Formatted time string |
|
96 | - * @since 8.0.0 |
|
97 | - */ |
|
98 | - public function formatTime($timestamp, $format = 'medium', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null); |
|
83 | + /** |
|
84 | + * Formats the time of the given timestamp |
|
85 | + * |
|
86 | + * @param int|\DateTime $timestamp |
|
87 | + * @param string $format Either 'full', 'long', 'medium' or 'short' |
|
88 | + * full: e.g. 'h:mm:ss a zzzz' => '11:42:13 AM GMT+0:00' |
|
89 | + * long: e.g. 'h:mm:ss a z' => '11:42:13 AM GMT' |
|
90 | + * medium: e.g. 'h:mm:ss a' => '11:42:13 AM' |
|
91 | + * short: e.g. 'h:mm a' => '11:42 AM' |
|
92 | + * The exact format is dependent on the language |
|
93 | + * @param \DateTimeZone|null $timeZone The timezone to use |
|
94 | + * @param \OCP\IL10N|null $l The locale to use |
|
95 | + * @return string Formatted time string |
|
96 | + * @since 8.0.0 |
|
97 | + */ |
|
98 | + public function formatTime($timestamp, $format = 'medium', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null); |
|
99 | 99 | |
100 | - /** |
|
101 | - * Gives the relative past time of the timestamp |
|
102 | - * |
|
103 | - * @param int|\DateTime $timestamp |
|
104 | - * @param int|\DateTime|null $baseTimestamp Timestamp to compare $timestamp against, defaults to current time |
|
105 | - * @param \OCP\IL10N|null $l The locale to use |
|
106 | - * @return string Dates returned are: |
|
107 | - * < 60 sec => seconds ago |
|
108 | - * < 1 hour => n minutes ago |
|
109 | - * < 1 day => n hours ago |
|
110 | - * < 1 month => Yesterday, n days ago |
|
111 | - * < 13 month => last month, n months ago |
|
112 | - * >= 13 month => last year, n years ago |
|
113 | - * @since 8.0.0 |
|
114 | - */ |
|
115 | - public function formatTimeSpan($timestamp, $baseTimestamp = null, \OCP\IL10N $l = null); |
|
100 | + /** |
|
101 | + * Gives the relative past time of the timestamp |
|
102 | + * |
|
103 | + * @param int|\DateTime $timestamp |
|
104 | + * @param int|\DateTime|null $baseTimestamp Timestamp to compare $timestamp against, defaults to current time |
|
105 | + * @param \OCP\IL10N|null $l The locale to use |
|
106 | + * @return string Dates returned are: |
|
107 | + * < 60 sec => seconds ago |
|
108 | + * < 1 hour => n minutes ago |
|
109 | + * < 1 day => n hours ago |
|
110 | + * < 1 month => Yesterday, n days ago |
|
111 | + * < 13 month => last month, n months ago |
|
112 | + * >= 13 month => last year, n years ago |
|
113 | + * @since 8.0.0 |
|
114 | + */ |
|
115 | + public function formatTimeSpan($timestamp, $baseTimestamp = null, \OCP\IL10N $l = null); |
|
116 | 116 | |
117 | - /** |
|
118 | - * Formats the date and time of the given timestamp |
|
119 | - * |
|
120 | - * @param int|\DateTime $timestamp |
|
121 | - * @param string $formatDate See formatDate() for description |
|
122 | - * @param string $formatTime See formatTime() for description |
|
123 | - * @param \DateTimeZone|null $timeZone The timezone to use |
|
124 | - * @param \OCP\IL10N|null $l The locale to use |
|
125 | - * @return string Formatted date and time string |
|
126 | - * @since 8.0.0 |
|
127 | - */ |
|
128 | - public function formatDateTime($timestamp, $formatDate = 'long', $formatTime = 'medium', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null); |
|
117 | + /** |
|
118 | + * Formats the date and time of the given timestamp |
|
119 | + * |
|
120 | + * @param int|\DateTime $timestamp |
|
121 | + * @param string $formatDate See formatDate() for description |
|
122 | + * @param string $formatTime See formatTime() for description |
|
123 | + * @param \DateTimeZone|null $timeZone The timezone to use |
|
124 | + * @param \OCP\IL10N|null $l The locale to use |
|
125 | + * @return string Formatted date and time string |
|
126 | + * @since 8.0.0 |
|
127 | + */ |
|
128 | + public function formatDateTime($timestamp, $formatDate = 'long', $formatTime = 'medium', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null); |
|
129 | 129 | |
130 | - /** |
|
131 | - * Formats the date and time of the given timestamp |
|
132 | - * |
|
133 | - * @param int|\DateTime $timestamp |
|
134 | - * @param string $formatDate See formatDate() for description |
|
135 | - * Uses 'Today', 'Yesterday' and 'Tomorrow' when applicable |
|
136 | - * @param string $formatTime See formatTime() for description |
|
137 | - * @param \DateTimeZone|null $timeZone The timezone to use |
|
138 | - * @param \OCP\IL10N|null $l The locale to use |
|
139 | - * @return string Formatted relative date and time string |
|
140 | - * @since 8.0.0 |
|
141 | - */ |
|
142 | - public function formatDateTimeRelativeDay($timestamp, $formatDate = 'long', $formatTime = 'medium', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null); |
|
130 | + /** |
|
131 | + * Formats the date and time of the given timestamp |
|
132 | + * |
|
133 | + * @param int|\DateTime $timestamp |
|
134 | + * @param string $formatDate See formatDate() for description |
|
135 | + * Uses 'Today', 'Yesterday' and 'Tomorrow' when applicable |
|
136 | + * @param string $formatTime See formatTime() for description |
|
137 | + * @param \DateTimeZone|null $timeZone The timezone to use |
|
138 | + * @param \OCP\IL10N|null $l The locale to use |
|
139 | + * @return string Formatted relative date and time string |
|
140 | + * @since 8.0.0 |
|
141 | + */ |
|
142 | + public function formatDateTimeRelativeDay($timestamp, $formatDate = 'long', $formatTime = 'medium', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null); |
|
143 | 143 | } |
@@ -31,18 +31,18 @@ |
||
31 | 31 | */ |
32 | 32 | class GenericShareException extends HintException { |
33 | 33 | |
34 | - /** |
|
35 | - * @param string $message |
|
36 | - * @param string $hint |
|
37 | - * @param int $code |
|
38 | - * @param \Exception|null $previous |
|
39 | - * @since 9.0.0 |
|
40 | - */ |
|
41 | - public function __construct($message = '', $hint = '', $code = 0, \Exception $previous = null) { |
|
42 | - if (empty($message)) { |
|
43 | - $message = 'There was an error retrieving the share. Maybe the link is wrong, it was unshared, or it was deleted.'; |
|
44 | - } |
|
45 | - parent::__construct($message, $hint, $code, $previous); |
|
46 | - } |
|
34 | + /** |
|
35 | + * @param string $message |
|
36 | + * @param string $hint |
|
37 | + * @param int $code |
|
38 | + * @param \Exception|null $previous |
|
39 | + * @since 9.0.0 |
|
40 | + */ |
|
41 | + public function __construct($message = '', $hint = '', $code = 0, \Exception $previous = null) { |
|
42 | + if (empty($message)) { |
|
43 | + $message = 'There was an error retrieving the share. Maybe the link is wrong, it was unshared, or it was deleted.'; |
|
44 | + } |
|
45 | + parent::__construct($message, $hint, $code, $previous); |
|
46 | + } |
|
47 | 47 | |
48 | 48 | } |