@@ -42,31 +42,31 @@ |
||
42 | 42 | */ |
43 | 43 | class Application extends App implements IBootstrap { |
44 | 44 | |
45 | - /** @var string */ |
|
46 | - public const APP_ID = 'weather_status'; |
|
45 | + /** @var string */ |
|
46 | + public const APP_ID = 'weather_status'; |
|
47 | 47 | |
48 | - /** |
|
49 | - * Application constructor. |
|
50 | - * |
|
51 | - * @param array $urlParams |
|
52 | - */ |
|
53 | - public function __construct(array $urlParams = []) { |
|
54 | - parent::__construct(self::APP_ID, $urlParams); |
|
48 | + /** |
|
49 | + * Application constructor. |
|
50 | + * |
|
51 | + * @param array $urlParams |
|
52 | + */ |
|
53 | + public function __construct(array $urlParams = []) { |
|
54 | + parent::__construct(self::APP_ID, $urlParams); |
|
55 | 55 | |
56 | - $dispatcher = $this->getContainer()->query(IEventDispatcher::class); |
|
57 | - $dispatcher->addListener(RegisterWidgetEvent::class, function (Event $e) { |
|
58 | - Util::addScript(self::APP_ID, 'weather-status'); |
|
59 | - }); |
|
60 | - } |
|
56 | + $dispatcher = $this->getContainer()->query(IEventDispatcher::class); |
|
57 | + $dispatcher->addListener(RegisterWidgetEvent::class, function (Event $e) { |
|
58 | + Util::addScript(self::APP_ID, 'weather-status'); |
|
59 | + }); |
|
60 | + } |
|
61 | 61 | |
62 | - /** |
|
63 | - * @inheritDoc |
|
64 | - */ |
|
65 | - public function register(IRegistrationContext $context): void { |
|
66 | - // Register OCS Capabilities |
|
67 | - $context->registerCapability(Capabilities::class); |
|
68 | - } |
|
62 | + /** |
|
63 | + * @inheritDoc |
|
64 | + */ |
|
65 | + public function register(IRegistrationContext $context): void { |
|
66 | + // Register OCS Capabilities |
|
67 | + $context->registerCapability(Capabilities::class); |
|
68 | + } |
|
69 | 69 | |
70 | - public function boot(IBootContext $context): void { |
|
71 | - } |
|
70 | + public function boot(IBootContext $context): void { |
|
71 | + } |
|
72 | 72 | } |
@@ -35,21 +35,21 @@ |
||
35 | 35 | */ |
36 | 36 | class Capabilities implements ICapability { |
37 | 37 | |
38 | - /** |
|
39 | - * Capabilities constructor. |
|
40 | - * |
|
41 | - */ |
|
42 | - public function __construct() { |
|
43 | - } |
|
38 | + /** |
|
39 | + * Capabilities constructor. |
|
40 | + * |
|
41 | + */ |
|
42 | + public function __construct() { |
|
43 | + } |
|
44 | 44 | |
45 | - /** |
|
46 | - * @inheritDoc |
|
47 | - */ |
|
48 | - public function getCapabilities() { |
|
49 | - return [ |
|
50 | - Application::APP_ID => [ |
|
51 | - 'enabled' => true, |
|
52 | - ], |
|
53 | - ]; |
|
54 | - } |
|
45 | + /** |
|
46 | + * @inheritDoc |
|
47 | + */ |
|
48 | + public function getCapabilities() { |
|
49 | + return [ |
|
50 | + Application::APP_ID => [ |
|
51 | + 'enabled' => true, |
|
52 | + ], |
|
53 | + ]; |
|
54 | + } |
|
55 | 55 | } |
@@ -34,91 +34,91 @@ |
||
34 | 34 | |
35 | 35 | class BuildCalendarSearchIndexBackgroundJob extends QueuedJob { |
36 | 36 | |
37 | - /** @var IDBConnection */ |
|
38 | - private $db; |
|
39 | - |
|
40 | - /** @var CalDavBackend */ |
|
41 | - private $calDavBackend; |
|
42 | - |
|
43 | - /** @var ILogger */ |
|
44 | - private $logger; |
|
45 | - |
|
46 | - /** @var IJobList */ |
|
47 | - private $jobList; |
|
48 | - |
|
49 | - /** @var ITimeFactory */ |
|
50 | - private $timeFactory; |
|
51 | - |
|
52 | - /** |
|
53 | - * @param IDBConnection $db |
|
54 | - * @param CalDavBackend $calDavBackend |
|
55 | - * @param ILogger $logger |
|
56 | - * @param IJobList $jobList |
|
57 | - * @param ITimeFactory $timeFactory |
|
58 | - */ |
|
59 | - public function __construct(IDBConnection $db, |
|
60 | - CalDavBackend $calDavBackend, |
|
61 | - ILogger $logger, |
|
62 | - IJobList $jobList, |
|
63 | - ITimeFactory $timeFactory) { |
|
64 | - $this->db = $db; |
|
65 | - $this->calDavBackend = $calDavBackend; |
|
66 | - $this->logger = $logger; |
|
67 | - $this->jobList = $jobList; |
|
68 | - $this->timeFactory = $timeFactory; |
|
69 | - } |
|
70 | - |
|
71 | - public function run($arguments) { |
|
72 | - $offset = (int) $arguments['offset']; |
|
73 | - $stopAt = (int) $arguments['stopAt']; |
|
74 | - |
|
75 | - $this->logger->info('Building calendar index (' . $offset .'/' . $stopAt . ')'); |
|
76 | - |
|
77 | - $startTime = $this->timeFactory->getTime(); |
|
78 | - while (($this->timeFactory->getTime() - $startTime) < 15) { |
|
79 | - $offset = $this->buildIndex($offset, $stopAt); |
|
80 | - if ($offset >= $stopAt) { |
|
81 | - break; |
|
82 | - } |
|
83 | - } |
|
84 | - |
|
85 | - if ($offset >= $stopAt) { |
|
86 | - $this->logger->info('Building calendar index done'); |
|
87 | - } else { |
|
88 | - $this->jobList->add(self::class, [ |
|
89 | - 'offset' => $offset, |
|
90 | - 'stopAt' => $stopAt |
|
91 | - ]); |
|
92 | - $this->logger->info('New building calendar index job scheduled with offset ' . $offset); |
|
93 | - } |
|
94 | - } |
|
95 | - |
|
96 | - /** |
|
97 | - * @param int $offset |
|
98 | - * @param int $stopAt |
|
99 | - * @return int |
|
100 | - */ |
|
101 | - private function buildIndex(int $offset, int $stopAt): int { |
|
102 | - $query = $this->db->getQueryBuilder(); |
|
103 | - $query->select(['id', 'calendarid', 'uri', 'calendardata']) |
|
104 | - ->from('calendarobjects') |
|
105 | - ->where($query->expr()->lte('id', $query->createNamedParameter($stopAt))) |
|
106 | - ->andWhere($query->expr()->gt('id', $query->createNamedParameter($offset))) |
|
107 | - ->orderBy('id', 'ASC') |
|
108 | - ->setMaxResults(500); |
|
109 | - |
|
110 | - $result = $query->execute(); |
|
111 | - while ($row = $result->fetch(\PDO::FETCH_ASSOC)) { |
|
112 | - $offset = $row['id']; |
|
113 | - |
|
114 | - $calendarData = $row['calendardata']; |
|
115 | - if (is_resource($calendarData)) { |
|
116 | - $calendarData = stream_get_contents($calendarData); |
|
117 | - } |
|
118 | - |
|
119 | - $this->calDavBackend->updateProperties($row['calendarid'], $row['uri'], $calendarData); |
|
120 | - } |
|
121 | - |
|
122 | - return $offset; |
|
123 | - } |
|
37 | + /** @var IDBConnection */ |
|
38 | + private $db; |
|
39 | + |
|
40 | + /** @var CalDavBackend */ |
|
41 | + private $calDavBackend; |
|
42 | + |
|
43 | + /** @var ILogger */ |
|
44 | + private $logger; |
|
45 | + |
|
46 | + /** @var IJobList */ |
|
47 | + private $jobList; |
|
48 | + |
|
49 | + /** @var ITimeFactory */ |
|
50 | + private $timeFactory; |
|
51 | + |
|
52 | + /** |
|
53 | + * @param IDBConnection $db |
|
54 | + * @param CalDavBackend $calDavBackend |
|
55 | + * @param ILogger $logger |
|
56 | + * @param IJobList $jobList |
|
57 | + * @param ITimeFactory $timeFactory |
|
58 | + */ |
|
59 | + public function __construct(IDBConnection $db, |
|
60 | + CalDavBackend $calDavBackend, |
|
61 | + ILogger $logger, |
|
62 | + IJobList $jobList, |
|
63 | + ITimeFactory $timeFactory) { |
|
64 | + $this->db = $db; |
|
65 | + $this->calDavBackend = $calDavBackend; |
|
66 | + $this->logger = $logger; |
|
67 | + $this->jobList = $jobList; |
|
68 | + $this->timeFactory = $timeFactory; |
|
69 | + } |
|
70 | + |
|
71 | + public function run($arguments) { |
|
72 | + $offset = (int) $arguments['offset']; |
|
73 | + $stopAt = (int) $arguments['stopAt']; |
|
74 | + |
|
75 | + $this->logger->info('Building calendar index (' . $offset .'/' . $stopAt . ')'); |
|
76 | + |
|
77 | + $startTime = $this->timeFactory->getTime(); |
|
78 | + while (($this->timeFactory->getTime() - $startTime) < 15) { |
|
79 | + $offset = $this->buildIndex($offset, $stopAt); |
|
80 | + if ($offset >= $stopAt) { |
|
81 | + break; |
|
82 | + } |
|
83 | + } |
|
84 | + |
|
85 | + if ($offset >= $stopAt) { |
|
86 | + $this->logger->info('Building calendar index done'); |
|
87 | + } else { |
|
88 | + $this->jobList->add(self::class, [ |
|
89 | + 'offset' => $offset, |
|
90 | + 'stopAt' => $stopAt |
|
91 | + ]); |
|
92 | + $this->logger->info('New building calendar index job scheduled with offset ' . $offset); |
|
93 | + } |
|
94 | + } |
|
95 | + |
|
96 | + /** |
|
97 | + * @param int $offset |
|
98 | + * @param int $stopAt |
|
99 | + * @return int |
|
100 | + */ |
|
101 | + private function buildIndex(int $offset, int $stopAt): int { |
|
102 | + $query = $this->db->getQueryBuilder(); |
|
103 | + $query->select(['id', 'calendarid', 'uri', 'calendardata']) |
|
104 | + ->from('calendarobjects') |
|
105 | + ->where($query->expr()->lte('id', $query->createNamedParameter($stopAt))) |
|
106 | + ->andWhere($query->expr()->gt('id', $query->createNamedParameter($offset))) |
|
107 | + ->orderBy('id', 'ASC') |
|
108 | + ->setMaxResults(500); |
|
109 | + |
|
110 | + $result = $query->execute(); |
|
111 | + while ($row = $result->fetch(\PDO::FETCH_ASSOC)) { |
|
112 | + $offset = $row['id']; |
|
113 | + |
|
114 | + $calendarData = $row['calendardata']; |
|
115 | + if (is_resource($calendarData)) { |
|
116 | + $calendarData = stream_get_contents($calendarData); |
|
117 | + } |
|
118 | + |
|
119 | + $this->calDavBackend->updateProperties($row['calendarid'], $row['uri'], $calendarData); |
|
120 | + } |
|
121 | + |
|
122 | + return $offset; |
|
123 | + } |
|
124 | 124 | } |
@@ -37,244 +37,244 @@ |
||
37 | 37 | use Psr\Log\LoggerInterface; |
38 | 38 | |
39 | 39 | class TempManager implements ITempManager { |
40 | - /** @var string[] Current temporary files and folders, used for cleanup */ |
|
41 | - protected $current = []; |
|
42 | - /** @var string i.e. /tmp on linux systems */ |
|
43 | - protected $tmpBaseDir; |
|
44 | - /** @var LoggerInterface */ |
|
45 | - protected $log; |
|
46 | - /** @var IConfig */ |
|
47 | - protected $config; |
|
48 | - /** @var IniGetWrapper */ |
|
49 | - protected $iniGetWrapper; |
|
40 | + /** @var string[] Current temporary files and folders, used for cleanup */ |
|
41 | + protected $current = []; |
|
42 | + /** @var string i.e. /tmp on linux systems */ |
|
43 | + protected $tmpBaseDir; |
|
44 | + /** @var LoggerInterface */ |
|
45 | + protected $log; |
|
46 | + /** @var IConfig */ |
|
47 | + protected $config; |
|
48 | + /** @var IniGetWrapper */ |
|
49 | + protected $iniGetWrapper; |
|
50 | 50 | |
51 | - /** Prefix */ |
|
52 | - public const TMP_PREFIX = 'oc_tmp_'; |
|
51 | + /** Prefix */ |
|
52 | + public const TMP_PREFIX = 'oc_tmp_'; |
|
53 | 53 | |
54 | - public function __construct(LoggerInterface $logger, IConfig $config, IniGetWrapper $iniGetWrapper) { |
|
55 | - $this->log = $logger; |
|
56 | - $this->config = $config; |
|
57 | - $this->iniGetWrapper = $iniGetWrapper; |
|
58 | - $this->tmpBaseDir = $this->getTempBaseDir(); |
|
59 | - } |
|
54 | + public function __construct(LoggerInterface $logger, IConfig $config, IniGetWrapper $iniGetWrapper) { |
|
55 | + $this->log = $logger; |
|
56 | + $this->config = $config; |
|
57 | + $this->iniGetWrapper = $iniGetWrapper; |
|
58 | + $this->tmpBaseDir = $this->getTempBaseDir(); |
|
59 | + } |
|
60 | 60 | |
61 | - /** |
|
62 | - * Builds the filename with suffix and removes potential dangerous characters |
|
63 | - * such as directory separators. |
|
64 | - * |
|
65 | - * @param string $absolutePath Absolute path to the file / folder |
|
66 | - * @param string $postFix Postfix appended to the temporary file name, may be user controlled |
|
67 | - * @return string |
|
68 | - */ |
|
69 | - private function buildFileNameWithSuffix($absolutePath, $postFix = '') { |
|
70 | - if ($postFix !== '') { |
|
71 | - $postFix = '.' . ltrim($postFix, '.'); |
|
72 | - $postFix = str_replace(['\\', '/'], '', $postFix); |
|
73 | - $absolutePath .= '-'; |
|
74 | - } |
|
61 | + /** |
|
62 | + * Builds the filename with suffix and removes potential dangerous characters |
|
63 | + * such as directory separators. |
|
64 | + * |
|
65 | + * @param string $absolutePath Absolute path to the file / folder |
|
66 | + * @param string $postFix Postfix appended to the temporary file name, may be user controlled |
|
67 | + * @return string |
|
68 | + */ |
|
69 | + private function buildFileNameWithSuffix($absolutePath, $postFix = '') { |
|
70 | + if ($postFix !== '') { |
|
71 | + $postFix = '.' . ltrim($postFix, '.'); |
|
72 | + $postFix = str_replace(['\\', '/'], '', $postFix); |
|
73 | + $absolutePath .= '-'; |
|
74 | + } |
|
75 | 75 | |
76 | - return $absolutePath . $postFix; |
|
77 | - } |
|
76 | + return $absolutePath . $postFix; |
|
77 | + } |
|
78 | 78 | |
79 | - /** |
|
80 | - * Create a temporary file and return the path |
|
81 | - * |
|
82 | - * @param string $postFix Postfix appended to the temporary file name |
|
83 | - * @return string |
|
84 | - */ |
|
85 | - public function getTemporaryFile($postFix = '') { |
|
86 | - if (is_writable($this->tmpBaseDir)) { |
|
87 | - // To create an unique file and prevent the risk of race conditions |
|
88 | - // or duplicated temporary files by other means such as collisions |
|
89 | - // we need to create the file using `tempnam` and append a possible |
|
90 | - // postfix to it later |
|
91 | - $file = tempnam($this->tmpBaseDir, self::TMP_PREFIX); |
|
92 | - $this->current[] = $file; |
|
79 | + /** |
|
80 | + * Create a temporary file and return the path |
|
81 | + * |
|
82 | + * @param string $postFix Postfix appended to the temporary file name |
|
83 | + * @return string |
|
84 | + */ |
|
85 | + public function getTemporaryFile($postFix = '') { |
|
86 | + if (is_writable($this->tmpBaseDir)) { |
|
87 | + // To create an unique file and prevent the risk of race conditions |
|
88 | + // or duplicated temporary files by other means such as collisions |
|
89 | + // we need to create the file using `tempnam` and append a possible |
|
90 | + // postfix to it later |
|
91 | + $file = tempnam($this->tmpBaseDir, self::TMP_PREFIX); |
|
92 | + $this->current[] = $file; |
|
93 | 93 | |
94 | - // If a postfix got specified sanitize it and create a postfixed |
|
95 | - // temporary file |
|
96 | - if ($postFix !== '') { |
|
97 | - $fileNameWithPostfix = $this->buildFileNameWithSuffix($file, $postFix); |
|
98 | - touch($fileNameWithPostfix); |
|
99 | - chmod($fileNameWithPostfix, 0600); |
|
100 | - $this->current[] = $fileNameWithPostfix; |
|
101 | - return $fileNameWithPostfix; |
|
102 | - } |
|
94 | + // If a postfix got specified sanitize it and create a postfixed |
|
95 | + // temporary file |
|
96 | + if ($postFix !== '') { |
|
97 | + $fileNameWithPostfix = $this->buildFileNameWithSuffix($file, $postFix); |
|
98 | + touch($fileNameWithPostfix); |
|
99 | + chmod($fileNameWithPostfix, 0600); |
|
100 | + $this->current[] = $fileNameWithPostfix; |
|
101 | + return $fileNameWithPostfix; |
|
102 | + } |
|
103 | 103 | |
104 | - return $file; |
|
105 | - } else { |
|
106 | - $this->log->warning( |
|
107 | - 'Can not create a temporary file in directory {dir}. Check it exists and has correct permissions', |
|
108 | - [ |
|
109 | - 'dir' => $this->tmpBaseDir, |
|
110 | - ] |
|
111 | - ); |
|
112 | - return false; |
|
113 | - } |
|
114 | - } |
|
104 | + return $file; |
|
105 | + } else { |
|
106 | + $this->log->warning( |
|
107 | + 'Can not create a temporary file in directory {dir}. Check it exists and has correct permissions', |
|
108 | + [ |
|
109 | + 'dir' => $this->tmpBaseDir, |
|
110 | + ] |
|
111 | + ); |
|
112 | + return false; |
|
113 | + } |
|
114 | + } |
|
115 | 115 | |
116 | - /** |
|
117 | - * Create a temporary folder and return the path |
|
118 | - * |
|
119 | - * @param string $postFix Postfix appended to the temporary folder name |
|
120 | - * @return string |
|
121 | - */ |
|
122 | - public function getTemporaryFolder($postFix = '') { |
|
123 | - if (is_writable($this->tmpBaseDir)) { |
|
124 | - // To create an unique directory and prevent the risk of race conditions |
|
125 | - // or duplicated temporary files by other means such as collisions |
|
126 | - // we need to create the file using `tempnam` and append a possible |
|
127 | - // postfix to it later |
|
128 | - $uniqueFileName = tempnam($this->tmpBaseDir, self::TMP_PREFIX); |
|
129 | - $this->current[] = $uniqueFileName; |
|
116 | + /** |
|
117 | + * Create a temporary folder and return the path |
|
118 | + * |
|
119 | + * @param string $postFix Postfix appended to the temporary folder name |
|
120 | + * @return string |
|
121 | + */ |
|
122 | + public function getTemporaryFolder($postFix = '') { |
|
123 | + if (is_writable($this->tmpBaseDir)) { |
|
124 | + // To create an unique directory and prevent the risk of race conditions |
|
125 | + // or duplicated temporary files by other means such as collisions |
|
126 | + // we need to create the file using `tempnam` and append a possible |
|
127 | + // postfix to it later |
|
128 | + $uniqueFileName = tempnam($this->tmpBaseDir, self::TMP_PREFIX); |
|
129 | + $this->current[] = $uniqueFileName; |
|
130 | 130 | |
131 | - // Build a name without postfix |
|
132 | - $path = $this->buildFileNameWithSuffix($uniqueFileName . '-folder', $postFix); |
|
133 | - mkdir($path, 0700); |
|
134 | - $this->current[] = $path; |
|
131 | + // Build a name without postfix |
|
132 | + $path = $this->buildFileNameWithSuffix($uniqueFileName . '-folder', $postFix); |
|
133 | + mkdir($path, 0700); |
|
134 | + $this->current[] = $path; |
|
135 | 135 | |
136 | - return $path . '/'; |
|
137 | - } else { |
|
138 | - $this->log->warning( |
|
139 | - 'Can not create a temporary folder in directory {dir}. Check it exists and has correct permissions', |
|
140 | - [ |
|
141 | - 'dir' => $this->tmpBaseDir, |
|
142 | - ] |
|
143 | - ); |
|
144 | - return false; |
|
145 | - } |
|
146 | - } |
|
136 | + return $path . '/'; |
|
137 | + } else { |
|
138 | + $this->log->warning( |
|
139 | + 'Can not create a temporary folder in directory {dir}. Check it exists and has correct permissions', |
|
140 | + [ |
|
141 | + 'dir' => $this->tmpBaseDir, |
|
142 | + ] |
|
143 | + ); |
|
144 | + return false; |
|
145 | + } |
|
146 | + } |
|
147 | 147 | |
148 | - /** |
|
149 | - * Remove the temporary files and folders generated during this request |
|
150 | - */ |
|
151 | - public function clean() { |
|
152 | - $this->cleanFiles($this->current); |
|
153 | - } |
|
148 | + /** |
|
149 | + * Remove the temporary files and folders generated during this request |
|
150 | + */ |
|
151 | + public function clean() { |
|
152 | + $this->cleanFiles($this->current); |
|
153 | + } |
|
154 | 154 | |
155 | - /** |
|
156 | - * @param string[] $files |
|
157 | - */ |
|
158 | - protected function cleanFiles($files) { |
|
159 | - foreach ($files as $file) { |
|
160 | - if (file_exists($file)) { |
|
161 | - try { |
|
162 | - \OC_Helper::rmdirr($file); |
|
163 | - } catch (\UnexpectedValueException $ex) { |
|
164 | - $this->log->warning( |
|
165 | - "Error deleting temporary file/folder: {file} - Reason: {error}", |
|
166 | - [ |
|
167 | - 'file' => $file, |
|
168 | - 'error' => $ex->getMessage(), |
|
169 | - ] |
|
170 | - ); |
|
171 | - } |
|
172 | - } |
|
173 | - } |
|
174 | - } |
|
155 | + /** |
|
156 | + * @param string[] $files |
|
157 | + */ |
|
158 | + protected function cleanFiles($files) { |
|
159 | + foreach ($files as $file) { |
|
160 | + if (file_exists($file)) { |
|
161 | + try { |
|
162 | + \OC_Helper::rmdirr($file); |
|
163 | + } catch (\UnexpectedValueException $ex) { |
|
164 | + $this->log->warning( |
|
165 | + "Error deleting temporary file/folder: {file} - Reason: {error}", |
|
166 | + [ |
|
167 | + 'file' => $file, |
|
168 | + 'error' => $ex->getMessage(), |
|
169 | + ] |
|
170 | + ); |
|
171 | + } |
|
172 | + } |
|
173 | + } |
|
174 | + } |
|
175 | 175 | |
176 | - /** |
|
177 | - * Remove old temporary files and folders that were failed to be cleaned |
|
178 | - */ |
|
179 | - public function cleanOld() { |
|
180 | - $this->cleanFiles($this->getOldFiles()); |
|
181 | - } |
|
176 | + /** |
|
177 | + * Remove old temporary files and folders that were failed to be cleaned |
|
178 | + */ |
|
179 | + public function cleanOld() { |
|
180 | + $this->cleanFiles($this->getOldFiles()); |
|
181 | + } |
|
182 | 182 | |
183 | - /** |
|
184 | - * Get all temporary files and folders generated by oc older than an hour |
|
185 | - * |
|
186 | - * @return string[] |
|
187 | - */ |
|
188 | - protected function getOldFiles() { |
|
189 | - $cutOfTime = time() - 3600; |
|
190 | - $files = []; |
|
191 | - $dh = opendir($this->tmpBaseDir); |
|
192 | - if ($dh) { |
|
193 | - while (($file = readdir($dh)) !== false) { |
|
194 | - if (substr($file, 0, 7) === self::TMP_PREFIX) { |
|
195 | - $path = $this->tmpBaseDir . '/' . $file; |
|
196 | - $mtime = filemtime($path); |
|
197 | - if ($mtime < $cutOfTime) { |
|
198 | - $files[] = $path; |
|
199 | - } |
|
200 | - } |
|
201 | - } |
|
202 | - } |
|
203 | - return $files; |
|
204 | - } |
|
183 | + /** |
|
184 | + * Get all temporary files and folders generated by oc older than an hour |
|
185 | + * |
|
186 | + * @return string[] |
|
187 | + */ |
|
188 | + protected function getOldFiles() { |
|
189 | + $cutOfTime = time() - 3600; |
|
190 | + $files = []; |
|
191 | + $dh = opendir($this->tmpBaseDir); |
|
192 | + if ($dh) { |
|
193 | + while (($file = readdir($dh)) !== false) { |
|
194 | + if (substr($file, 0, 7) === self::TMP_PREFIX) { |
|
195 | + $path = $this->tmpBaseDir . '/' . $file; |
|
196 | + $mtime = filemtime($path); |
|
197 | + if ($mtime < $cutOfTime) { |
|
198 | + $files[] = $path; |
|
199 | + } |
|
200 | + } |
|
201 | + } |
|
202 | + } |
|
203 | + return $files; |
|
204 | + } |
|
205 | 205 | |
206 | - /** |
|
207 | - * Get the temporary base directory configured on the server |
|
208 | - * |
|
209 | - * @return string Path to the temporary directory or null |
|
210 | - * @throws \UnexpectedValueException |
|
211 | - */ |
|
212 | - public function getTempBaseDir() { |
|
213 | - if ($this->tmpBaseDir) { |
|
214 | - return $this->tmpBaseDir; |
|
215 | - } |
|
206 | + /** |
|
207 | + * Get the temporary base directory configured on the server |
|
208 | + * |
|
209 | + * @return string Path to the temporary directory or null |
|
210 | + * @throws \UnexpectedValueException |
|
211 | + */ |
|
212 | + public function getTempBaseDir() { |
|
213 | + if ($this->tmpBaseDir) { |
|
214 | + return $this->tmpBaseDir; |
|
215 | + } |
|
216 | 216 | |
217 | - $directories = []; |
|
218 | - if ($temp = $this->config->getSystemValue('tempdirectory', null)) { |
|
219 | - $directories[] = $temp; |
|
220 | - } |
|
221 | - if ($temp = $this->iniGetWrapper->get('upload_tmp_dir')) { |
|
222 | - $directories[] = $temp; |
|
223 | - } |
|
224 | - if ($temp = getenv('TMP')) { |
|
225 | - $directories[] = $temp; |
|
226 | - } |
|
227 | - if ($temp = getenv('TEMP')) { |
|
228 | - $directories[] = $temp; |
|
229 | - } |
|
230 | - if ($temp = getenv('TMPDIR')) { |
|
231 | - $directories[] = $temp; |
|
232 | - } |
|
233 | - if ($temp = sys_get_temp_dir()) { |
|
234 | - $directories[] = $temp; |
|
235 | - } |
|
217 | + $directories = []; |
|
218 | + if ($temp = $this->config->getSystemValue('tempdirectory', null)) { |
|
219 | + $directories[] = $temp; |
|
220 | + } |
|
221 | + if ($temp = $this->iniGetWrapper->get('upload_tmp_dir')) { |
|
222 | + $directories[] = $temp; |
|
223 | + } |
|
224 | + if ($temp = getenv('TMP')) { |
|
225 | + $directories[] = $temp; |
|
226 | + } |
|
227 | + if ($temp = getenv('TEMP')) { |
|
228 | + $directories[] = $temp; |
|
229 | + } |
|
230 | + if ($temp = getenv('TMPDIR')) { |
|
231 | + $directories[] = $temp; |
|
232 | + } |
|
233 | + if ($temp = sys_get_temp_dir()) { |
|
234 | + $directories[] = $temp; |
|
235 | + } |
|
236 | 236 | |
237 | - foreach ($directories as $dir) { |
|
238 | - if ($this->checkTemporaryDirectory($dir)) { |
|
239 | - return $dir; |
|
240 | - } |
|
241 | - } |
|
237 | + foreach ($directories as $dir) { |
|
238 | + if ($this->checkTemporaryDirectory($dir)) { |
|
239 | + return $dir; |
|
240 | + } |
|
241 | + } |
|
242 | 242 | |
243 | - $temp = tempnam(dirname(__FILE__), ''); |
|
244 | - if (file_exists($temp)) { |
|
245 | - unlink($temp); |
|
246 | - return dirname($temp); |
|
247 | - } |
|
248 | - throw new \UnexpectedValueException('Unable to detect system temporary directory'); |
|
249 | - } |
|
243 | + $temp = tempnam(dirname(__FILE__), ''); |
|
244 | + if (file_exists($temp)) { |
|
245 | + unlink($temp); |
|
246 | + return dirname($temp); |
|
247 | + } |
|
248 | + throw new \UnexpectedValueException('Unable to detect system temporary directory'); |
|
249 | + } |
|
250 | 250 | |
251 | - /** |
|
252 | - * Check if a temporary directory is ready for use |
|
253 | - * |
|
254 | - * @param mixed $directory |
|
255 | - * @return bool |
|
256 | - */ |
|
257 | - private function checkTemporaryDirectory($directory) { |
|
258 | - // suppress any possible errors caused by is_writable |
|
259 | - // checks missing or invalid path or characters, wrong permissions etc |
|
260 | - try { |
|
261 | - if (is_writable($directory)) { |
|
262 | - return true; |
|
263 | - } |
|
264 | - } catch (\Exception $e) { |
|
265 | - } |
|
266 | - $this->log->warning('Temporary directory {dir} is not present or writable', |
|
267 | - ['dir' => $directory] |
|
268 | - ); |
|
269 | - return false; |
|
270 | - } |
|
251 | + /** |
|
252 | + * Check if a temporary directory is ready for use |
|
253 | + * |
|
254 | + * @param mixed $directory |
|
255 | + * @return bool |
|
256 | + */ |
|
257 | + private function checkTemporaryDirectory($directory) { |
|
258 | + // suppress any possible errors caused by is_writable |
|
259 | + // checks missing or invalid path or characters, wrong permissions etc |
|
260 | + try { |
|
261 | + if (is_writable($directory)) { |
|
262 | + return true; |
|
263 | + } |
|
264 | + } catch (\Exception $e) { |
|
265 | + } |
|
266 | + $this->log->warning('Temporary directory {dir} is not present or writable', |
|
267 | + ['dir' => $directory] |
|
268 | + ); |
|
269 | + return false; |
|
270 | + } |
|
271 | 271 | |
272 | - /** |
|
273 | - * Override the temporary base directory |
|
274 | - * |
|
275 | - * @param string $directory |
|
276 | - */ |
|
277 | - public function overrideTempBaseDir($directory) { |
|
278 | - $this->tmpBaseDir = $directory; |
|
279 | - } |
|
272 | + /** |
|
273 | + * Override the temporary base directory |
|
274 | + * |
|
275 | + * @param string $directory |
|
276 | + */ |
|
277 | + public function overrideTempBaseDir($directory) { |
|
278 | + $this->tmpBaseDir = $directory; |
|
279 | + } |
|
280 | 280 | } |
@@ -36,56 +36,56 @@ |
||
36 | 36 | * @since 18.0.0 |
37 | 37 | */ |
38 | 38 | interface IRuleMatcher extends IFileCheck { |
39 | - /** |
|
40 | - * This method is left for backwards compatibility and easier porting of |
|
41 | - * apps. Please use 'getFlows' instead (and setOperation if you implement |
|
42 | - * an IComplexOperation). |
|
43 | - * |
|
44 | - * @since 18.0.0 |
|
45 | - * @deprecated 18.0.0 |
|
46 | - */ |
|
47 | - public function getMatchingOperations(string $class, bool $returnFirstMatchingOperationOnly = true): array; |
|
39 | + /** |
|
40 | + * This method is left for backwards compatibility and easier porting of |
|
41 | + * apps. Please use 'getFlows' instead (and setOperation if you implement |
|
42 | + * an IComplexOperation). |
|
43 | + * |
|
44 | + * @since 18.0.0 |
|
45 | + * @deprecated 18.0.0 |
|
46 | + */ |
|
47 | + public function getMatchingOperations(string $class, bool $returnFirstMatchingOperationOnly = true): array; |
|
48 | 48 | |
49 | - /** |
|
50 | - * @throws RuntimeException |
|
51 | - * @since 18.0.0 |
|
52 | - */ |
|
53 | - public function getFlows(bool $returnFirstMatchingOperationOnly = true): array; |
|
49 | + /** |
|
50 | + * @throws RuntimeException |
|
51 | + * @since 18.0.0 |
|
52 | + */ |
|
53 | + public function getFlows(bool $returnFirstMatchingOperationOnly = true): array; |
|
54 | 54 | |
55 | - /** |
|
56 | - * this method can only be called once and is typically called by the |
|
57 | - * Flow engine, unless for IComplexOperations. |
|
58 | - * |
|
59 | - * @throws RuntimeException |
|
60 | - * @since 18.0.0 |
|
61 | - */ |
|
62 | - public function setOperation(IOperation $operation): void; |
|
55 | + /** |
|
56 | + * this method can only be called once and is typically called by the |
|
57 | + * Flow engine, unless for IComplexOperations. |
|
58 | + * |
|
59 | + * @throws RuntimeException |
|
60 | + * @since 18.0.0 |
|
61 | + */ |
|
62 | + public function setOperation(IOperation $operation): void; |
|
63 | 63 | |
64 | - /** |
|
65 | - * this method can only be called once and is typically called by the |
|
66 | - * Flow engine, unless for IComplexOperations. |
|
67 | - * |
|
68 | - * @throws RuntimeException |
|
69 | - * @since 18.0.0 |
|
70 | - */ |
|
71 | - public function setEntity(IEntity $entity): void; |
|
64 | + /** |
|
65 | + * this method can only be called once and is typically called by the |
|
66 | + * Flow engine, unless for IComplexOperations. |
|
67 | + * |
|
68 | + * @throws RuntimeException |
|
69 | + * @since 18.0.0 |
|
70 | + */ |
|
71 | + public function setEntity(IEntity $entity): void; |
|
72 | 72 | |
73 | - /** |
|
74 | - * returns the entity which might provide more information, depending on |
|
75 | - * the interfaces it implements |
|
76 | - * |
|
77 | - * @return IEntity |
|
78 | - * @since 18.0.0 |
|
79 | - */ |
|
80 | - public function getEntity(): IEntity; |
|
73 | + /** |
|
74 | + * returns the entity which might provide more information, depending on |
|
75 | + * the interfaces it implements |
|
76 | + * |
|
77 | + * @return IEntity |
|
78 | + * @since 18.0.0 |
|
79 | + */ |
|
80 | + public function getEntity(): IEntity; |
|
81 | 81 | |
82 | - /** |
|
83 | - * this method can be called once to set the event name that is currently |
|
84 | - * being processed. The workflow engine takes care of this usually, only an |
|
85 | - * IComplexOperation might want to make use of it. |
|
86 | - * |
|
87 | - * @throws RuntimeException |
|
88 | - * @since 20.0.0 |
|
89 | - */ |
|
90 | - public function setEventName(string $eventName): void; |
|
82 | + /** |
|
83 | + * this method can be called once to set the event name that is currently |
|
84 | + * being processed. The workflow engine takes care of this usually, only an |
|
85 | + * IComplexOperation might want to make use of it. |
|
86 | + * |
|
87 | + * @throws RuntimeException |
|
88 | + * @since 20.0.0 |
|
89 | + */ |
|
90 | + public function setEventName(string $eventName): void; |
|
91 | 91 | } |
@@ -43,86 +43,86 @@ |
||
43 | 43 | use OCP\WorkflowEngine\IOperationCompat; |
44 | 44 | |
45 | 45 | class Application extends App implements IBootstrap { |
46 | - public const APP_ID = 'workflowengine'; |
|
46 | + public const APP_ID = 'workflowengine'; |
|
47 | 47 | |
48 | - public function __construct() { |
|
49 | - parent::__construct(self::APP_ID); |
|
50 | - } |
|
48 | + public function __construct() { |
|
49 | + parent::__construct(self::APP_ID); |
|
50 | + } |
|
51 | 51 | |
52 | - public function register(IRegistrationContext $context): void { |
|
53 | - $context->registerServiceAlias('RequestTimeController', RequestTime::class); |
|
54 | - $context->registerEventListener( |
|
55 | - LoadSettingsScriptsEvent::class, |
|
56 | - LoadAdditionalSettingsScriptsListener::class, |
|
57 | - -100 |
|
58 | - ); |
|
59 | - } |
|
52 | + public function register(IRegistrationContext $context): void { |
|
53 | + $context->registerServiceAlias('RequestTimeController', RequestTime::class); |
|
54 | + $context->registerEventListener( |
|
55 | + LoadSettingsScriptsEvent::class, |
|
56 | + LoadAdditionalSettingsScriptsListener::class, |
|
57 | + -100 |
|
58 | + ); |
|
59 | + } |
|
60 | 60 | |
61 | - public function boot(IBootContext $context): void { |
|
62 | - $context->injectFn(Closure::fromCallable([$this, 'registerRuleListeners'])); |
|
63 | - } |
|
61 | + public function boot(IBootContext $context): void { |
|
62 | + $context->injectFn(Closure::fromCallable([$this, 'registerRuleListeners'])); |
|
63 | + } |
|
64 | 64 | |
65 | - private function registerRuleListeners(IEventDispatcher $dispatcher, |
|
66 | - IServerContainer $container, |
|
67 | - ILogger $logger): void { |
|
68 | - /** @var Manager $manager */ |
|
69 | - $manager = $container->query(Manager::class); |
|
70 | - $configuredEvents = $manager->getAllConfiguredEvents(); |
|
65 | + private function registerRuleListeners(IEventDispatcher $dispatcher, |
|
66 | + IServerContainer $container, |
|
67 | + ILogger $logger): void { |
|
68 | + /** @var Manager $manager */ |
|
69 | + $manager = $container->query(Manager::class); |
|
70 | + $configuredEvents = $manager->getAllConfiguredEvents(); |
|
71 | 71 | |
72 | - foreach ($configuredEvents as $operationClass => $events) { |
|
73 | - foreach ($events as $entityClass => $eventNames) { |
|
74 | - array_map(function (string $eventName) use ($manager, $container, $dispatcher, $logger, $operationClass, $entityClass) { |
|
75 | - $dispatcher->addListener( |
|
76 | - $eventName, |
|
77 | - function ($event) use ($manager, $container, $eventName, $logger, $operationClass, $entityClass) { |
|
78 | - $ruleMatcher = $manager->getRuleMatcher(); |
|
79 | - try { |
|
80 | - /** @var IEntity $entity */ |
|
81 | - $entity = $container->query($entityClass); |
|
82 | - /** @var IOperation $operation */ |
|
83 | - $operation = $container->query($operationClass); |
|
72 | + foreach ($configuredEvents as $operationClass => $events) { |
|
73 | + foreach ($events as $entityClass => $eventNames) { |
|
74 | + array_map(function (string $eventName) use ($manager, $container, $dispatcher, $logger, $operationClass, $entityClass) { |
|
75 | + $dispatcher->addListener( |
|
76 | + $eventName, |
|
77 | + function ($event) use ($manager, $container, $eventName, $logger, $operationClass, $entityClass) { |
|
78 | + $ruleMatcher = $manager->getRuleMatcher(); |
|
79 | + try { |
|
80 | + /** @var IEntity $entity */ |
|
81 | + $entity = $container->query($entityClass); |
|
82 | + /** @var IOperation $operation */ |
|
83 | + $operation = $container->query($operationClass); |
|
84 | 84 | |
85 | - $ruleMatcher->setEventName($eventName); |
|
86 | - $ruleMatcher->setEntity($entity); |
|
87 | - $ruleMatcher->setOperation($operation); |
|
85 | + $ruleMatcher->setEventName($eventName); |
|
86 | + $ruleMatcher->setEntity($entity); |
|
87 | + $ruleMatcher->setOperation($operation); |
|
88 | 88 | |
89 | - $ctx = new LogContext(); |
|
90 | - $ctx |
|
91 | - ->setOperation($operation) |
|
92 | - ->setEntity($entity) |
|
93 | - ->setEventName($eventName); |
|
89 | + $ctx = new LogContext(); |
|
90 | + $ctx |
|
91 | + ->setOperation($operation) |
|
92 | + ->setEntity($entity) |
|
93 | + ->setEventName($eventName); |
|
94 | 94 | |
95 | - /** @var Logger $flowLogger */ |
|
96 | - $flowLogger = $container->query(Logger::class); |
|
97 | - $flowLogger->logEventInit($ctx); |
|
95 | + /** @var Logger $flowLogger */ |
|
96 | + $flowLogger = $container->query(Logger::class); |
|
97 | + $flowLogger->logEventInit($ctx); |
|
98 | 98 | |
99 | - if ($event instanceof Event) { |
|
100 | - $entity->prepareRuleMatcher($ruleMatcher, $eventName, $event); |
|
101 | - $operation->onEvent($eventName, $event, $ruleMatcher); |
|
102 | - } elseif ($entity instanceof IEntityCompat && $operation instanceof IOperationCompat) { |
|
103 | - // TODO: Remove this block (and the compat classes) in the first major release in 2023 |
|
104 | - $entity->prepareRuleMatcherCompat($ruleMatcher, $eventName, $event); |
|
105 | - $operation->onEventCompat($eventName, $event, $ruleMatcher); |
|
106 | - } else { |
|
107 | - $logger->debug( |
|
108 | - 'Cannot handle event {name} of {event} against entity {entity} and operation {operation}', |
|
109 | - [ |
|
110 | - 'app' => self::APP_ID, |
|
111 | - 'name' => $eventName, |
|
112 | - 'event' => get_class($event), |
|
113 | - 'entity' => $entityClass, |
|
114 | - 'operation' => $operationClass, |
|
115 | - ] |
|
116 | - ); |
|
117 | - } |
|
118 | - $flowLogger->logEventDone($ctx); |
|
119 | - } catch (QueryException $e) { |
|
120 | - // Ignore query exceptions since they might occur when an entity/operation were setup before by an app that is disabled now |
|
121 | - } |
|
122 | - } |
|
123 | - ); |
|
124 | - }, $eventNames ?? []); |
|
125 | - } |
|
126 | - } |
|
127 | - } |
|
99 | + if ($event instanceof Event) { |
|
100 | + $entity->prepareRuleMatcher($ruleMatcher, $eventName, $event); |
|
101 | + $operation->onEvent($eventName, $event, $ruleMatcher); |
|
102 | + } elseif ($entity instanceof IEntityCompat && $operation instanceof IOperationCompat) { |
|
103 | + // TODO: Remove this block (and the compat classes) in the first major release in 2023 |
|
104 | + $entity->prepareRuleMatcherCompat($ruleMatcher, $eventName, $event); |
|
105 | + $operation->onEventCompat($eventName, $event, $ruleMatcher); |
|
106 | + } else { |
|
107 | + $logger->debug( |
|
108 | + 'Cannot handle event {name} of {event} against entity {entity} and operation {operation}', |
|
109 | + [ |
|
110 | + 'app' => self::APP_ID, |
|
111 | + 'name' => $eventName, |
|
112 | + 'event' => get_class($event), |
|
113 | + 'entity' => $entityClass, |
|
114 | + 'operation' => $operationClass, |
|
115 | + ] |
|
116 | + ); |
|
117 | + } |
|
118 | + $flowLogger->logEventDone($ctx); |
|
119 | + } catch (QueryException $e) { |
|
120 | + // Ignore query exceptions since they might occur when an entity/operation were setup before by an app that is disabled now |
|
121 | + } |
|
122 | + } |
|
123 | + ); |
|
124 | + }, $eventNames ?? []); |
|
125 | + } |
|
126 | + } |
|
127 | + } |
|
128 | 128 | } |
@@ -24,61 +24,61 @@ |
||
24 | 24 | namespace OCA\DAV\CalDAV\Activity\Setting; |
25 | 25 | |
26 | 26 | class Calendar extends CalDAVSetting { |
27 | - /** |
|
28 | - * @return string Lowercase a-z and underscore only identifier |
|
29 | - * @since 11.0.0 |
|
30 | - */ |
|
31 | - public function getIdentifier() { |
|
32 | - return 'calendar'; |
|
33 | - } |
|
27 | + /** |
|
28 | + * @return string Lowercase a-z and underscore only identifier |
|
29 | + * @since 11.0.0 |
|
30 | + */ |
|
31 | + public function getIdentifier() { |
|
32 | + return 'calendar'; |
|
33 | + } |
|
34 | 34 | |
35 | - /** |
|
36 | - * @return string A translated string |
|
37 | - * @since 11.0.0 |
|
38 | - */ |
|
39 | - public function getName() { |
|
40 | - return $this->l->t('A <strong>calendar</strong> was modified'); |
|
41 | - } |
|
35 | + /** |
|
36 | + * @return string A translated string |
|
37 | + * @since 11.0.0 |
|
38 | + */ |
|
39 | + public function getName() { |
|
40 | + return $this->l->t('A <strong>calendar</strong> was modified'); |
|
41 | + } |
|
42 | 42 | |
43 | - /** |
|
44 | - * @return int whether the filter should be rather on the top or bottom of |
|
45 | - * the admin section. The filters are arranged in ascending order of the |
|
46 | - * priority values. It is required to return a value between 0 and 100. |
|
47 | - * @since 11.0.0 |
|
48 | - */ |
|
49 | - public function getPriority() { |
|
50 | - return 50; |
|
51 | - } |
|
43 | + /** |
|
44 | + * @return int whether the filter should be rather on the top or bottom of |
|
45 | + * the admin section. The filters are arranged in ascending order of the |
|
46 | + * priority values. It is required to return a value between 0 and 100. |
|
47 | + * @since 11.0.0 |
|
48 | + */ |
|
49 | + public function getPriority() { |
|
50 | + return 50; |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * @return bool True when the option can be changed for the stream |
|
55 | - * @since 11.0.0 |
|
56 | - */ |
|
57 | - public function canChangeStream() { |
|
58 | - return true; |
|
59 | - } |
|
53 | + /** |
|
54 | + * @return bool True when the option can be changed for the stream |
|
55 | + * @since 11.0.0 |
|
56 | + */ |
|
57 | + public function canChangeStream() { |
|
58 | + return true; |
|
59 | + } |
|
60 | 60 | |
61 | - /** |
|
62 | - * @return bool True when the option can be changed for the stream |
|
63 | - * @since 11.0.0 |
|
64 | - */ |
|
65 | - public function isDefaultEnabledStream() { |
|
66 | - return true; |
|
67 | - } |
|
61 | + /** |
|
62 | + * @return bool True when the option can be changed for the stream |
|
63 | + * @since 11.0.0 |
|
64 | + */ |
|
65 | + public function isDefaultEnabledStream() { |
|
66 | + return true; |
|
67 | + } |
|
68 | 68 | |
69 | - /** |
|
70 | - * @return bool True when the option can be changed for the mail |
|
71 | - * @since 11.0.0 |
|
72 | - */ |
|
73 | - public function canChangeMail() { |
|
74 | - return true; |
|
75 | - } |
|
69 | + /** |
|
70 | + * @return bool True when the option can be changed for the mail |
|
71 | + * @since 11.0.0 |
|
72 | + */ |
|
73 | + public function canChangeMail() { |
|
74 | + return true; |
|
75 | + } |
|
76 | 76 | |
77 | - /** |
|
78 | - * @return bool True when the option can be changed for the stream |
|
79 | - * @since 11.0.0 |
|
80 | - */ |
|
81 | - public function isDefaultEnabledMail() { |
|
82 | - return false; |
|
83 | - } |
|
77 | + /** |
|
78 | + * @return bool True when the option can be changed for the stream |
|
79 | + * @since 11.0.0 |
|
80 | + */ |
|
81 | + public function isDefaultEnabledMail() { |
|
82 | + return false; |
|
83 | + } |
|
84 | 84 | } |
@@ -24,61 +24,61 @@ |
||
24 | 24 | namespace OCA\DAV\CalDAV\Activity\Setting; |
25 | 25 | |
26 | 26 | class Event extends CalDAVSetting { |
27 | - /** |
|
28 | - * @return string Lowercase a-z and underscore only identifier |
|
29 | - * @since 11.0.0 |
|
30 | - */ |
|
31 | - public function getIdentifier() { |
|
32 | - return 'calendar_event'; |
|
33 | - } |
|
27 | + /** |
|
28 | + * @return string Lowercase a-z and underscore only identifier |
|
29 | + * @since 11.0.0 |
|
30 | + */ |
|
31 | + public function getIdentifier() { |
|
32 | + return 'calendar_event'; |
|
33 | + } |
|
34 | 34 | |
35 | - /** |
|
36 | - * @return string A translated string |
|
37 | - * @since 11.0.0 |
|
38 | - */ |
|
39 | - public function getName() { |
|
40 | - return $this->l->t('A calendar <strong>event</strong> was modified'); |
|
41 | - } |
|
35 | + /** |
|
36 | + * @return string A translated string |
|
37 | + * @since 11.0.0 |
|
38 | + */ |
|
39 | + public function getName() { |
|
40 | + return $this->l->t('A calendar <strong>event</strong> was modified'); |
|
41 | + } |
|
42 | 42 | |
43 | - /** |
|
44 | - * @return int whether the filter should be rather on the top or bottom of |
|
45 | - * the admin section. The filters are arranged in ascending order of the |
|
46 | - * priority values. It is required to return a value between 0 and 100. |
|
47 | - * @since 11.0.0 |
|
48 | - */ |
|
49 | - public function getPriority() { |
|
50 | - return 50; |
|
51 | - } |
|
43 | + /** |
|
44 | + * @return int whether the filter should be rather on the top or bottom of |
|
45 | + * the admin section. The filters are arranged in ascending order of the |
|
46 | + * priority values. It is required to return a value between 0 and 100. |
|
47 | + * @since 11.0.0 |
|
48 | + */ |
|
49 | + public function getPriority() { |
|
50 | + return 50; |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * @return bool True when the option can be changed for the stream |
|
55 | - * @since 11.0.0 |
|
56 | - */ |
|
57 | - public function canChangeStream() { |
|
58 | - return true; |
|
59 | - } |
|
53 | + /** |
|
54 | + * @return bool True when the option can be changed for the stream |
|
55 | + * @since 11.0.0 |
|
56 | + */ |
|
57 | + public function canChangeStream() { |
|
58 | + return true; |
|
59 | + } |
|
60 | 60 | |
61 | - /** |
|
62 | - * @return bool True when the option can be changed for the stream |
|
63 | - * @since 11.0.0 |
|
64 | - */ |
|
65 | - public function isDefaultEnabledStream() { |
|
66 | - return true; |
|
67 | - } |
|
61 | + /** |
|
62 | + * @return bool True when the option can be changed for the stream |
|
63 | + * @since 11.0.0 |
|
64 | + */ |
|
65 | + public function isDefaultEnabledStream() { |
|
66 | + return true; |
|
67 | + } |
|
68 | 68 | |
69 | - /** |
|
70 | - * @return bool True when the option can be changed for the mail |
|
71 | - * @since 11.0.0 |
|
72 | - */ |
|
73 | - public function canChangeMail() { |
|
74 | - return true; |
|
75 | - } |
|
69 | + /** |
|
70 | + * @return bool True when the option can be changed for the mail |
|
71 | + * @since 11.0.0 |
|
72 | + */ |
|
73 | + public function canChangeMail() { |
|
74 | + return true; |
|
75 | + } |
|
76 | 76 | |
77 | - /** |
|
78 | - * @return bool True when the option can be changed for the stream |
|
79 | - * @since 11.0.0 |
|
80 | - */ |
|
81 | - public function isDefaultEnabledMail() { |
|
82 | - return false; |
|
83 | - } |
|
77 | + /** |
|
78 | + * @return bool True when the option can be changed for the stream |
|
79 | + * @since 11.0.0 |
|
80 | + */ |
|
81 | + public function isDefaultEnabledMail() { |
|
82 | + return false; |
|
83 | + } |
|
84 | 84 | } |
@@ -39,92 +39,92 @@ |
||
39 | 39 | * |
40 | 40 | */ |
41 | 41 | interface ISearchRequestSimpleQuery { |
42 | - public const COMPARE_TYPE_TEXT = 1; |
|
43 | - public const COMPARE_TYPE_KEYWORD = 2; |
|
44 | - public const COMPARE_TYPE_INT_EQ = 3; |
|
45 | - public const COMPARE_TYPE_INT_GTE = 4; |
|
46 | - public const COMPARE_TYPE_INT_GT = 5; |
|
47 | - public const COMPARE_TYPE_INT_LTE = 6; |
|
48 | - public const COMPARE_TYPE_INT_LT = 7; |
|
49 | - public const COMPARE_TYPE_BOOL = 8; |
|
50 | - public const COMPARE_TYPE_ARRAY = 9; |
|
51 | - public const COMPARE_TYPE_REGEX = 10; |
|
52 | - public const COMPARE_TYPE_WILDCARD = 11; |
|
42 | + public const COMPARE_TYPE_TEXT = 1; |
|
43 | + public const COMPARE_TYPE_KEYWORD = 2; |
|
44 | + public const COMPARE_TYPE_INT_EQ = 3; |
|
45 | + public const COMPARE_TYPE_INT_GTE = 4; |
|
46 | + public const COMPARE_TYPE_INT_GT = 5; |
|
47 | + public const COMPARE_TYPE_INT_LTE = 6; |
|
48 | + public const COMPARE_TYPE_INT_LT = 7; |
|
49 | + public const COMPARE_TYPE_BOOL = 8; |
|
50 | + public const COMPARE_TYPE_ARRAY = 9; |
|
51 | + public const COMPARE_TYPE_REGEX = 10; |
|
52 | + public const COMPARE_TYPE_WILDCARD = 11; |
|
53 | 53 | |
54 | 54 | |
55 | - /** |
|
56 | - * Get the compare type of the query |
|
57 | - * |
|
58 | - * @return int |
|
59 | - * @since 17.0.0 |
|
60 | - */ |
|
61 | - public function getType(): int; |
|
55 | + /** |
|
56 | + * Get the compare type of the query |
|
57 | + * |
|
58 | + * @return int |
|
59 | + * @since 17.0.0 |
|
60 | + */ |
|
61 | + public function getType(): int; |
|
62 | 62 | |
63 | 63 | |
64 | - /** |
|
65 | - * Get the field to apply query |
|
66 | - * |
|
67 | - * @return string |
|
68 | - * @since 17.0.0 |
|
69 | - */ |
|
70 | - public function getField(): string; |
|
64 | + /** |
|
65 | + * Get the field to apply query |
|
66 | + * |
|
67 | + * @return string |
|
68 | + * @since 17.0.0 |
|
69 | + */ |
|
70 | + public function getField(): string; |
|
71 | 71 | |
72 | - /** |
|
73 | - * Set the field to apply query |
|
74 | - * |
|
75 | - * @param string $field |
|
76 | - * |
|
77 | - * @return ISearchRequestSimpleQuery |
|
78 | - * @since 17.0.0 |
|
79 | - */ |
|
80 | - public function setField(string $field): ISearchRequestSimpleQuery; |
|
72 | + /** |
|
73 | + * Set the field to apply query |
|
74 | + * |
|
75 | + * @param string $field |
|
76 | + * |
|
77 | + * @return ISearchRequestSimpleQuery |
|
78 | + * @since 17.0.0 |
|
79 | + */ |
|
80 | + public function setField(string $field): ISearchRequestSimpleQuery; |
|
81 | 81 | |
82 | 82 | |
83 | - /** |
|
84 | - * Get the all values to compare |
|
85 | - * |
|
86 | - * @return array |
|
87 | - * @since 17.0.0 |
|
88 | - */ |
|
89 | - public function getValues(): array; |
|
83 | + /** |
|
84 | + * Get the all values to compare |
|
85 | + * |
|
86 | + * @return array |
|
87 | + * @since 17.0.0 |
|
88 | + */ |
|
89 | + public function getValues(): array; |
|
90 | 90 | |
91 | - /** |
|
92 | - * Add value to compare (string) |
|
93 | - * |
|
94 | - * @param string $value |
|
95 | - * |
|
96 | - * @return ISearchRequestSimpleQuery |
|
97 | - * @since 17.0.0 |
|
98 | - */ |
|
99 | - public function addValue(string $value): ISearchRequestSimpleQuery; |
|
91 | + /** |
|
92 | + * Add value to compare (string) |
|
93 | + * |
|
94 | + * @param string $value |
|
95 | + * |
|
96 | + * @return ISearchRequestSimpleQuery |
|
97 | + * @since 17.0.0 |
|
98 | + */ |
|
99 | + public function addValue(string $value): ISearchRequestSimpleQuery; |
|
100 | 100 | |
101 | - /** |
|
102 | - * Add value to compare (int) |
|
103 | - * |
|
104 | - * @param int $value |
|
105 | - * |
|
106 | - * @return ISearchRequestSimpleQuery |
|
107 | - * @since 17.0.0 |
|
108 | - */ |
|
109 | - public function addValueInt(int $value): ISearchRequestSimpleQuery; |
|
101 | + /** |
|
102 | + * Add value to compare (int) |
|
103 | + * |
|
104 | + * @param int $value |
|
105 | + * |
|
106 | + * @return ISearchRequestSimpleQuery |
|
107 | + * @since 17.0.0 |
|
108 | + */ |
|
109 | + public function addValueInt(int $value): ISearchRequestSimpleQuery; |
|
110 | 110 | |
111 | - /** |
|
112 | - * Add value to compare (array) |
|
113 | - * |
|
114 | - * @param array $value |
|
115 | - * |
|
116 | - * @return ISearchRequestSimpleQuery |
|
117 | - * @since 17.0.0 |
|
118 | - */ |
|
119 | - public function addValueArray(array $value): ISearchRequestSimpleQuery; |
|
111 | + /** |
|
112 | + * Add value to compare (array) |
|
113 | + * |
|
114 | + * @param array $value |
|
115 | + * |
|
116 | + * @return ISearchRequestSimpleQuery |
|
117 | + * @since 17.0.0 |
|
118 | + */ |
|
119 | + public function addValueArray(array $value): ISearchRequestSimpleQuery; |
|
120 | 120 | |
121 | - /** |
|
122 | - * Add value to compare (bool) |
|
123 | - * |
|
124 | - * @param bool $value |
|
125 | - * |
|
126 | - * @return ISearchRequestSimpleQuery |
|
127 | - * @since 17.0.0 |
|
128 | - */ |
|
129 | - public function addValueBool(bool $value): ISearchRequestSimpleQuery; |
|
121 | + /** |
|
122 | + * Add value to compare (bool) |
|
123 | + * |
|
124 | + * @param bool $value |
|
125 | + * |
|
126 | + * @return ISearchRequestSimpleQuery |
|
127 | + * @since 17.0.0 |
|
128 | + */ |
|
129 | + public function addValueBool(bool $value): ISearchRequestSimpleQuery; |
|
130 | 130 | } |