@@ -73,19 +73,19 @@ |
||
| 73 | 73 | default: |
| 74 | 74 | foreach ($items as $key => $item) { |
| 75 | 75 | if (is_array($item)) { |
| 76 | - $output->writeln($prefix . $key . ':'); |
|
| 77 | - $this->writeArrayInOutputFormat($input, $output, $item, ' ' . $prefix); |
|
| 76 | + $output->writeln($prefix.$key.':'); |
|
| 77 | + $this->writeArrayInOutputFormat($input, $output, $item, ' '.$prefix); |
|
| 78 | 78 | continue; |
| 79 | 79 | } |
| 80 | 80 | if (!is_int($key) || ListCommand::class === get_class($this)) { |
| 81 | 81 | $value = $this->valueToString($item); |
| 82 | 82 | if (!is_null($value)) { |
| 83 | - $output->writeln($prefix . $key . ': ' . $value); |
|
| 83 | + $output->writeln($prefix.$key.': '.$value); |
|
| 84 | 84 | } else { |
| 85 | - $output->writeln($prefix . $key); |
|
| 85 | + $output->writeln($prefix.$key); |
|
| 86 | 86 | } |
| 87 | 87 | } else { |
| 88 | - $output->writeln($prefix . $this->valueToString($item)); |
|
| 88 | + $output->writeln($prefix.$this->valueToString($item)); |
|
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | 91 | break; |
@@ -34,158 +34,158 @@ |
||
| 34 | 34 | use Symfony\Component\Console\Output\OutputInterface; |
| 35 | 35 | |
| 36 | 36 | class Base extends Command implements CompletionAwareInterface { |
| 37 | - public const OUTPUT_FORMAT_PLAIN = 'plain'; |
|
| 38 | - public const OUTPUT_FORMAT_JSON = 'json'; |
|
| 39 | - public const OUTPUT_FORMAT_JSON_PRETTY = 'json_pretty'; |
|
| 40 | - |
|
| 41 | - protected $defaultOutputFormat = self::OUTPUT_FORMAT_PLAIN; |
|
| 42 | - |
|
| 43 | - /** @var boolean */ |
|
| 44 | - private $php_pcntl_signal = false; |
|
| 45 | - |
|
| 46 | - /** @var boolean */ |
|
| 47 | - private $interrupted = false; |
|
| 48 | - |
|
| 49 | - protected function configure() { |
|
| 50 | - $this |
|
| 51 | - ->addOption( |
|
| 52 | - 'output', |
|
| 53 | - null, |
|
| 54 | - InputOption::VALUE_OPTIONAL, |
|
| 55 | - 'Output format (plain, json or json_pretty, default is plain)', |
|
| 56 | - $this->defaultOutputFormat |
|
| 57 | - ) |
|
| 58 | - ; |
|
| 59 | - } |
|
| 60 | - |
|
| 61 | - /** |
|
| 62 | - * @param InputInterface $input |
|
| 63 | - * @param OutputInterface $output |
|
| 64 | - * @param array $items |
|
| 65 | - * @param string $prefix |
|
| 66 | - */ |
|
| 67 | - protected function writeArrayInOutputFormat(InputInterface $input, OutputInterface $output, $items, $prefix = ' - ') { |
|
| 68 | - switch ($input->getOption('output')) { |
|
| 69 | - case self::OUTPUT_FORMAT_JSON: |
|
| 70 | - $output->writeln(json_encode($items)); |
|
| 71 | - break; |
|
| 72 | - case self::OUTPUT_FORMAT_JSON_PRETTY: |
|
| 73 | - $output->writeln(json_encode($items, JSON_PRETTY_PRINT)); |
|
| 74 | - break; |
|
| 75 | - default: |
|
| 76 | - foreach ($items as $key => $item) { |
|
| 77 | - if (is_array($item)) { |
|
| 78 | - $output->writeln($prefix . $key . ':'); |
|
| 79 | - $this->writeArrayInOutputFormat($input, $output, $item, ' ' . $prefix); |
|
| 80 | - continue; |
|
| 81 | - } |
|
| 82 | - if (!is_int($key) || ListCommand::class === get_class($this)) { |
|
| 83 | - $value = $this->valueToString($item); |
|
| 84 | - if (!is_null($value)) { |
|
| 85 | - $output->writeln($prefix . $key . ': ' . $value); |
|
| 86 | - } else { |
|
| 87 | - $output->writeln($prefix . $key); |
|
| 88 | - } |
|
| 89 | - } else { |
|
| 90 | - $output->writeln($prefix . $this->valueToString($item)); |
|
| 91 | - } |
|
| 92 | - } |
|
| 93 | - break; |
|
| 94 | - } |
|
| 95 | - } |
|
| 96 | - |
|
| 97 | - /** |
|
| 98 | - * @param InputInterface $input |
|
| 99 | - * @param OutputInterface $output |
|
| 100 | - * @param mixed $item |
|
| 101 | - */ |
|
| 102 | - protected function writeMixedInOutputFormat(InputInterface $input, OutputInterface $output, $item) { |
|
| 103 | - if (is_array($item)) { |
|
| 104 | - $this->writeArrayInOutputFormat($input, $output, $item, ''); |
|
| 105 | - return; |
|
| 106 | - } |
|
| 107 | - |
|
| 108 | - switch ($input->getOption('output')) { |
|
| 109 | - case self::OUTPUT_FORMAT_JSON: |
|
| 110 | - $output->writeln(json_encode($item)); |
|
| 111 | - break; |
|
| 112 | - case self::OUTPUT_FORMAT_JSON_PRETTY: |
|
| 113 | - $output->writeln(json_encode($item, JSON_PRETTY_PRINT)); |
|
| 114 | - break; |
|
| 115 | - default: |
|
| 116 | - $output->writeln($this->valueToString($item, false)); |
|
| 117 | - break; |
|
| 118 | - } |
|
| 119 | - } |
|
| 120 | - |
|
| 121 | - protected function valueToString($value, $returnNull = true) { |
|
| 122 | - if ($value === false) { |
|
| 123 | - return 'false'; |
|
| 124 | - } elseif ($value === true) { |
|
| 125 | - return 'true'; |
|
| 126 | - } elseif ($value === null) { |
|
| 127 | - return $returnNull ? null : 'null'; |
|
| 128 | - } else { |
|
| 129 | - return $value; |
|
| 130 | - } |
|
| 131 | - } |
|
| 132 | - |
|
| 133 | - /** |
|
| 134 | - * Throw InterruptedException when interrupted by user |
|
| 135 | - * |
|
| 136 | - * @throws InterruptedException |
|
| 137 | - */ |
|
| 138 | - protected function abortIfInterrupted() { |
|
| 139 | - if ($this->php_pcntl_signal === false) { |
|
| 140 | - return; |
|
| 141 | - } |
|
| 142 | - |
|
| 143 | - pcntl_signal_dispatch(); |
|
| 144 | - |
|
| 145 | - if ($this->interrupted === true) { |
|
| 146 | - throw new InterruptedException('Command interrupted by user'); |
|
| 147 | - } |
|
| 148 | - } |
|
| 149 | - |
|
| 150 | - /** |
|
| 151 | - * Changes the status of the command to "interrupted" if ctrl-c has been pressed |
|
| 152 | - * |
|
| 153 | - * Gives a chance to the command to properly terminate what it's doing |
|
| 154 | - */ |
|
| 155 | - protected function cancelOperation() { |
|
| 156 | - $this->interrupted = true; |
|
| 157 | - } |
|
| 158 | - |
|
| 159 | - public function run(InputInterface $input, OutputInterface $output) { |
|
| 160 | - // check if the php pcntl_signal functions are accessible |
|
| 161 | - $this->php_pcntl_signal = function_exists('pcntl_signal'); |
|
| 162 | - if ($this->php_pcntl_signal) { |
|
| 163 | - // Collect interrupts and notify the running command |
|
| 164 | - pcntl_signal(SIGTERM, [$this, 'cancelOperation']); |
|
| 165 | - pcntl_signal(SIGINT, [$this, 'cancelOperation']); |
|
| 166 | - } |
|
| 167 | - |
|
| 168 | - return parent::run($input, $output); |
|
| 169 | - } |
|
| 170 | - |
|
| 171 | - /** |
|
| 172 | - * @param string $optionName |
|
| 173 | - * @param CompletionContext $context |
|
| 174 | - * @return string[] |
|
| 175 | - */ |
|
| 176 | - public function completeOptionValues($optionName, CompletionContext $context) { |
|
| 177 | - if ($optionName === 'output') { |
|
| 178 | - return ['plain', 'json', 'json_pretty']; |
|
| 179 | - } |
|
| 180 | - return []; |
|
| 181 | - } |
|
| 182 | - |
|
| 183 | - /** |
|
| 184 | - * @param string $argumentName |
|
| 185 | - * @param CompletionContext $context |
|
| 186 | - * @return string[] |
|
| 187 | - */ |
|
| 188 | - public function completeArgumentValues($argumentName, CompletionContext $context) { |
|
| 189 | - return []; |
|
| 190 | - } |
|
| 37 | + public const OUTPUT_FORMAT_PLAIN = 'plain'; |
|
| 38 | + public const OUTPUT_FORMAT_JSON = 'json'; |
|
| 39 | + public const OUTPUT_FORMAT_JSON_PRETTY = 'json_pretty'; |
|
| 40 | + |
|
| 41 | + protected $defaultOutputFormat = self::OUTPUT_FORMAT_PLAIN; |
|
| 42 | + |
|
| 43 | + /** @var boolean */ |
|
| 44 | + private $php_pcntl_signal = false; |
|
| 45 | + |
|
| 46 | + /** @var boolean */ |
|
| 47 | + private $interrupted = false; |
|
| 48 | + |
|
| 49 | + protected function configure() { |
|
| 50 | + $this |
|
| 51 | + ->addOption( |
|
| 52 | + 'output', |
|
| 53 | + null, |
|
| 54 | + InputOption::VALUE_OPTIONAL, |
|
| 55 | + 'Output format (plain, json or json_pretty, default is plain)', |
|
| 56 | + $this->defaultOutputFormat |
|
| 57 | + ) |
|
| 58 | + ; |
|
| 59 | + } |
|
| 60 | + |
|
| 61 | + /** |
|
| 62 | + * @param InputInterface $input |
|
| 63 | + * @param OutputInterface $output |
|
| 64 | + * @param array $items |
|
| 65 | + * @param string $prefix |
|
| 66 | + */ |
|
| 67 | + protected function writeArrayInOutputFormat(InputInterface $input, OutputInterface $output, $items, $prefix = ' - ') { |
|
| 68 | + switch ($input->getOption('output')) { |
|
| 69 | + case self::OUTPUT_FORMAT_JSON: |
|
| 70 | + $output->writeln(json_encode($items)); |
|
| 71 | + break; |
|
| 72 | + case self::OUTPUT_FORMAT_JSON_PRETTY: |
|
| 73 | + $output->writeln(json_encode($items, JSON_PRETTY_PRINT)); |
|
| 74 | + break; |
|
| 75 | + default: |
|
| 76 | + foreach ($items as $key => $item) { |
|
| 77 | + if (is_array($item)) { |
|
| 78 | + $output->writeln($prefix . $key . ':'); |
|
| 79 | + $this->writeArrayInOutputFormat($input, $output, $item, ' ' . $prefix); |
|
| 80 | + continue; |
|
| 81 | + } |
|
| 82 | + if (!is_int($key) || ListCommand::class === get_class($this)) { |
|
| 83 | + $value = $this->valueToString($item); |
|
| 84 | + if (!is_null($value)) { |
|
| 85 | + $output->writeln($prefix . $key . ': ' . $value); |
|
| 86 | + } else { |
|
| 87 | + $output->writeln($prefix . $key); |
|
| 88 | + } |
|
| 89 | + } else { |
|
| 90 | + $output->writeln($prefix . $this->valueToString($item)); |
|
| 91 | + } |
|
| 92 | + } |
|
| 93 | + break; |
|
| 94 | + } |
|
| 95 | + } |
|
| 96 | + |
|
| 97 | + /** |
|
| 98 | + * @param InputInterface $input |
|
| 99 | + * @param OutputInterface $output |
|
| 100 | + * @param mixed $item |
|
| 101 | + */ |
|
| 102 | + protected function writeMixedInOutputFormat(InputInterface $input, OutputInterface $output, $item) { |
|
| 103 | + if (is_array($item)) { |
|
| 104 | + $this->writeArrayInOutputFormat($input, $output, $item, ''); |
|
| 105 | + return; |
|
| 106 | + } |
|
| 107 | + |
|
| 108 | + switch ($input->getOption('output')) { |
|
| 109 | + case self::OUTPUT_FORMAT_JSON: |
|
| 110 | + $output->writeln(json_encode($item)); |
|
| 111 | + break; |
|
| 112 | + case self::OUTPUT_FORMAT_JSON_PRETTY: |
|
| 113 | + $output->writeln(json_encode($item, JSON_PRETTY_PRINT)); |
|
| 114 | + break; |
|
| 115 | + default: |
|
| 116 | + $output->writeln($this->valueToString($item, false)); |
|
| 117 | + break; |
|
| 118 | + } |
|
| 119 | + } |
|
| 120 | + |
|
| 121 | + protected function valueToString($value, $returnNull = true) { |
|
| 122 | + if ($value === false) { |
|
| 123 | + return 'false'; |
|
| 124 | + } elseif ($value === true) { |
|
| 125 | + return 'true'; |
|
| 126 | + } elseif ($value === null) { |
|
| 127 | + return $returnNull ? null : 'null'; |
|
| 128 | + } else { |
|
| 129 | + return $value; |
|
| 130 | + } |
|
| 131 | + } |
|
| 132 | + |
|
| 133 | + /** |
|
| 134 | + * Throw InterruptedException when interrupted by user |
|
| 135 | + * |
|
| 136 | + * @throws InterruptedException |
|
| 137 | + */ |
|
| 138 | + protected function abortIfInterrupted() { |
|
| 139 | + if ($this->php_pcntl_signal === false) { |
|
| 140 | + return; |
|
| 141 | + } |
|
| 142 | + |
|
| 143 | + pcntl_signal_dispatch(); |
|
| 144 | + |
|
| 145 | + if ($this->interrupted === true) { |
|
| 146 | + throw new InterruptedException('Command interrupted by user'); |
|
| 147 | + } |
|
| 148 | + } |
|
| 149 | + |
|
| 150 | + /** |
|
| 151 | + * Changes the status of the command to "interrupted" if ctrl-c has been pressed |
|
| 152 | + * |
|
| 153 | + * Gives a chance to the command to properly terminate what it's doing |
|
| 154 | + */ |
|
| 155 | + protected function cancelOperation() { |
|
| 156 | + $this->interrupted = true; |
|
| 157 | + } |
|
| 158 | + |
|
| 159 | + public function run(InputInterface $input, OutputInterface $output) { |
|
| 160 | + // check if the php pcntl_signal functions are accessible |
|
| 161 | + $this->php_pcntl_signal = function_exists('pcntl_signal'); |
|
| 162 | + if ($this->php_pcntl_signal) { |
|
| 163 | + // Collect interrupts and notify the running command |
|
| 164 | + pcntl_signal(SIGTERM, [$this, 'cancelOperation']); |
|
| 165 | + pcntl_signal(SIGINT, [$this, 'cancelOperation']); |
|
| 166 | + } |
|
| 167 | + |
|
| 168 | + return parent::run($input, $output); |
|
| 169 | + } |
|
| 170 | + |
|
| 171 | + /** |
|
| 172 | + * @param string $optionName |
|
| 173 | + * @param CompletionContext $context |
|
| 174 | + * @return string[] |
|
| 175 | + */ |
|
| 176 | + public function completeOptionValues($optionName, CompletionContext $context) { |
|
| 177 | + if ($optionName === 'output') { |
|
| 178 | + return ['plain', 'json', 'json_pretty']; |
|
| 179 | + } |
|
| 180 | + return []; |
|
| 181 | + } |
|
| 182 | + |
|
| 183 | + /** |
|
| 184 | + * @param string $argumentName |
|
| 185 | + * @param CompletionContext $context |
|
| 186 | + * @return string[] |
|
| 187 | + */ |
|
| 188 | + public function completeArgumentValues($argumentName, CompletionContext $context) { |
|
| 189 | + return []; |
|
| 190 | + } |
|
| 191 | 191 | } |
@@ -42,10 +42,10 @@ |
||
| 42 | 42 | */ |
| 43 | 43 | class StrictEvalContentSecurityPolicy extends ContentSecurityPolicy { |
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * @since 14.0.0 |
|
| 47 | - */ |
|
| 48 | - public function __construct() { |
|
| 49 | - $this->evalScriptAllowed = false; |
|
| 50 | - } |
|
| 45 | + /** |
|
| 46 | + * @since 14.0.0 |
|
| 47 | + */ |
|
| 48 | + public function __construct() { |
|
| 49 | + $this->evalScriptAllowed = false; |
|
| 50 | + } |
|
| 51 | 51 | } |
@@ -30,24 +30,24 @@ |
||
| 30 | 30 | |
| 31 | 31 | class CleanupInvitationTokenJob extends TimedJob { |
| 32 | 32 | |
| 33 | - /** @var IDBConnection */ |
|
| 34 | - private $db; |
|
| 35 | - |
|
| 36 | - /** @var ITimeFactory */ |
|
| 37 | - private $timeFactory; |
|
| 38 | - |
|
| 39 | - public function __construct(IDBConnection $db, ITimeFactory $timeFactory) { |
|
| 40 | - $this->db = $db; |
|
| 41 | - $this->timeFactory = $timeFactory; |
|
| 42 | - |
|
| 43 | - $this->setInterval(60 * 60 * 24); |
|
| 44 | - } |
|
| 45 | - |
|
| 46 | - public function run($argument) { |
|
| 47 | - $query = $this->db->getQueryBuilder(); |
|
| 48 | - $query->delete('calendar_invitations') |
|
| 49 | - ->where($query->expr()->lt('expiration', |
|
| 50 | - $query->createNamedParameter($this->timeFactory->getTime()))) |
|
| 51 | - ->execute(); |
|
| 52 | - } |
|
| 33 | + /** @var IDBConnection */ |
|
| 34 | + private $db; |
|
| 35 | + |
|
| 36 | + /** @var ITimeFactory */ |
|
| 37 | + private $timeFactory; |
|
| 38 | + |
|
| 39 | + public function __construct(IDBConnection $db, ITimeFactory $timeFactory) { |
|
| 40 | + $this->db = $db; |
|
| 41 | + $this->timeFactory = $timeFactory; |
|
| 42 | + |
|
| 43 | + $this->setInterval(60 * 60 * 24); |
|
| 44 | + } |
|
| 45 | + |
|
| 46 | + public function run($argument) { |
|
| 47 | + $query = $this->db->getQueryBuilder(); |
|
| 48 | + $query->delete('calendar_invitations') |
|
| 49 | + ->where($query->expr()->lt('expiration', |
|
| 50 | + $query->createNamedParameter($this->timeFactory->getTime()))) |
|
| 51 | + ->execute(); |
|
| 52 | + } |
|
| 53 | 53 | } |
@@ -44,31 +44,31 @@ |
||
| 44 | 44 | */ |
| 45 | 45 | interface ILanguageIterator extends \Iterator { |
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * Return the current element |
|
| 49 | - * |
|
| 50 | - * @since 14.0.0 |
|
| 51 | - */ |
|
| 52 | - public function current(): string; |
|
| 47 | + /** |
|
| 48 | + * Return the current element |
|
| 49 | + * |
|
| 50 | + * @since 14.0.0 |
|
| 51 | + */ |
|
| 52 | + public function current(): string; |
|
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * Move forward to next element |
|
| 56 | - * |
|
| 57 | - * @since 14.0.0 |
|
| 58 | - */ |
|
| 59 | - public function next(); |
|
| 54 | + /** |
|
| 55 | + * Move forward to next element |
|
| 56 | + * |
|
| 57 | + * @since 14.0.0 |
|
| 58 | + */ |
|
| 59 | + public function next(); |
|
| 60 | 60 | |
| 61 | - /** |
|
| 62 | - * Return the key of the current element |
|
| 63 | - * |
|
| 64 | - * @since 14.0.0 |
|
| 65 | - */ |
|
| 66 | - public function key():int; |
|
| 61 | + /** |
|
| 62 | + * Return the key of the current element |
|
| 63 | + * |
|
| 64 | + * @since 14.0.0 |
|
| 65 | + */ |
|
| 66 | + public function key():int; |
|
| 67 | 67 | |
| 68 | - /** |
|
| 69 | - * Checks if current position is valid |
|
| 70 | - * |
|
| 71 | - * @since 14.0.0 |
|
| 72 | - */ |
|
| 73 | - public function valid():bool; |
|
| 68 | + /** |
|
| 69 | + * Checks if current position is valid |
|
| 70 | + * |
|
| 71 | + * @since 14.0.0 |
|
| 72 | + */ |
|
| 73 | + public function valid():bool; |
|
| 74 | 74 | } |
@@ -30,72 +30,72 @@ |
||
| 30 | 30 | |
| 31 | 31 | class FileChanges implements IFilter { |
| 32 | 32 | |
| 33 | - /** @var IL10N */ |
|
| 34 | - protected $l; |
|
| 33 | + /** @var IL10N */ |
|
| 34 | + protected $l; |
|
| 35 | 35 | |
| 36 | - /** @var IURLGenerator */ |
|
| 37 | - protected $url; |
|
| 36 | + /** @var IURLGenerator */ |
|
| 37 | + protected $url; |
|
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * @param IL10N $l |
|
| 41 | - * @param IURLGenerator $url |
|
| 42 | - */ |
|
| 43 | - public function __construct(IL10N $l, IURLGenerator $url) { |
|
| 44 | - $this->l = $l; |
|
| 45 | - $this->url = $url; |
|
| 46 | - } |
|
| 39 | + /** |
|
| 40 | + * @param IL10N $l |
|
| 41 | + * @param IURLGenerator $url |
|
| 42 | + */ |
|
| 43 | + public function __construct(IL10N $l, IURLGenerator $url) { |
|
| 44 | + $this->l = $l; |
|
| 45 | + $this->url = $url; |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | - /** |
|
| 49 | - * @return string Lowercase a-z only identifier |
|
| 50 | - * @since 11.0.0 |
|
| 51 | - */ |
|
| 52 | - public function getIdentifier() { |
|
| 53 | - return 'files'; |
|
| 54 | - } |
|
| 48 | + /** |
|
| 49 | + * @return string Lowercase a-z only identifier |
|
| 50 | + * @since 11.0.0 |
|
| 51 | + */ |
|
| 52 | + public function getIdentifier() { |
|
| 53 | + return 'files'; |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | - /** |
|
| 57 | - * @return string A translated string |
|
| 58 | - * @since 11.0.0 |
|
| 59 | - */ |
|
| 60 | - public function getName() { |
|
| 61 | - return $this->l->t('File changes'); |
|
| 62 | - } |
|
| 56 | + /** |
|
| 57 | + * @return string A translated string |
|
| 58 | + * @since 11.0.0 |
|
| 59 | + */ |
|
| 60 | + public function getName() { |
|
| 61 | + return $this->l->t('File changes'); |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | - /** |
|
| 65 | - * @return int |
|
| 66 | - * @since 11.0.0 |
|
| 67 | - */ |
|
| 68 | - public function getPriority() { |
|
| 69 | - return 30; |
|
| 70 | - } |
|
| 64 | + /** |
|
| 65 | + * @return int |
|
| 66 | + * @since 11.0.0 |
|
| 67 | + */ |
|
| 68 | + public function getPriority() { |
|
| 69 | + return 30; |
|
| 70 | + } |
|
| 71 | 71 | |
| 72 | - /** |
|
| 73 | - * @return string Full URL to an icon, empty string when none is given |
|
| 74 | - * @since 11.0.0 |
|
| 75 | - */ |
|
| 76 | - public function getIcon() { |
|
| 77 | - return $this->url->getAbsoluteURL($this->url->imagePath('core', 'places/files.svg')); |
|
| 78 | - } |
|
| 72 | + /** |
|
| 73 | + * @return string Full URL to an icon, empty string when none is given |
|
| 74 | + * @since 11.0.0 |
|
| 75 | + */ |
|
| 76 | + public function getIcon() { |
|
| 77 | + return $this->url->getAbsoluteURL($this->url->imagePath('core', 'places/files.svg')); |
|
| 78 | + } |
|
| 79 | 79 | |
| 80 | - /** |
|
| 81 | - * @param string[] $types |
|
| 82 | - * @return string[] An array of allowed apps from which activities should be displayed |
|
| 83 | - * @since 11.0.0 |
|
| 84 | - */ |
|
| 85 | - public function filterTypes(array $types) { |
|
| 86 | - return array_intersect([ |
|
| 87 | - 'file_created', |
|
| 88 | - 'file_changed', |
|
| 89 | - 'file_deleted', |
|
| 90 | - 'file_restored', |
|
| 91 | - ], $types); |
|
| 92 | - } |
|
| 80 | + /** |
|
| 81 | + * @param string[] $types |
|
| 82 | + * @return string[] An array of allowed apps from which activities should be displayed |
|
| 83 | + * @since 11.0.0 |
|
| 84 | + */ |
|
| 85 | + public function filterTypes(array $types) { |
|
| 86 | + return array_intersect([ |
|
| 87 | + 'file_created', |
|
| 88 | + 'file_changed', |
|
| 89 | + 'file_deleted', |
|
| 90 | + 'file_restored', |
|
| 91 | + ], $types); |
|
| 92 | + } |
|
| 93 | 93 | |
| 94 | - /** |
|
| 95 | - * @return string[] An array of allowed apps from which activities should be displayed |
|
| 96 | - * @since 11.0.0 |
|
| 97 | - */ |
|
| 98 | - public function allowedApps() { |
|
| 99 | - return ['files']; |
|
| 100 | - } |
|
| 94 | + /** |
|
| 95 | + * @return string[] An array of allowed apps from which activities should be displayed |
|
| 96 | + * @since 11.0.0 |
|
| 97 | + */ |
|
| 98 | + public function allowedApps() { |
|
| 99 | + return ['files']; |
|
| 100 | + } |
|
| 101 | 101 | } |
@@ -30,65 +30,65 @@ |
||
| 30 | 30 | |
| 31 | 31 | class Calendar implements IFilter { |
| 32 | 32 | |
| 33 | - /** @var IL10N */ |
|
| 34 | - protected $l; |
|
| 33 | + /** @var IL10N */ |
|
| 34 | + protected $l; |
|
| 35 | 35 | |
| 36 | - /** @var IURLGenerator */ |
|
| 37 | - protected $url; |
|
| 36 | + /** @var IURLGenerator */ |
|
| 37 | + protected $url; |
|
| 38 | 38 | |
| 39 | - public function __construct(IL10N $l, IURLGenerator $url) { |
|
| 40 | - $this->l = $l; |
|
| 41 | - $this->url = $url; |
|
| 42 | - } |
|
| 39 | + public function __construct(IL10N $l, IURLGenerator $url) { |
|
| 40 | + $this->l = $l; |
|
| 41 | + $this->url = $url; |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * @return string Lowercase a-z and underscore only identifier |
|
| 46 | - * @since 11.0.0 |
|
| 47 | - */ |
|
| 48 | - public function getIdentifier() { |
|
| 49 | - return 'calendar'; |
|
| 50 | - } |
|
| 44 | + /** |
|
| 45 | + * @return string Lowercase a-z and underscore only identifier |
|
| 46 | + * @since 11.0.0 |
|
| 47 | + */ |
|
| 48 | + public function getIdentifier() { |
|
| 49 | + return 'calendar'; |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - /** |
|
| 53 | - * @return string A translated string |
|
| 54 | - * @since 11.0.0 |
|
| 55 | - */ |
|
| 56 | - public function getName() { |
|
| 57 | - return $this->l->t('Calendar'); |
|
| 58 | - } |
|
| 52 | + /** |
|
| 53 | + * @return string A translated string |
|
| 54 | + * @since 11.0.0 |
|
| 55 | + */ |
|
| 56 | + public function getName() { |
|
| 57 | + return $this->l->t('Calendar'); |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | - /** |
|
| 61 | - * @return int whether the filter should be rather on the top or bottom of |
|
| 62 | - * the admin section. The filters are arranged in ascending order of the |
|
| 63 | - * priority values. It is required to return a value between 0 and 100. |
|
| 64 | - * @since 11.0.0 |
|
| 65 | - */ |
|
| 66 | - public function getPriority() { |
|
| 67 | - return 40; |
|
| 68 | - } |
|
| 60 | + /** |
|
| 61 | + * @return int whether the filter should be rather on the top or bottom of |
|
| 62 | + * the admin section. The filters are arranged in ascending order of the |
|
| 63 | + * priority values. It is required to return a value between 0 and 100. |
|
| 64 | + * @since 11.0.0 |
|
| 65 | + */ |
|
| 66 | + public function getPriority() { |
|
| 67 | + return 40; |
|
| 68 | + } |
|
| 69 | 69 | |
| 70 | - /** |
|
| 71 | - * @return string Full URL to an icon, empty string when none is given |
|
| 72 | - * @since 11.0.0 |
|
| 73 | - */ |
|
| 74 | - public function getIcon() { |
|
| 75 | - return $this->url->getAbsoluteURL($this->url->imagePath('core', 'places/calendar.svg')); |
|
| 76 | - } |
|
| 70 | + /** |
|
| 71 | + * @return string Full URL to an icon, empty string when none is given |
|
| 72 | + * @since 11.0.0 |
|
| 73 | + */ |
|
| 74 | + public function getIcon() { |
|
| 75 | + return $this->url->getAbsoluteURL($this->url->imagePath('core', 'places/calendar.svg')); |
|
| 76 | + } |
|
| 77 | 77 | |
| 78 | - /** |
|
| 79 | - * @param string[] $types |
|
| 80 | - * @return string[] An array of allowed apps from which activities should be displayed |
|
| 81 | - * @since 11.0.0 |
|
| 82 | - */ |
|
| 83 | - public function filterTypes(array $types) { |
|
| 84 | - return array_intersect(['calendar', 'calendar_event'], $types); |
|
| 85 | - } |
|
| 78 | + /** |
|
| 79 | + * @param string[] $types |
|
| 80 | + * @return string[] An array of allowed apps from which activities should be displayed |
|
| 81 | + * @since 11.0.0 |
|
| 82 | + */ |
|
| 83 | + public function filterTypes(array $types) { |
|
| 84 | + return array_intersect(['calendar', 'calendar_event'], $types); |
|
| 85 | + } |
|
| 86 | 86 | |
| 87 | - /** |
|
| 88 | - * @return string[] An array of allowed apps from which activities should be displayed |
|
| 89 | - * @since 11.0.0 |
|
| 90 | - */ |
|
| 91 | - public function allowedApps() { |
|
| 92 | - return []; |
|
| 93 | - } |
|
| 87 | + /** |
|
| 88 | + * @return string[] An array of allowed apps from which activities should be displayed |
|
| 89 | + * @since 11.0.0 |
|
| 90 | + */ |
|
| 91 | + public function allowedApps() { |
|
| 92 | + return []; |
|
| 93 | + } |
|
| 94 | 94 | } |
@@ -30,14 +30,14 @@ |
||
| 30 | 30 | * Class Version14000Date20180712153140 |
| 31 | 31 | */ |
| 32 | 32 | class Version14000Date20180712153140 extends SimpleMigrationStep { |
| 33 | - public function changeSchema(\OCP\Migration\IOutput $output, \Closure $schemaClosure, array $options) { |
|
| 33 | + public function changeSchema(\OCP\Migration\IOutput $output, \Closure $schemaClosure, array $options) { |
|
| 34 | 34 | |
| 35 | - /** @var ISchemaWrapper $schema */ |
|
| 36 | - $schema = $schemaClosure(); |
|
| 35 | + /** @var ISchemaWrapper $schema */ |
|
| 36 | + $schema = $schemaClosure(); |
|
| 37 | 37 | |
| 38 | - $table = $schema->getTable('share'); |
|
| 39 | - $table->addColumn('note', 'text', ['notnull' => false]); |
|
| 38 | + $table = $schema->getTable('share'); |
|
| 39 | + $table->addColumn('note', 'text', ['notnull' => false]); |
|
| 40 | 40 | |
| 41 | - return $schema; |
|
| 42 | - } |
|
| 41 | + return $schema; |
|
| 42 | + } |
|
| 43 | 43 | } |
@@ -31,92 +31,92 @@ |
||
| 31 | 31 | |
| 32 | 32 | class NavigationController extends OCSController { |
| 33 | 33 | |
| 34 | - /** @var INavigationManager */ |
|
| 35 | - private $navigationManager; |
|
| 34 | + /** @var INavigationManager */ |
|
| 35 | + private $navigationManager; |
|
| 36 | 36 | |
| 37 | - /** @var IURLGenerator */ |
|
| 38 | - private $urlGenerator; |
|
| 37 | + /** @var IURLGenerator */ |
|
| 38 | + private $urlGenerator; |
|
| 39 | 39 | |
| 40 | - public function __construct(string $appName, IRequest $request, INavigationManager $navigationManager, IURLGenerator $urlGenerator) { |
|
| 41 | - parent::__construct($appName, $request); |
|
| 42 | - $this->navigationManager = $navigationManager; |
|
| 43 | - $this->urlGenerator = $urlGenerator; |
|
| 44 | - } |
|
| 40 | + public function __construct(string $appName, IRequest $request, INavigationManager $navigationManager, IURLGenerator $urlGenerator) { |
|
| 41 | + parent::__construct($appName, $request); |
|
| 42 | + $this->navigationManager = $navigationManager; |
|
| 43 | + $this->urlGenerator = $urlGenerator; |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * @NoAdminRequired |
|
| 48 | - * @NoCSRFRequired |
|
| 49 | - * |
|
| 50 | - * @param bool $absolute |
|
| 51 | - * @return DataResponse |
|
| 52 | - */ |
|
| 53 | - public function getAppsNavigation(bool $absolute = false): DataResponse { |
|
| 54 | - $navigation = $this->navigationManager->getAll(); |
|
| 55 | - if ($absolute) { |
|
| 56 | - $navigation = $this->rewriteToAbsoluteUrls($navigation); |
|
| 57 | - } |
|
| 58 | - $navigation = array_values($navigation); |
|
| 59 | - $etag = $this->generateETag($navigation); |
|
| 60 | - if ($this->request->getHeader('If-None-Match') === $etag) { |
|
| 61 | - return new DataResponse([], Http::STATUS_NOT_MODIFIED); |
|
| 62 | - } |
|
| 63 | - $response = new DataResponse($navigation); |
|
| 64 | - $response->setETag($etag); |
|
| 65 | - return $response; |
|
| 66 | - } |
|
| 46 | + /** |
|
| 47 | + * @NoAdminRequired |
|
| 48 | + * @NoCSRFRequired |
|
| 49 | + * |
|
| 50 | + * @param bool $absolute |
|
| 51 | + * @return DataResponse |
|
| 52 | + */ |
|
| 53 | + public function getAppsNavigation(bool $absolute = false): DataResponse { |
|
| 54 | + $navigation = $this->navigationManager->getAll(); |
|
| 55 | + if ($absolute) { |
|
| 56 | + $navigation = $this->rewriteToAbsoluteUrls($navigation); |
|
| 57 | + } |
|
| 58 | + $navigation = array_values($navigation); |
|
| 59 | + $etag = $this->generateETag($navigation); |
|
| 60 | + if ($this->request->getHeader('If-None-Match') === $etag) { |
|
| 61 | + return new DataResponse([], Http::STATUS_NOT_MODIFIED); |
|
| 62 | + } |
|
| 63 | + $response = new DataResponse($navigation); |
|
| 64 | + $response->setETag($etag); |
|
| 65 | + return $response; |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - /** |
|
| 69 | - * @NoAdminRequired |
|
| 70 | - * @NoCSRFRequired |
|
| 71 | - * |
|
| 72 | - * @param bool $absolute |
|
| 73 | - * @return DataResponse |
|
| 74 | - */ |
|
| 75 | - public function getSettingsNavigation(bool $absolute = false): DataResponse { |
|
| 76 | - $navigation = $this->navigationManager->getAll('settings'); |
|
| 77 | - if ($absolute) { |
|
| 78 | - $navigation = $this->rewriteToAbsoluteUrls($navigation); |
|
| 79 | - } |
|
| 80 | - $navigation = array_values($navigation); |
|
| 81 | - $etag = $this->generateETag($navigation); |
|
| 82 | - if ($this->request->getHeader('If-None-Match') === $etag) { |
|
| 83 | - return new DataResponse([], Http::STATUS_NOT_MODIFIED); |
|
| 84 | - } |
|
| 85 | - $response = new DataResponse($navigation); |
|
| 86 | - $response->setETag($etag); |
|
| 87 | - return $response; |
|
| 88 | - } |
|
| 68 | + /** |
|
| 69 | + * @NoAdminRequired |
|
| 70 | + * @NoCSRFRequired |
|
| 71 | + * |
|
| 72 | + * @param bool $absolute |
|
| 73 | + * @return DataResponse |
|
| 74 | + */ |
|
| 75 | + public function getSettingsNavigation(bool $absolute = false): DataResponse { |
|
| 76 | + $navigation = $this->navigationManager->getAll('settings'); |
|
| 77 | + if ($absolute) { |
|
| 78 | + $navigation = $this->rewriteToAbsoluteUrls($navigation); |
|
| 79 | + } |
|
| 80 | + $navigation = array_values($navigation); |
|
| 81 | + $etag = $this->generateETag($navigation); |
|
| 82 | + if ($this->request->getHeader('If-None-Match') === $etag) { |
|
| 83 | + return new DataResponse([], Http::STATUS_NOT_MODIFIED); |
|
| 84 | + } |
|
| 85 | + $response = new DataResponse($navigation); |
|
| 86 | + $response->setETag($etag); |
|
| 87 | + return $response; |
|
| 88 | + } |
|
| 89 | 89 | |
| 90 | - /** |
|
| 91 | - * Generate an ETag for a list of navigation entries |
|
| 92 | - * |
|
| 93 | - * @param array $navigation |
|
| 94 | - * @return string |
|
| 95 | - */ |
|
| 96 | - private function generateETag(array $navigation): string { |
|
| 97 | - foreach ($navigation as &$nav) { |
|
| 98 | - if ($nav['id'] === 'logout') { |
|
| 99 | - $nav['href'] = 'logout'; |
|
| 100 | - } |
|
| 101 | - } |
|
| 102 | - return md5(json_encode($navigation)); |
|
| 103 | - } |
|
| 90 | + /** |
|
| 91 | + * Generate an ETag for a list of navigation entries |
|
| 92 | + * |
|
| 93 | + * @param array $navigation |
|
| 94 | + * @return string |
|
| 95 | + */ |
|
| 96 | + private function generateETag(array $navigation): string { |
|
| 97 | + foreach ($navigation as &$nav) { |
|
| 98 | + if ($nav['id'] === 'logout') { |
|
| 99 | + $nav['href'] = 'logout'; |
|
| 100 | + } |
|
| 101 | + } |
|
| 102 | + return md5(json_encode($navigation)); |
|
| 103 | + } |
|
| 104 | 104 | |
| 105 | - /** |
|
| 106 | - * Rewrite href attribute of navigation entries to an absolute URL |
|
| 107 | - * |
|
| 108 | - * @param array $navigation |
|
| 109 | - * @return array |
|
| 110 | - */ |
|
| 111 | - private function rewriteToAbsoluteUrls(array $navigation): array { |
|
| 112 | - foreach ($navigation as &$entry) { |
|
| 113 | - if (0 !== strpos($entry['href'], $this->urlGenerator->getBaseUrl())) { |
|
| 114 | - $entry['href'] = $this->urlGenerator->getAbsoluteURL($entry['href']); |
|
| 115 | - } |
|
| 116 | - if (0 !== strpos($entry['icon'], $this->urlGenerator->getBaseUrl())) { |
|
| 117 | - $entry['icon'] = $this->urlGenerator->getAbsoluteURL($entry['icon']); |
|
| 118 | - } |
|
| 119 | - } |
|
| 120 | - return $navigation; |
|
| 121 | - } |
|
| 105 | + /** |
|
| 106 | + * Rewrite href attribute of navigation entries to an absolute URL |
|
| 107 | + * |
|
| 108 | + * @param array $navigation |
|
| 109 | + * @return array |
|
| 110 | + */ |
|
| 111 | + private function rewriteToAbsoluteUrls(array $navigation): array { |
|
| 112 | + foreach ($navigation as &$entry) { |
|
| 113 | + if (0 !== strpos($entry['href'], $this->urlGenerator->getBaseUrl())) { |
|
| 114 | + $entry['href'] = $this->urlGenerator->getAbsoluteURL($entry['href']); |
|
| 115 | + } |
|
| 116 | + if (0 !== strpos($entry['icon'], $this->urlGenerator->getBaseUrl())) { |
|
| 117 | + $entry['icon'] = $this->urlGenerator->getAbsoluteURL($entry['icon']); |
|
| 118 | + } |
|
| 119 | + } |
|
| 120 | + return $navigation; |
|
| 121 | + } |
|
| 122 | 122 | } |
@@ -37,67 +37,67 @@ |
||
| 37 | 37 | */ |
| 38 | 38 | interface IAvatar { |
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * get the users avatar |
|
| 42 | - * @param int $size size in px of the avatar, avatars are square, defaults to 64, -1 can be used to not scale the image |
|
| 43 | - * @return boolean|\OCP\IImage containing the avatar or false if there's no image |
|
| 44 | - * @since 6.0.0 - size of -1 was added in 9.0.0 |
|
| 45 | - */ |
|
| 46 | - public function get($size = 64); |
|
| 40 | + /** |
|
| 41 | + * get the users avatar |
|
| 42 | + * @param int $size size in px of the avatar, avatars are square, defaults to 64, -1 can be used to not scale the image |
|
| 43 | + * @return boolean|\OCP\IImage containing the avatar or false if there's no image |
|
| 44 | + * @since 6.0.0 - size of -1 was added in 9.0.0 |
|
| 45 | + */ |
|
| 46 | + public function get($size = 64); |
|
| 47 | 47 | |
| 48 | - /** |
|
| 49 | - * Check if an avatar exists for the user |
|
| 50 | - * |
|
| 51 | - * @return bool |
|
| 52 | - * @since 8.1.0 |
|
| 53 | - */ |
|
| 54 | - public function exists(); |
|
| 48 | + /** |
|
| 49 | + * Check if an avatar exists for the user |
|
| 50 | + * |
|
| 51 | + * @return bool |
|
| 52 | + * @since 8.1.0 |
|
| 53 | + */ |
|
| 54 | + public function exists(); |
|
| 55 | 55 | |
| 56 | - /** |
|
| 57 | - * Check if the avatar of a user is a custom uploaded one |
|
| 58 | - * |
|
| 59 | - * @return bool |
|
| 60 | - * @since 14.0.0 |
|
| 61 | - */ |
|
| 62 | - public function isCustomAvatar(): bool; |
|
| 56 | + /** |
|
| 57 | + * Check if the avatar of a user is a custom uploaded one |
|
| 58 | + * |
|
| 59 | + * @return bool |
|
| 60 | + * @since 14.0.0 |
|
| 61 | + */ |
|
| 62 | + public function isCustomAvatar(): bool; |
|
| 63 | 63 | |
| 64 | - /** |
|
| 65 | - * sets the users avatar |
|
| 66 | - * @param \OCP\IImage|resource|string $data An image object, imagedata or path to set a new avatar |
|
| 67 | - * @throws \Exception if the provided file is not a jpg or png image |
|
| 68 | - * @throws \Exception if the provided image is not valid |
|
| 69 | - * @throws \OC\NotSquareException if the image is not square |
|
| 70 | - * @return void |
|
| 71 | - * @since 6.0.0 |
|
| 72 | - */ |
|
| 73 | - public function set($data); |
|
| 64 | + /** |
|
| 65 | + * sets the users avatar |
|
| 66 | + * @param \OCP\IImage|resource|string $data An image object, imagedata or path to set a new avatar |
|
| 67 | + * @throws \Exception if the provided file is not a jpg or png image |
|
| 68 | + * @throws \Exception if the provided image is not valid |
|
| 69 | + * @throws \OC\NotSquareException if the image is not square |
|
| 70 | + * @return void |
|
| 71 | + * @since 6.0.0 |
|
| 72 | + */ |
|
| 73 | + public function set($data); |
|
| 74 | 74 | |
| 75 | - /** |
|
| 76 | - * remove the users avatar |
|
| 77 | - * @return void |
|
| 78 | - * @since 6.0.0 |
|
| 79 | - */ |
|
| 80 | - public function remove(); |
|
| 75 | + /** |
|
| 76 | + * remove the users avatar |
|
| 77 | + * @return void |
|
| 78 | + * @since 6.0.0 |
|
| 79 | + */ |
|
| 80 | + public function remove(); |
|
| 81 | 81 | |
| 82 | - /** |
|
| 83 | - * Get the file of the avatar |
|
| 84 | - * @param int $size -1 can be used to not scale the image |
|
| 85 | - * @return File |
|
| 86 | - * @throws NotFoundException |
|
| 87 | - * @since 9.0.0 |
|
| 88 | - */ |
|
| 89 | - public function getFile($size); |
|
| 82 | + /** |
|
| 83 | + * Get the file of the avatar |
|
| 84 | + * @param int $size -1 can be used to not scale the image |
|
| 85 | + * @return File |
|
| 86 | + * @throws NotFoundException |
|
| 87 | + * @since 9.0.0 |
|
| 88 | + */ |
|
| 89 | + public function getFile($size); |
|
| 90 | 90 | |
| 91 | - /** |
|
| 92 | - * @param string $text |
|
| 93 | - * @return Color Object containting r g b int in the range [0, 255] |
|
| 94 | - * @since 14.0.0 |
|
| 95 | - */ |
|
| 96 | - public function avatarBackgroundColor(string $text); |
|
| 91 | + /** |
|
| 92 | + * @param string $text |
|
| 93 | + * @return Color Object containting r g b int in the range [0, 255] |
|
| 94 | + * @since 14.0.0 |
|
| 95 | + */ |
|
| 96 | + public function avatarBackgroundColor(string $text); |
|
| 97 | 97 | |
| 98 | - /** |
|
| 99 | - * Handle a changed user |
|
| 100 | - * @since 13.0.0 |
|
| 101 | - */ |
|
| 102 | - public function userChanged($feature, $oldValue, $newValue); |
|
| 98 | + /** |
|
| 99 | + * Handle a changed user |
|
| 100 | + * @since 13.0.0 |
|
| 101 | + */ |
|
| 102 | + public function userChanged($feature, $oldValue, $newValue); |
|
| 103 | 103 | } |