@@ -29,179 +29,179 @@ |
||
29 | 29 | |
30 | 30 | class MigrationSchemaChecker extends NodeVisitorAbstract { |
31 | 31 | |
32 | - /** @var string */ |
|
33 | - protected $schemaVariableName = null; |
|
34 | - /** @var array */ |
|
35 | - protected $tableVariableNames = []; |
|
36 | - /** @var array */ |
|
37 | - public $errors = []; |
|
32 | + /** @var string */ |
|
33 | + protected $schemaVariableName = null; |
|
34 | + /** @var array */ |
|
35 | + protected $tableVariableNames = []; |
|
36 | + /** @var array */ |
|
37 | + public $errors = []; |
|
38 | 38 | |
39 | - /** |
|
40 | - * @param Node $node |
|
41 | - * @return void |
|
42 | - * |
|
43 | - * @suppress PhanUndeclaredProperty |
|
44 | - */ |
|
45 | - public function enterNode(Node $node) { |
|
46 | - /** |
|
47 | - * Check tables |
|
48 | - */ |
|
49 | - if ($this->schemaVariableName !== null && |
|
50 | - $node instanceof Node\Expr\Assign && |
|
51 | - $node->var instanceof Node\Expr\Variable && |
|
52 | - $node->expr instanceof Node\Expr\MethodCall && |
|
53 | - $node->expr->var instanceof Node\Expr\Variable && |
|
54 | - $node->expr->var->name === $this->schemaVariableName) { |
|
39 | + /** |
|
40 | + * @param Node $node |
|
41 | + * @return void |
|
42 | + * |
|
43 | + * @suppress PhanUndeclaredProperty |
|
44 | + */ |
|
45 | + public function enterNode(Node $node) { |
|
46 | + /** |
|
47 | + * Check tables |
|
48 | + */ |
|
49 | + if ($this->schemaVariableName !== null && |
|
50 | + $node instanceof Node\Expr\Assign && |
|
51 | + $node->var instanceof Node\Expr\Variable && |
|
52 | + $node->expr instanceof Node\Expr\MethodCall && |
|
53 | + $node->expr->var instanceof Node\Expr\Variable && |
|
54 | + $node->expr->var->name === $this->schemaVariableName) { |
|
55 | 55 | |
56 | - if ($node->expr->name === 'createTable') { |
|
57 | - if (isset($node->expr->args[0]) && $node->expr->args[0]->value instanceof Node\Scalar\String_) { |
|
58 | - if (!$this->checkNameLength($node->expr->args[0]->value->value)) { |
|
59 | - $this->errors[] = [ |
|
60 | - 'line' => $node->getLine(), |
|
61 | - 'disallowedToken' => $node->expr->args[0]->value->value, |
|
62 | - 'reason' => 'Table name is too long (max. 27)', |
|
63 | - ]; |
|
64 | - } else { |
|
65 | - $this->tableVariableNames[$node->var->name] = $node->expr->args[0]->value->value; |
|
66 | - } |
|
67 | - } |
|
68 | - } else if ($node->expr->name === 'getTable') { |
|
69 | - if (isset($node->expr->args[0]) && $node->expr->args[0]->value instanceof Node\Scalar\String_) { |
|
70 | - $this->tableVariableNames[$node->var->name] = $node->expr->args[0]->value->value; |
|
71 | - } |
|
72 | - } |
|
73 | - } else if ($this->schemaVariableName !== null && |
|
74 | - $node instanceof Node\Expr\MethodCall && |
|
75 | - $node->var instanceof Node\Expr\Variable && |
|
76 | - $node->var->name === $this->schemaVariableName) { |
|
56 | + if ($node->expr->name === 'createTable') { |
|
57 | + if (isset($node->expr->args[0]) && $node->expr->args[0]->value instanceof Node\Scalar\String_) { |
|
58 | + if (!$this->checkNameLength($node->expr->args[0]->value->value)) { |
|
59 | + $this->errors[] = [ |
|
60 | + 'line' => $node->getLine(), |
|
61 | + 'disallowedToken' => $node->expr->args[0]->value->value, |
|
62 | + 'reason' => 'Table name is too long (max. 27)', |
|
63 | + ]; |
|
64 | + } else { |
|
65 | + $this->tableVariableNames[$node->var->name] = $node->expr->args[0]->value->value; |
|
66 | + } |
|
67 | + } |
|
68 | + } else if ($node->expr->name === 'getTable') { |
|
69 | + if (isset($node->expr->args[0]) && $node->expr->args[0]->value instanceof Node\Scalar\String_) { |
|
70 | + $this->tableVariableNames[$node->var->name] = $node->expr->args[0]->value->value; |
|
71 | + } |
|
72 | + } |
|
73 | + } else if ($this->schemaVariableName !== null && |
|
74 | + $node instanceof Node\Expr\MethodCall && |
|
75 | + $node->var instanceof Node\Expr\Variable && |
|
76 | + $node->var->name === $this->schemaVariableName) { |
|
77 | 77 | |
78 | - if ($node->name === 'renameTable') { |
|
79 | - $this->errors[] = [ |
|
80 | - 'line' => $node->getLine(), |
|
81 | - 'disallowedToken' => 'Deprecated method', |
|
82 | - 'reason' => sprintf( |
|
83 | - '`$%s->renameTable()` must not be used', |
|
84 | - $node->var->name |
|
85 | - ), |
|
86 | - ]; |
|
87 | - } |
|
78 | + if ($node->name === 'renameTable') { |
|
79 | + $this->errors[] = [ |
|
80 | + 'line' => $node->getLine(), |
|
81 | + 'disallowedToken' => 'Deprecated method', |
|
82 | + 'reason' => sprintf( |
|
83 | + '`$%s->renameTable()` must not be used', |
|
84 | + $node->var->name |
|
85 | + ), |
|
86 | + ]; |
|
87 | + } |
|
88 | 88 | |
89 | - /** |
|
90 | - * Check columns and Indexes |
|
91 | - */ |
|
92 | - } else if (!empty($this->tableVariableNames) && |
|
93 | - $node instanceof Node\Expr\MethodCall && |
|
94 | - $node->var instanceof Node\Expr\Variable && |
|
95 | - isset($this->tableVariableNames[$node->var->name])) { |
|
89 | + /** |
|
90 | + * Check columns and Indexes |
|
91 | + */ |
|
92 | + } else if (!empty($this->tableVariableNames) && |
|
93 | + $node instanceof Node\Expr\MethodCall && |
|
94 | + $node->var instanceof Node\Expr\Variable && |
|
95 | + isset($this->tableVariableNames[$node->var->name])) { |
|
96 | 96 | |
97 | - if ($node->name === 'addColumn' || $node->name === 'changeColumn') { |
|
98 | - if (isset($node->args[0]) && $node->args[0]->value instanceof Node\Scalar\String_) { |
|
99 | - if (!$this->checkNameLength($node->args[0]->value->value)) { |
|
100 | - $this->errors[] = [ |
|
101 | - 'line' => $node->getLine(), |
|
102 | - 'disallowedToken' => $node->args[0]->value->value, |
|
103 | - 'reason' => sprintf( |
|
104 | - 'Column name is too long on table `%s` (max. 27)', |
|
105 | - $this->tableVariableNames[$node->var->name] |
|
106 | - ), |
|
107 | - ]; |
|
108 | - } |
|
97 | + if ($node->name === 'addColumn' || $node->name === 'changeColumn') { |
|
98 | + if (isset($node->args[0]) && $node->args[0]->value instanceof Node\Scalar\String_) { |
|
99 | + if (!$this->checkNameLength($node->args[0]->value->value)) { |
|
100 | + $this->errors[] = [ |
|
101 | + 'line' => $node->getLine(), |
|
102 | + 'disallowedToken' => $node->args[0]->value->value, |
|
103 | + 'reason' => sprintf( |
|
104 | + 'Column name is too long on table `%s` (max. 27)', |
|
105 | + $this->tableVariableNames[$node->var->name] |
|
106 | + ), |
|
107 | + ]; |
|
108 | + } |
|
109 | 109 | |
110 | - // On autoincrement the max length of the table name is 21 instead of 27 |
|
111 | - if (isset($node->args[2]) && $node->args[2]->value instanceof Node\Expr\Array_) { |
|
112 | - /** @var Node\Expr\Array_ $options */ |
|
113 | - $options = $node->args[2]->value; |
|
114 | - if ($this->checkColumnForAutoincrement($options)) { |
|
115 | - if (!$this->checkNameLength($this->tableVariableNames[$node->var->name], true)) { |
|
116 | - $this->errors[] = [ |
|
117 | - 'line' => $node->getLine(), |
|
118 | - 'disallowedToken' => $this->tableVariableNames[$node->var->name], |
|
119 | - 'reason' => 'Table name is too long because of autoincrement (max. 21)', |
|
120 | - ]; |
|
121 | - } |
|
122 | - } |
|
123 | - } |
|
124 | - } |
|
125 | - } else if ($node->name === 'addIndex' || |
|
126 | - $node->name === 'addUniqueIndex' || |
|
127 | - $node->name === 'renameIndex' || |
|
128 | - $node->name === 'setPrimaryKey') { |
|
129 | - if (isset($node->args[1]) && $node->args[1]->value instanceof Node\Scalar\String_) { |
|
130 | - if (!$this->checkNameLength($node->args[1]->value->value)) { |
|
131 | - $this->errors[] = [ |
|
132 | - 'line' => $node->getLine(), |
|
133 | - 'disallowedToken' => $node->args[1]->value->value, |
|
134 | - 'reason' => sprintf( |
|
135 | - 'Index name is too long on table `%s` (max. 27)', |
|
136 | - $this->tableVariableNames[$node->var->name] |
|
137 | - ), |
|
138 | - ]; |
|
139 | - } |
|
140 | - } |
|
141 | - } else if ($node->name === 'addForeignKeyConstraint') { |
|
142 | - if (isset($node->args[4]) && $node->args[4]->value instanceof Node\Scalar\String_) { |
|
143 | - if (!$this->checkNameLength($node->args[4]->value->value)) { |
|
144 | - $this->errors[] = [ |
|
145 | - 'line' => $node->getLine(), |
|
146 | - 'disallowedToken' => $node->args[4]->value->value, |
|
147 | - 'reason' => sprintf( |
|
148 | - 'Constraint name is too long on table `%s` (max. 27)', |
|
149 | - $this->tableVariableNames[$node->var->name] |
|
150 | - ), |
|
151 | - ]; |
|
152 | - } |
|
153 | - } |
|
154 | - } else if ($node->name === 'renameColumn') { |
|
155 | - $this->errors[] = [ |
|
156 | - 'line' => $node->getLine(), |
|
157 | - 'disallowedToken' => 'Deprecated method', |
|
158 | - 'reason' => sprintf( |
|
159 | - '`$%s->renameColumn()` must not be used', |
|
160 | - $node->var->name |
|
161 | - ), |
|
162 | - ]; |
|
163 | - } |
|
110 | + // On autoincrement the max length of the table name is 21 instead of 27 |
|
111 | + if (isset($node->args[2]) && $node->args[2]->value instanceof Node\Expr\Array_) { |
|
112 | + /** @var Node\Expr\Array_ $options */ |
|
113 | + $options = $node->args[2]->value; |
|
114 | + if ($this->checkColumnForAutoincrement($options)) { |
|
115 | + if (!$this->checkNameLength($this->tableVariableNames[$node->var->name], true)) { |
|
116 | + $this->errors[] = [ |
|
117 | + 'line' => $node->getLine(), |
|
118 | + 'disallowedToken' => $this->tableVariableNames[$node->var->name], |
|
119 | + 'reason' => 'Table name is too long because of autoincrement (max. 21)', |
|
120 | + ]; |
|
121 | + } |
|
122 | + } |
|
123 | + } |
|
124 | + } |
|
125 | + } else if ($node->name === 'addIndex' || |
|
126 | + $node->name === 'addUniqueIndex' || |
|
127 | + $node->name === 'renameIndex' || |
|
128 | + $node->name === 'setPrimaryKey') { |
|
129 | + if (isset($node->args[1]) && $node->args[1]->value instanceof Node\Scalar\String_) { |
|
130 | + if (!$this->checkNameLength($node->args[1]->value->value)) { |
|
131 | + $this->errors[] = [ |
|
132 | + 'line' => $node->getLine(), |
|
133 | + 'disallowedToken' => $node->args[1]->value->value, |
|
134 | + 'reason' => sprintf( |
|
135 | + 'Index name is too long on table `%s` (max. 27)', |
|
136 | + $this->tableVariableNames[$node->var->name] |
|
137 | + ), |
|
138 | + ]; |
|
139 | + } |
|
140 | + } |
|
141 | + } else if ($node->name === 'addForeignKeyConstraint') { |
|
142 | + if (isset($node->args[4]) && $node->args[4]->value instanceof Node\Scalar\String_) { |
|
143 | + if (!$this->checkNameLength($node->args[4]->value->value)) { |
|
144 | + $this->errors[] = [ |
|
145 | + 'line' => $node->getLine(), |
|
146 | + 'disallowedToken' => $node->args[4]->value->value, |
|
147 | + 'reason' => sprintf( |
|
148 | + 'Constraint name is too long on table `%s` (max. 27)', |
|
149 | + $this->tableVariableNames[$node->var->name] |
|
150 | + ), |
|
151 | + ]; |
|
152 | + } |
|
153 | + } |
|
154 | + } else if ($node->name === 'renameColumn') { |
|
155 | + $this->errors[] = [ |
|
156 | + 'line' => $node->getLine(), |
|
157 | + 'disallowedToken' => 'Deprecated method', |
|
158 | + 'reason' => sprintf( |
|
159 | + '`$%s->renameColumn()` must not be used', |
|
160 | + $node->var->name |
|
161 | + ), |
|
162 | + ]; |
|
163 | + } |
|
164 | 164 | |
165 | - /** |
|
166 | - * Find the schema |
|
167 | - */ |
|
168 | - } else if ($node instanceof Node\Expr\Assign && |
|
169 | - $node->expr instanceof Node\Expr\FuncCall && |
|
170 | - $node->var instanceof Node\Expr\Variable && |
|
171 | - $node->expr->name instanceof Node\Expr\Variable && |
|
172 | - $node->expr->name->name === 'schemaClosure') { |
|
173 | - // E.g. $schema = $schemaClosure(); |
|
174 | - $this->schemaVariableName = $node->var->name; |
|
175 | - } |
|
176 | - } |
|
165 | + /** |
|
166 | + * Find the schema |
|
167 | + */ |
|
168 | + } else if ($node instanceof Node\Expr\Assign && |
|
169 | + $node->expr instanceof Node\Expr\FuncCall && |
|
170 | + $node->var instanceof Node\Expr\Variable && |
|
171 | + $node->expr->name instanceof Node\Expr\Variable && |
|
172 | + $node->expr->name->name === 'schemaClosure') { |
|
173 | + // E.g. $schema = $schemaClosure(); |
|
174 | + $this->schemaVariableName = $node->var->name; |
|
175 | + } |
|
176 | + } |
|
177 | 177 | |
178 | - protected function checkNameLength($tableName, $hasAutoincrement = false) { |
|
179 | - if ($hasAutoincrement) { |
|
180 | - return strlen($tableName) <= 21; |
|
181 | - } |
|
182 | - return strlen($tableName) <= 27; |
|
183 | - } |
|
178 | + protected function checkNameLength($tableName, $hasAutoincrement = false) { |
|
179 | + if ($hasAutoincrement) { |
|
180 | + return strlen($tableName) <= 21; |
|
181 | + } |
|
182 | + return strlen($tableName) <= 27; |
|
183 | + } |
|
184 | 184 | |
185 | - /** |
|
186 | - * @param Node\Expr\Array_ $optionsArray |
|
187 | - * @return bool Whether the column is an autoincrement column |
|
188 | - */ |
|
189 | - protected function checkColumnForAutoincrement(Node\Expr\Array_ $optionsArray) { |
|
190 | - foreach ($optionsArray->items as $option) { |
|
191 | - if ($option->key instanceof Node\Scalar\String_) { |
|
192 | - if ($option->key->value === 'autoincrement' && |
|
193 | - $option->value instanceof Node\Expr\ConstFetch) { |
|
194 | - /** @var Node\Expr\ConstFetch $const */ |
|
195 | - $const = $option->value; |
|
185 | + /** |
|
186 | + * @param Node\Expr\Array_ $optionsArray |
|
187 | + * @return bool Whether the column is an autoincrement column |
|
188 | + */ |
|
189 | + protected function checkColumnForAutoincrement(Node\Expr\Array_ $optionsArray) { |
|
190 | + foreach ($optionsArray->items as $option) { |
|
191 | + if ($option->key instanceof Node\Scalar\String_) { |
|
192 | + if ($option->key->value === 'autoincrement' && |
|
193 | + $option->value instanceof Node\Expr\ConstFetch) { |
|
194 | + /** @var Node\Expr\ConstFetch $const */ |
|
195 | + $const = $option->value; |
|
196 | 196 | |
197 | - if ($const->name instanceof Name && |
|
198 | - $const->name->parts === ['true']) { |
|
199 | - return true; |
|
200 | - } |
|
201 | - } |
|
202 | - } |
|
203 | - } |
|
197 | + if ($const->name instanceof Name && |
|
198 | + $const->name->parts === ['true']) { |
|
199 | + return true; |
|
200 | + } |
|
201 | + } |
|
202 | + } |
|
203 | + } |
|
204 | 204 | |
205 | - return false; |
|
206 | - } |
|
205 | + return false; |
|
206 | + } |
|
207 | 207 | } |
@@ -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,26 +32,26 @@ |
||
32 | 32 | * @package OC\BackgroundJob |
33 | 33 | */ |
34 | 34 | abstract class TimedJob extends Job { |
35 | - protected $interval = 0; |
|
35 | + protected $interval = 0; |
|
36 | 36 | |
37 | - /** |
|
38 | - * set the interval for the job |
|
39 | - * |
|
40 | - * @param int $interval |
|
41 | - */ |
|
42 | - public function setInterval($interval) { |
|
43 | - $this->interval = $interval; |
|
44 | - } |
|
37 | + /** |
|
38 | + * set the interval for the job |
|
39 | + * |
|
40 | + * @param int $interval |
|
41 | + */ |
|
42 | + public function setInterval($interval) { |
|
43 | + $this->interval = $interval; |
|
44 | + } |
|
45 | 45 | |
46 | - /** |
|
47 | - * run the job if |
|
48 | - * |
|
49 | - * @param JobList $jobList |
|
50 | - * @param ILogger|null $logger |
|
51 | - */ |
|
52 | - public function execute($jobList, ILogger $logger = null) { |
|
53 | - if ((time() - $this->lastRun) > $this->interval) { |
|
54 | - parent::execute($jobList, $logger); |
|
55 | - } |
|
56 | - } |
|
46 | + /** |
|
47 | + * run the job if |
|
48 | + * |
|
49 | + * @param JobList $jobList |
|
50 | + * @param ILogger|null $logger |
|
51 | + */ |
|
52 | + public function execute($jobList, ILogger $logger = null) { |
|
53 | + if ((time() - $this->lastRun) > $this->interval) { |
|
54 | + parent::execute($jobList, $logger); |
|
55 | + } |
|
56 | + } |
|
57 | 57 | } |
@@ -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 | } |
@@ -30,39 +30,39 @@ |
||
30 | 30 | */ |
31 | 31 | abstract class PagedProvider extends Provider { |
32 | 32 | |
33 | - /** |
|
34 | - * show all results |
|
35 | - * @since 8.0.0 |
|
36 | - */ |
|
37 | - const SIZE_ALL = 0; |
|
33 | + /** |
|
34 | + * show all results |
|
35 | + * @since 8.0.0 |
|
36 | + */ |
|
37 | + const SIZE_ALL = 0; |
|
38 | 38 | |
39 | - /** |
|
40 | - * Constructor |
|
41 | - * @param array $options |
|
42 | - * @since 8.0.0 |
|
43 | - */ |
|
44 | - public function __construct($options) { |
|
45 | - parent::__construct($options); |
|
46 | - } |
|
39 | + /** |
|
40 | + * Constructor |
|
41 | + * @param array $options |
|
42 | + * @since 8.0.0 |
|
43 | + */ |
|
44 | + public function __construct($options) { |
|
45 | + parent::__construct($options); |
|
46 | + } |
|
47 | 47 | |
48 | - /** |
|
49 | - * Search for $query |
|
50 | - * @param string $query |
|
51 | - * @return array An array of OCP\Search\Result's |
|
52 | - * @since 8.0.0 |
|
53 | - */ |
|
54 | - public function search($query) { |
|
55 | - // old apps might assume they get all results, so we use SIZE_ALL |
|
56 | - return $this->searchPaged($query, 1, self::SIZE_ALL); |
|
57 | - } |
|
48 | + /** |
|
49 | + * Search for $query |
|
50 | + * @param string $query |
|
51 | + * @return array An array of OCP\Search\Result's |
|
52 | + * @since 8.0.0 |
|
53 | + */ |
|
54 | + public function search($query) { |
|
55 | + // old apps might assume they get all results, so we use SIZE_ALL |
|
56 | + return $this->searchPaged($query, 1, self::SIZE_ALL); |
|
57 | + } |
|
58 | 58 | |
59 | - /** |
|
60 | - * Search for $query |
|
61 | - * @param string $query |
|
62 | - * @param int $page pages start at page 1 |
|
63 | - * @param int $size 0 = SIZE_ALL |
|
64 | - * @return array An array of OCP\Search\Result's |
|
65 | - * @since 8.0.0 |
|
66 | - */ |
|
67 | - abstract public function searchPaged($query, $page, $size); |
|
59 | + /** |
|
60 | + * Search for $query |
|
61 | + * @param string $query |
|
62 | + * @param int $page pages start at page 1 |
|
63 | + * @param int $size 0 = SIZE_ALL |
|
64 | + * @return array An array of OCP\Search\Result's |
|
65 | + * @since 8.0.0 |
|
66 | + */ |
|
67 | + abstract public function searchPaged($query, $page, $size); |
|
68 | 68 | } |
@@ -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 | } |
@@ -32,56 +32,56 @@ |
||
32 | 32 | * @since 7.0.0 |
33 | 33 | */ |
34 | 34 | interface IJob { |
35 | - /** |
|
36 | - * Run the background job with the registered argument |
|
37 | - * |
|
38 | - * @param \OCP\BackgroundJob\IJobList $jobList The job list that manages the state of this job |
|
39 | - * @param ILogger|null $logger |
|
40 | - * @since 7.0.0 |
|
41 | - */ |
|
42 | - public function execute($jobList, ILogger $logger = null); |
|
35 | + /** |
|
36 | + * Run the background job with the registered argument |
|
37 | + * |
|
38 | + * @param \OCP\BackgroundJob\IJobList $jobList The job list that manages the state of this job |
|
39 | + * @param ILogger|null $logger |
|
40 | + * @since 7.0.0 |
|
41 | + */ |
|
42 | + public function execute($jobList, ILogger $logger = null); |
|
43 | 43 | |
44 | - /** |
|
45 | - * @param int $id |
|
46 | - * @since 7.0.0 |
|
47 | - */ |
|
48 | - public function setId($id); |
|
44 | + /** |
|
45 | + * @param int $id |
|
46 | + * @since 7.0.0 |
|
47 | + */ |
|
48 | + public function setId($id); |
|
49 | 49 | |
50 | - /** |
|
51 | - * @param int $lastRun |
|
52 | - * @since 7.0.0 |
|
53 | - */ |
|
54 | - public function setLastRun($lastRun); |
|
50 | + /** |
|
51 | + * @param int $lastRun |
|
52 | + * @since 7.0.0 |
|
53 | + */ |
|
54 | + public function setLastRun($lastRun); |
|
55 | 55 | |
56 | - /** |
|
57 | - * @param mixed $argument |
|
58 | - * @since 7.0.0 |
|
59 | - */ |
|
60 | - public function setArgument($argument); |
|
56 | + /** |
|
57 | + * @param mixed $argument |
|
58 | + * @since 7.0.0 |
|
59 | + */ |
|
60 | + public function setArgument($argument); |
|
61 | 61 | |
62 | - /** |
|
63 | - * Get the id of the background job |
|
64 | - * This id is determined by the job list when a job is added to the list |
|
65 | - * |
|
66 | - * @return int |
|
67 | - * @since 7.0.0 |
|
68 | - */ |
|
69 | - public function getId(); |
|
62 | + /** |
|
63 | + * Get the id of the background job |
|
64 | + * This id is determined by the job list when a job is added to the list |
|
65 | + * |
|
66 | + * @return int |
|
67 | + * @since 7.0.0 |
|
68 | + */ |
|
69 | + public function getId(); |
|
70 | 70 | |
71 | - /** |
|
72 | - * Get the last time this job was run as unix timestamp |
|
73 | - * |
|
74 | - * @return int |
|
75 | - * @since 7.0.0 |
|
76 | - */ |
|
77 | - public function getLastRun(); |
|
71 | + /** |
|
72 | + * Get the last time this job was run as unix timestamp |
|
73 | + * |
|
74 | + * @return int |
|
75 | + * @since 7.0.0 |
|
76 | + */ |
|
77 | + public function getLastRun(); |
|
78 | 78 | |
79 | - /** |
|
80 | - * Get the argument associated with the background job |
|
81 | - * This is the argument that will be passed to the background job |
|
82 | - * |
|
83 | - * @return mixed |
|
84 | - * @since 7.0.0 |
|
85 | - */ |
|
86 | - public function getArgument(); |
|
79 | + /** |
|
80 | + * Get the argument associated with the background job |
|
81 | + * This is the argument that will be passed to the background job |
|
82 | + * |
|
83 | + * @return mixed |
|
84 | + * @since 7.0.0 |
|
85 | + */ |
|
86 | + public function getArgument(); |
|
87 | 87 | } |
@@ -35,18 +35,18 @@ |
||
35 | 35 | */ |
36 | 36 | class GenericEncryptionException extends HintException { |
37 | 37 | |
38 | - /** |
|
39 | - * @param string $message |
|
40 | - * @param string $hint |
|
41 | - * @param int $code |
|
42 | - * @param \Exception|null $previous |
|
43 | - * @since 8.1.0 |
|
44 | - */ |
|
45 | - public function __construct($message = '', $hint = '', $code = 0, \Exception $previous = null) { |
|
46 | - if (empty($message)) { |
|
47 | - $message = 'Unspecified encryption exception'; |
|
48 | - } |
|
49 | - parent::__construct($message, $hint, $code, $previous); |
|
50 | - } |
|
38 | + /** |
|
39 | + * @param string $message |
|
40 | + * @param string $hint |
|
41 | + * @param int $code |
|
42 | + * @param \Exception|null $previous |
|
43 | + * @since 8.1.0 |
|
44 | + */ |
|
45 | + public function __construct($message = '', $hint = '', $code = 0, \Exception $previous = null) { |
|
46 | + if (empty($message)) { |
|
47 | + $message = 'Unspecified encryption exception'; |
|
48 | + } |
|
49 | + parent::__construct($message, $hint, $code, $previous); |
|
50 | + } |
|
51 | 51 | |
52 | 52 | } |