@@ -26,79 +26,79 @@ |
||
26 | 26 | use OCP\Diagnostics\IEvent; |
27 | 27 | |
28 | 28 | class Event implements IEvent { |
29 | - /** |
|
30 | - * @var string |
|
31 | - */ |
|
32 | - protected $id; |
|
29 | + /** |
|
30 | + * @var string |
|
31 | + */ |
|
32 | + protected $id; |
|
33 | 33 | |
34 | - /** |
|
35 | - * @var float |
|
36 | - */ |
|
37 | - protected $start; |
|
34 | + /** |
|
35 | + * @var float |
|
36 | + */ |
|
37 | + protected $start; |
|
38 | 38 | |
39 | - /** |
|
40 | - * @var float |
|
41 | - */ |
|
42 | - protected $end; |
|
39 | + /** |
|
40 | + * @var float |
|
41 | + */ |
|
42 | + protected $end; |
|
43 | 43 | |
44 | - /** |
|
45 | - * @var string |
|
46 | - */ |
|
47 | - protected $description; |
|
44 | + /** |
|
45 | + * @var string |
|
46 | + */ |
|
47 | + protected $description; |
|
48 | 48 | |
49 | - /** |
|
50 | - * @param string $id |
|
51 | - * @param string $description |
|
52 | - * @param float $start |
|
53 | - */ |
|
54 | - public function __construct($id, $description, $start) { |
|
55 | - $this->id = $id; |
|
56 | - $this->description = $description; |
|
57 | - $this->start = $start; |
|
58 | - } |
|
49 | + /** |
|
50 | + * @param string $id |
|
51 | + * @param string $description |
|
52 | + * @param float $start |
|
53 | + */ |
|
54 | + public function __construct($id, $description, $start) { |
|
55 | + $this->id = $id; |
|
56 | + $this->description = $description; |
|
57 | + $this->start = $start; |
|
58 | + } |
|
59 | 59 | |
60 | - /** |
|
61 | - * @param float $time |
|
62 | - */ |
|
63 | - public function end($time) { |
|
64 | - $this->end = $time; |
|
65 | - } |
|
60 | + /** |
|
61 | + * @param float $time |
|
62 | + */ |
|
63 | + public function end($time) { |
|
64 | + $this->end = $time; |
|
65 | + } |
|
66 | 66 | |
67 | - /** |
|
68 | - * @return float |
|
69 | - */ |
|
70 | - public function getStart() { |
|
71 | - return $this->start; |
|
72 | - } |
|
67 | + /** |
|
68 | + * @return float |
|
69 | + */ |
|
70 | + public function getStart() { |
|
71 | + return $this->start; |
|
72 | + } |
|
73 | 73 | |
74 | - /** |
|
75 | - * @return string |
|
76 | - */ |
|
77 | - public function getId() { |
|
78 | - return $this->id; |
|
79 | - } |
|
74 | + /** |
|
75 | + * @return string |
|
76 | + */ |
|
77 | + public function getId() { |
|
78 | + return $this->id; |
|
79 | + } |
|
80 | 80 | |
81 | - /** |
|
82 | - * @return string |
|
83 | - */ |
|
84 | - public function getDescription() { |
|
85 | - return $this->description; |
|
86 | - } |
|
81 | + /** |
|
82 | + * @return string |
|
83 | + */ |
|
84 | + public function getDescription() { |
|
85 | + return $this->description; |
|
86 | + } |
|
87 | 87 | |
88 | - /** |
|
89 | - * @return float |
|
90 | - */ |
|
91 | - public function getEnd() { |
|
92 | - return $this->end; |
|
93 | - } |
|
88 | + /** |
|
89 | + * @return float |
|
90 | + */ |
|
91 | + public function getEnd() { |
|
92 | + return $this->end; |
|
93 | + } |
|
94 | 94 | |
95 | - /** |
|
96 | - * @return float |
|
97 | - */ |
|
98 | - public function getDuration() { |
|
99 | - if (!$this->end) { |
|
100 | - $this->end = microtime(true); |
|
101 | - } |
|
102 | - return $this->end - $this->start; |
|
103 | - } |
|
95 | + /** |
|
96 | + * @return float |
|
97 | + */ |
|
98 | + public function getDuration() { |
|
99 | + if (!$this->end) { |
|
100 | + $this->end = microtime(true); |
|
101 | + } |
|
102 | + return $this->end - $this->start; |
|
103 | + } |
|
104 | 104 | } |
@@ -25,14 +25,14 @@ |
||
25 | 25 | namespace OC; |
26 | 26 | |
27 | 27 | class NaturalSort_DefaultCollator { |
28 | - public function compare($a, $b) { |
|
29 | - $result = strcasecmp($a, $b); |
|
30 | - if ($result === 0) { |
|
31 | - if ($a === $b) { |
|
32 | - return 0; |
|
33 | - } |
|
34 | - return ($a > $b) ? -1 : 1; |
|
35 | - } |
|
36 | - return ($result < 0) ? -1 : 1; |
|
37 | - } |
|
28 | + public function compare($a, $b) { |
|
29 | + $result = strcasecmp($a, $b); |
|
30 | + if ($result === 0) { |
|
31 | + if ($a === $b) { |
|
32 | + return 0; |
|
33 | + } |
|
34 | + return ($a > $b) ? -1 : 1; |
|
35 | + } |
|
36 | + return ($result < 0) ? -1 : 1; |
|
37 | + } |
|
38 | 38 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public function execute($jobList, ILogger $logger = null) { |
59 | 59 | // add an interval of 15 mins |
60 | - $this->setInterval(15*60); |
|
60 | + $this->setInterval(15 * 60); |
|
61 | 61 | |
62 | 62 | $this->jobList = $jobList; |
63 | 63 | $this->logger = $logger; |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | try { |
91 | 91 | $repair->addStep($step); |
92 | 92 | } catch (\Exception $ex) { |
93 | - $this->logger->logException($ex,[ |
|
93 | + $this->logger->logException($ex, [ |
|
94 | 94 | 'app' => 'migration' |
95 | 95 | ]); |
96 | 96 |
@@ -39,82 +39,82 @@ |
||
39 | 39 | */ |
40 | 40 | class BackgroundRepair extends TimedJob { |
41 | 41 | |
42 | - /** @var IJobList */ |
|
43 | - private $jobList; |
|
44 | - |
|
45 | - /** @var ILogger */ |
|
46 | - private $logger; |
|
47 | - |
|
48 | - /** @var EventDispatcherInterface */ |
|
49 | - private $dispatcher; |
|
50 | - |
|
51 | - public function __construct(EventDispatcherInterface $dispatcher) { |
|
52 | - $this->dispatcher = $dispatcher; |
|
53 | - } |
|
54 | - |
|
55 | - /** |
|
56 | - * run the job, then remove it from the job list |
|
57 | - * |
|
58 | - * @param JobList $jobList |
|
59 | - * @param ILogger|null $logger |
|
60 | - */ |
|
61 | - public function execute($jobList, ILogger $logger = null) { |
|
62 | - // add an interval of 15 mins |
|
63 | - $this->setInterval(15*60); |
|
64 | - |
|
65 | - $this->jobList = $jobList; |
|
66 | - $this->logger = $logger; |
|
67 | - parent::execute($jobList, $logger); |
|
68 | - } |
|
69 | - |
|
70 | - /** |
|
71 | - * @param array $argument |
|
72 | - * @throws \Exception |
|
73 | - * @throws \OC\NeedsUpdateException |
|
74 | - */ |
|
75 | - protected function run($argument) { |
|
76 | - if (!isset($argument['app']) || !isset($argument['step'])) { |
|
77 | - // remove the job - we can never execute it |
|
78 | - $this->jobList->remove($this, $this->argument); |
|
79 | - return; |
|
80 | - } |
|
81 | - $app = $argument['app']; |
|
82 | - |
|
83 | - try { |
|
84 | - $this->loadApp($app); |
|
85 | - } catch (NeedsUpdateException $ex) { |
|
86 | - // as long as the app is not yet done with it's offline migration |
|
87 | - // we better not start with the live migration |
|
88 | - return; |
|
89 | - } |
|
90 | - |
|
91 | - $step = $argument['step']; |
|
92 | - $repair = new Repair([], $this->dispatcher); |
|
93 | - try { |
|
94 | - $repair->addStep($step); |
|
95 | - } catch (\Exception $ex) { |
|
96 | - $this->logger->logException($ex,[ |
|
97 | - 'app' => 'migration' |
|
98 | - ]); |
|
99 | - |
|
100 | - // remove the job - we can never execute it |
|
101 | - $this->jobList->remove($this, $this->argument); |
|
102 | - return; |
|
103 | - } |
|
104 | - |
|
105 | - // execute the repair step |
|
106 | - $repair->run(); |
|
107 | - |
|
108 | - // remove the job once executed successfully |
|
109 | - $this->jobList->remove($this, $this->argument); |
|
110 | - } |
|
111 | - |
|
112 | - /** |
|
113 | - * @codeCoverageIgnore |
|
114 | - * @param $app |
|
115 | - * @throws NeedsUpdateException |
|
116 | - */ |
|
117 | - protected function loadApp($app) { |
|
118 | - OC_App::loadApp($app); |
|
119 | - } |
|
42 | + /** @var IJobList */ |
|
43 | + private $jobList; |
|
44 | + |
|
45 | + /** @var ILogger */ |
|
46 | + private $logger; |
|
47 | + |
|
48 | + /** @var EventDispatcherInterface */ |
|
49 | + private $dispatcher; |
|
50 | + |
|
51 | + public function __construct(EventDispatcherInterface $dispatcher) { |
|
52 | + $this->dispatcher = $dispatcher; |
|
53 | + } |
|
54 | + |
|
55 | + /** |
|
56 | + * run the job, then remove it from the job list |
|
57 | + * |
|
58 | + * @param JobList $jobList |
|
59 | + * @param ILogger|null $logger |
|
60 | + */ |
|
61 | + public function execute($jobList, ILogger $logger = null) { |
|
62 | + // add an interval of 15 mins |
|
63 | + $this->setInterval(15*60); |
|
64 | + |
|
65 | + $this->jobList = $jobList; |
|
66 | + $this->logger = $logger; |
|
67 | + parent::execute($jobList, $logger); |
|
68 | + } |
|
69 | + |
|
70 | + /** |
|
71 | + * @param array $argument |
|
72 | + * @throws \Exception |
|
73 | + * @throws \OC\NeedsUpdateException |
|
74 | + */ |
|
75 | + protected function run($argument) { |
|
76 | + if (!isset($argument['app']) || !isset($argument['step'])) { |
|
77 | + // remove the job - we can never execute it |
|
78 | + $this->jobList->remove($this, $this->argument); |
|
79 | + return; |
|
80 | + } |
|
81 | + $app = $argument['app']; |
|
82 | + |
|
83 | + try { |
|
84 | + $this->loadApp($app); |
|
85 | + } catch (NeedsUpdateException $ex) { |
|
86 | + // as long as the app is not yet done with it's offline migration |
|
87 | + // we better not start with the live migration |
|
88 | + return; |
|
89 | + } |
|
90 | + |
|
91 | + $step = $argument['step']; |
|
92 | + $repair = new Repair([], $this->dispatcher); |
|
93 | + try { |
|
94 | + $repair->addStep($step); |
|
95 | + } catch (\Exception $ex) { |
|
96 | + $this->logger->logException($ex,[ |
|
97 | + 'app' => 'migration' |
|
98 | + ]); |
|
99 | + |
|
100 | + // remove the job - we can never execute it |
|
101 | + $this->jobList->remove($this, $this->argument); |
|
102 | + return; |
|
103 | + } |
|
104 | + |
|
105 | + // execute the repair step |
|
106 | + $repair->run(); |
|
107 | + |
|
108 | + // remove the job once executed successfully |
|
109 | + $this->jobList->remove($this, $this->argument); |
|
110 | + } |
|
111 | + |
|
112 | + /** |
|
113 | + * @codeCoverageIgnore |
|
114 | + * @param $app |
|
115 | + * @throws NeedsUpdateException |
|
116 | + */ |
|
117 | + protected function loadApp($app) { |
|
118 | + OC_App::loadApp($app); |
|
119 | + } |
|
120 | 120 | } |
@@ -25,12 +25,12 @@ |
||
25 | 25 | use OC\BackgroundJob\QueuedJob; |
26 | 26 | |
27 | 27 | class CallableJob extends QueuedJob { |
28 | - protected function run($serializedCallable) { |
|
29 | - $callable = unserialize($serializedCallable); |
|
30 | - if (is_callable($callable)) { |
|
31 | - $callable(); |
|
32 | - } else { |
|
33 | - throw new \InvalidArgumentException('Invalid serialized callable'); |
|
34 | - } |
|
35 | - } |
|
28 | + protected function run($serializedCallable) { |
|
29 | + $callable = unserialize($serializedCallable); |
|
30 | + if (is_callable($callable)) { |
|
31 | + $callable(); |
|
32 | + } else { |
|
33 | + throw new \InvalidArgumentException('Invalid serialized callable'); |
|
34 | + } |
|
35 | + } |
|
36 | 36 | } |
@@ -26,13 +26,13 @@ |
||
26 | 26 | use SuperClosure\Serializer; |
27 | 27 | |
28 | 28 | class ClosureJob extends QueuedJob { |
29 | - protected function run($serializedCallable) { |
|
30 | - $serializer = new Serializer(); |
|
31 | - $callable = $serializer->unserialize($serializedCallable); |
|
32 | - if (is_callable($callable)) { |
|
33 | - $callable(); |
|
34 | - } else { |
|
35 | - throw new \InvalidArgumentException('Invalid serialized callable'); |
|
36 | - } |
|
37 | - } |
|
29 | + protected function run($serializedCallable) { |
|
30 | + $serializer = new Serializer(); |
|
31 | + $callable = $serializer->unserialize($serializedCallable); |
|
32 | + if (is_callable($callable)) { |
|
33 | + $callable(); |
|
34 | + } else { |
|
35 | + throw new \InvalidArgumentException('Invalid serialized callable'); |
|
36 | + } |
|
37 | + } |
|
38 | 38 | } |
@@ -29,12 +29,12 @@ |
||
29 | 29 | * Wrap a command in the background job interface |
30 | 30 | */ |
31 | 31 | class CommandJob extends QueuedJob { |
32 | - protected function run($serializedCommand) { |
|
33 | - $command = unserialize($serializedCommand); |
|
34 | - if ($command instanceof ICommand) { |
|
35 | - $command->handle(); |
|
36 | - } else { |
|
37 | - throw new \InvalidArgumentException('Invalid serialized command'); |
|
38 | - } |
|
39 | - } |
|
32 | + protected function run($serializedCommand) { |
|
33 | + $command = unserialize($serializedCommand); |
|
34 | + if ($command instanceof ICommand) { |
|
35 | + $command->handle(); |
|
36 | + } else { |
|
37 | + throw new \InvalidArgumentException('Invalid serialized command'); |
|
38 | + } |
|
39 | + } |
|
40 | 40 | } |
@@ -24,23 +24,23 @@ |
||
24 | 24 | namespace OC\Template; |
25 | 25 | |
26 | 26 | class ResourceNotFoundException extends \LogicException { |
27 | - protected $resource; |
|
28 | - protected $webPath; |
|
27 | + protected $resource; |
|
28 | + protected $webPath; |
|
29 | 29 | |
30 | - /** |
|
31 | - * @param string $resource |
|
32 | - * @param string $webPath |
|
33 | - */ |
|
34 | - public function __construct($resource, $webPath) { |
|
35 | - parent::__construct('Resource not found'); |
|
36 | - $this->resource = $resource; |
|
37 | - $this->webPath = $webPath; |
|
38 | - } |
|
30 | + /** |
|
31 | + * @param string $resource |
|
32 | + * @param string $webPath |
|
33 | + */ |
|
34 | + public function __construct($resource, $webPath) { |
|
35 | + parent::__construct('Resource not found'); |
|
36 | + $this->resource = $resource; |
|
37 | + $this->webPath = $webPath; |
|
38 | + } |
|
39 | 39 | |
40 | - /** |
|
41 | - * @return string |
|
42 | - */ |
|
43 | - public function getResourcePath() { |
|
44 | - return $this->webPath . '/' . $this->resource; |
|
45 | - } |
|
40 | + /** |
|
41 | + * @return string |
|
42 | + */ |
|
43 | + public function getResourcePath() { |
|
44 | + return $this->webPath . '/' . $this->resource; |
|
45 | + } |
|
46 | 46 | } |
@@ -41,6 +41,6 @@ |
||
41 | 41 | * @return string |
42 | 42 | */ |
43 | 43 | public function getResourcePath() { |
44 | - return $this->webPath . '/' . $this->resource; |
|
44 | + return $this->webPath.'/'.$this->resource; |
|
45 | 45 | } |
46 | 46 | } |
@@ -26,14 +26,14 @@ |
||
26 | 26 | use OCP\AutoloadNotAllowedException; |
27 | 27 | |
28 | 28 | class RegularJob extends \OC\BackgroundJob\Job { |
29 | - public function run($argument) { |
|
30 | - try { |
|
31 | - if (is_callable($argument)) { |
|
32 | - call_user_func($argument); |
|
33 | - } |
|
34 | - } catch (AutoloadNotAllowedException $e) { |
|
35 | - // job is from a disabled app, ignore |
|
36 | - return null; |
|
37 | - } |
|
38 | - } |
|
29 | + public function run($argument) { |
|
30 | + try { |
|
31 | + if (is_callable($argument)) { |
|
32 | + call_user_func($argument); |
|
33 | + } |
|
34 | + } catch (AutoloadNotAllowedException $e) { |
|
35 | + // job is from a disabled app, ignore |
|
36 | + return null; |
|
37 | + } |
|
38 | + } |
|
39 | 39 | } |
@@ -26,67 +26,67 @@ |
||
26 | 26 | use OCP\Settings\IIconSection; |
27 | 27 | |
28 | 28 | class Section implements IIconSection { |
29 | - /** @var string */ |
|
30 | - private $id; |
|
31 | - /** @var string */ |
|
32 | - private $name; |
|
33 | - /** @var int */ |
|
34 | - private $priority; |
|
35 | - /** @var string */ |
|
36 | - private $icon; |
|
29 | + /** @var string */ |
|
30 | + private $id; |
|
31 | + /** @var string */ |
|
32 | + private $name; |
|
33 | + /** @var int */ |
|
34 | + private $priority; |
|
35 | + /** @var string */ |
|
36 | + private $icon; |
|
37 | 37 | |
38 | - /** |
|
39 | - * @param string $id |
|
40 | - * @param string $name |
|
41 | - * @param int $priority |
|
42 | - * @param string $icon |
|
43 | - */ |
|
44 | - public function __construct($id, $name, $priority, $icon = '') { |
|
45 | - $this->id = $id; |
|
46 | - $this->name = $name; |
|
47 | - $this->priority = $priority; |
|
48 | - $this->icon = $icon; |
|
49 | - } |
|
38 | + /** |
|
39 | + * @param string $id |
|
40 | + * @param string $name |
|
41 | + * @param int $priority |
|
42 | + * @param string $icon |
|
43 | + */ |
|
44 | + public function __construct($id, $name, $priority, $icon = '') { |
|
45 | + $this->id = $id; |
|
46 | + $this->name = $name; |
|
47 | + $this->priority = $priority; |
|
48 | + $this->icon = $icon; |
|
49 | + } |
|
50 | 50 | |
51 | - /** |
|
52 | - * returns the ID of the section. It is supposed to be a lower case string, |
|
53 | - * e.g. 'ldap' |
|
54 | - * |
|
55 | - * @returns string |
|
56 | - */ |
|
57 | - public function getID() { |
|
58 | - return $this->id; |
|
59 | - } |
|
51 | + /** |
|
52 | + * returns the ID of the section. It is supposed to be a lower case string, |
|
53 | + * e.g. 'ldap' |
|
54 | + * |
|
55 | + * @returns string |
|
56 | + */ |
|
57 | + public function getID() { |
|
58 | + return $this->id; |
|
59 | + } |
|
60 | 60 | |
61 | - /** |
|
62 | - * returns the translated name as it should be displayed, e.g. 'LDAP / AD |
|
63 | - * integration'. Use the L10N service to translate it. |
|
64 | - * |
|
65 | - * @return string |
|
66 | - */ |
|
67 | - public function getName() { |
|
68 | - return $this->name; |
|
69 | - } |
|
61 | + /** |
|
62 | + * returns the translated name as it should be displayed, e.g. 'LDAP / AD |
|
63 | + * integration'. Use the L10N service to translate it. |
|
64 | + * |
|
65 | + * @return string |
|
66 | + */ |
|
67 | + public function getName() { |
|
68 | + return $this->name; |
|
69 | + } |
|
70 | 70 | |
71 | - /** |
|
72 | - * @return int whether the form should be rather on the top or bottom of |
|
73 | - * the settings navigation. The sections are arranged in ascending order of |
|
74 | - * the priority values. It is required to return a value between 0 and 99. |
|
75 | - * |
|
76 | - * E.g.: 70 |
|
77 | - */ |
|
78 | - public function getPriority() { |
|
79 | - return $this->priority; |
|
80 | - } |
|
71 | + /** |
|
72 | + * @return int whether the form should be rather on the top or bottom of |
|
73 | + * the settings navigation. The sections are arranged in ascending order of |
|
74 | + * the priority values. It is required to return a value between 0 and 99. |
|
75 | + * |
|
76 | + * E.g.: 70 |
|
77 | + */ |
|
78 | + public function getPriority() { |
|
79 | + return $this->priority; |
|
80 | + } |
|
81 | 81 | |
82 | - /** |
|
83 | - * returns the relative path to an 16*16 icon describing the section. |
|
84 | - * e.g. '/core/img/places/files.svg' |
|
85 | - * |
|
86 | - * @returns string |
|
87 | - * @since 12 |
|
88 | - */ |
|
89 | - public function getIcon() { |
|
90 | - return $this->icon; |
|
91 | - } |
|
82 | + /** |
|
83 | + * returns the relative path to an 16*16 icon describing the section. |
|
84 | + * e.g. '/core/img/places/files.svg' |
|
85 | + * |
|
86 | + * @returns string |
|
87 | + * @since 12 |
|
88 | + */ |
|
89 | + public function getIcon() { |
|
90 | + return $this->icon; |
|
91 | + } |
|
92 | 92 | } |