@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | try { |
65 | 65 | return new \DateTimeZone($timeZone); |
66 | 66 | } catch (\Exception $e) { |
67 | - \OCP\Util::writeLog('datetimezone', 'Failed to created DateTimeZone "' . $timeZone . "'", \OCP\Util::DEBUG); |
|
67 | + \OCP\Util::writeLog('datetimezone', 'Failed to created DateTimeZone "'.$timeZone."'", \OCP\Util::DEBUG); |
|
68 | 68 | return new \DateTimeZone($this->getDefaultTimeZone()); |
69 | 69 | } |
70 | 70 | } |
@@ -85,9 +85,9 @@ discard block |
||
85 | 85 | // so a positive offset means negative timeZone |
86 | 86 | // and the other way around. |
87 | 87 | if ($offset > 0) { |
88 | - $timeZone = 'Etc/GMT-' . $offset; |
|
88 | + $timeZone = 'Etc/GMT-'.$offset; |
|
89 | 89 | } else { |
90 | - $timeZone = 'Etc/GMT+' . abs($offset); |
|
90 | + $timeZone = 'Etc/GMT+'.abs($offset); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | return new \DateTimeZone($timeZone); |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | } |
110 | 110 | |
111 | 111 | // No timezone found, fallback to UTC |
112 | - \OCP\Util::writeLog('datetimezone', 'Failed to find DateTimeZone for offset "' . $offset . "'", \OCP\Util::DEBUG); |
|
112 | + \OCP\Util::writeLog('datetimezone', 'Failed to find DateTimeZone for offset "'.$offset."'", \OCP\Util::DEBUG); |
|
113 | 113 | return new \DateTimeZone($this->getDefaultTimeZone()); |
114 | 114 | } |
115 | 115 | } |
@@ -93,40 +93,40 @@ discard block |
||
93 | 93 | * |
94 | 94 | * Returns a url to the given app and file. |
95 | 95 | */ |
96 | - public function linkTo( $app, $file, $args = array() ) { |
|
96 | + public function linkTo($app, $file, $args = array()) { |
|
97 | 97 | $frontControllerActive = ($this->config->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true'); |
98 | 98 | |
99 | - if( $app != '' ) { |
|
99 | + if ($app != '') { |
|
100 | 100 | $app_path = \OC_App::getAppPath($app); |
101 | 101 | // Check if the app is in the app folder |
102 | - if ($app_path && file_exists($app_path . '/' . $file)) { |
|
102 | + if ($app_path && file_exists($app_path.'/'.$file)) { |
|
103 | 103 | if (substr($file, -3) == 'php') { |
104 | 104 | |
105 | - $urlLinkTo = \OC::$WEBROOT . '/index.php/apps/' . $app; |
|
105 | + $urlLinkTo = \OC::$WEBROOT.'/index.php/apps/'.$app; |
|
106 | 106 | if ($frontControllerActive) { |
107 | - $urlLinkTo = \OC::$WEBROOT . '/apps/' . $app; |
|
107 | + $urlLinkTo = \OC::$WEBROOT.'/apps/'.$app; |
|
108 | 108 | } |
109 | - $urlLinkTo .= ($file != 'index.php') ? '/' . $file : ''; |
|
109 | + $urlLinkTo .= ($file != 'index.php') ? '/'.$file : ''; |
|
110 | 110 | } else { |
111 | - $urlLinkTo = \OC_App::getAppWebPath($app) . '/' . $file; |
|
111 | + $urlLinkTo = \OC_App::getAppWebPath($app).'/'.$file; |
|
112 | 112 | } |
113 | 113 | } else { |
114 | - $urlLinkTo = \OC::$WEBROOT . '/' . $app . '/' . $file; |
|
114 | + $urlLinkTo = \OC::$WEBROOT.'/'.$app.'/'.$file; |
|
115 | 115 | } |
116 | 116 | } else { |
117 | - if (file_exists(\OC::$SERVERROOT . '/core/' . $file)) { |
|
118 | - $urlLinkTo = \OC::$WEBROOT . '/core/' . $file; |
|
117 | + if (file_exists(\OC::$SERVERROOT.'/core/'.$file)) { |
|
118 | + $urlLinkTo = \OC::$WEBROOT.'/core/'.$file; |
|
119 | 119 | } else { |
120 | 120 | if ($frontControllerActive && $file === 'index.php') { |
121 | - $urlLinkTo = \OC::$WEBROOT . '/'; |
|
121 | + $urlLinkTo = \OC::$WEBROOT.'/'; |
|
122 | 122 | } else { |
123 | - $urlLinkTo = \OC::$WEBROOT . '/' . $file; |
|
123 | + $urlLinkTo = \OC::$WEBROOT.'/'.$file; |
|
124 | 124 | } |
125 | 125 | } |
126 | 126 | } |
127 | 127 | |
128 | 128 | if ($args && $query = http_build_query($args, '', '&')) { |
129 | - $urlLinkTo .= '?' . $query; |
|
129 | + $urlLinkTo .= '?'.$query; |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | return $urlLinkTo; |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | public function imagePath($app, $image) { |
145 | 145 | $cache = $this->cacheFactory->create('imagePath'); |
146 | 146 | $cacheKey = $app.'-'.$image; |
147 | - if($key = $cache->get($cacheKey)) { |
|
147 | + if ($key = $cache->get($cacheKey)) { |
|
148 | 148 | return $key; |
149 | 149 | } |
150 | 150 | |
@@ -152,58 +152,58 @@ discard block |
||
152 | 152 | $theme = \OC_Util::getTheme(); |
153 | 153 | |
154 | 154 | //if a theme has a png but not an svg always use the png |
155 | - $basename = substr(basename($image),0,-4); |
|
155 | + $basename = substr(basename($image), 0, -4); |
|
156 | 156 | |
157 | 157 | $appPath = \OC_App::getAppPath($app); |
158 | 158 | |
159 | 159 | // Check if the app is in the app folder |
160 | 160 | $path = ''; |
161 | 161 | $themingEnabled = $this->config->getSystemValue('installed', false) && \OCP\App::isEnabled('theming') && \OC_App::isAppLoaded('theming'); |
162 | - if($themingEnabled && $image === "favicon.ico" && \OC::$server->getThemingDefaults()->shouldReplaceIcons()) { |
|
162 | + if ($themingEnabled && $image === "favicon.ico" && \OC::$server->getThemingDefaults()->shouldReplaceIcons()) { |
|
163 | 163 | $cacheBusterValue = $this->config->getAppValue('theming', 'cachebuster', '0'); |
164 | - if($app==="") { $app = "core"; } |
|
165 | - $path = $this->linkToRoute('theming.Icon.getFavicon', [ 'app' => $app ]) . '?v='. $cacheBusterValue; |
|
166 | - } elseif($themingEnabled && $image === "favicon-touch.png" && \OC::$server->getThemingDefaults()->shouldReplaceIcons()) { |
|
164 | + if ($app === "") { $app = "core"; } |
|
165 | + $path = $this->linkToRoute('theming.Icon.getFavicon', ['app' => $app]).'?v='.$cacheBusterValue; |
|
166 | + } elseif ($themingEnabled && $image === "favicon-touch.png" && \OC::$server->getThemingDefaults()->shouldReplaceIcons()) { |
|
167 | 167 | $cacheBusterValue = $this->config->getAppValue('theming', 'cachebuster', '0'); |
168 | - if($app==="") { $app = "core"; } |
|
169 | - $path = $this->linkToRoute('theming.Icon.getTouchIcon', [ 'app' => $app ]) . '?v='. $cacheBusterValue; |
|
170 | - } elseif (file_exists(\OC::$SERVERROOT . "/themes/$theme/apps/$app/img/$image")) { |
|
171 | - $path = \OC::$WEBROOT . "/themes/$theme/apps/$app/img/$image"; |
|
172 | - } elseif (!file_exists(\OC::$SERVERROOT . "/themes/$theme/apps/$app/img/$basename.svg") |
|
173 | - && file_exists(\OC::$SERVERROOT . "/themes/$theme/apps/$app/img/$basename.png")) { |
|
174 | - $path = \OC::$WEBROOT . "/themes/$theme/apps/$app/img/$basename.png"; |
|
175 | - } elseif (!empty($app) and file_exists(\OC::$SERVERROOT . "/themes/$theme/$app/img/$image")) { |
|
176 | - $path = \OC::$WEBROOT . "/themes/$theme/$app/img/$image"; |
|
177 | - } elseif (!empty($app) and (!file_exists(\OC::$SERVERROOT . "/themes/$theme/$app/img/$basename.svg") |
|
178 | - && file_exists(\OC::$SERVERROOT . "/themes/$theme/$app/img/$basename.png"))) { |
|
179 | - $path = \OC::$WEBROOT . "/themes/$theme/$app/img/$basename.png"; |
|
180 | - } elseif (file_exists(\OC::$SERVERROOT . "/themes/$theme/core/img/$image")) { |
|
181 | - $path = \OC::$WEBROOT . "/themes/$theme/core/img/$image"; |
|
182 | - } elseif (!file_exists(\OC::$SERVERROOT . "/themes/$theme/core/img/$basename.svg") |
|
183 | - && file_exists(\OC::$SERVERROOT . "/themes/$theme/core/img/$basename.png")) { |
|
184 | - $path = \OC::$WEBROOT . "/themes/$theme/core/img/$basename.png"; |
|
185 | - } elseif ($appPath && file_exists($appPath . "/img/$image")) { |
|
186 | - $path = \OC_App::getAppWebPath($app) . "/img/$image"; |
|
187 | - } elseif ($appPath && !file_exists($appPath . "/img/$basename.svg") |
|
188 | - && file_exists($appPath . "/img/$basename.png")) { |
|
189 | - $path = \OC_App::getAppWebPath($app) . "/img/$basename.png"; |
|
190 | - } elseif (!empty($app) and file_exists(\OC::$SERVERROOT . "/$app/img/$image")) { |
|
191 | - $path = \OC::$WEBROOT . "/$app/img/$image"; |
|
192 | - } elseif (!empty($app) and (!file_exists(\OC::$SERVERROOT . "/$app/img/$basename.svg") |
|
193 | - && file_exists(\OC::$SERVERROOT . "/$app/img/$basename.png"))) { |
|
194 | - $path = \OC::$WEBROOT . "/$app/img/$basename.png"; |
|
195 | - } elseif (file_exists(\OC::$SERVERROOT . "/core/img/$image")) { |
|
196 | - $path = \OC::$WEBROOT . "/core/img/$image"; |
|
197 | - } elseif (!file_exists(\OC::$SERVERROOT . "/core/img/$basename.svg") |
|
198 | - && file_exists(\OC::$SERVERROOT . "/core/img/$basename.png")) { |
|
199 | - $path = \OC::$WEBROOT . "/themes/$theme/core/img/$basename.png"; |
|
168 | + if ($app === "") { $app = "core"; } |
|
169 | + $path = $this->linkToRoute('theming.Icon.getTouchIcon', ['app' => $app]).'?v='.$cacheBusterValue; |
|
170 | + } elseif (file_exists(\OC::$SERVERROOT."/themes/$theme/apps/$app/img/$image")) { |
|
171 | + $path = \OC::$WEBROOT."/themes/$theme/apps/$app/img/$image"; |
|
172 | + } elseif (!file_exists(\OC::$SERVERROOT."/themes/$theme/apps/$app/img/$basename.svg") |
|
173 | + && file_exists(\OC::$SERVERROOT."/themes/$theme/apps/$app/img/$basename.png")) { |
|
174 | + $path = \OC::$WEBROOT."/themes/$theme/apps/$app/img/$basename.png"; |
|
175 | + } elseif (!empty($app) and file_exists(\OC::$SERVERROOT."/themes/$theme/$app/img/$image")) { |
|
176 | + $path = \OC::$WEBROOT."/themes/$theme/$app/img/$image"; |
|
177 | + } elseif (!empty($app) and (!file_exists(\OC::$SERVERROOT."/themes/$theme/$app/img/$basename.svg") |
|
178 | + && file_exists(\OC::$SERVERROOT."/themes/$theme/$app/img/$basename.png"))) { |
|
179 | + $path = \OC::$WEBROOT."/themes/$theme/$app/img/$basename.png"; |
|
180 | + } elseif (file_exists(\OC::$SERVERROOT."/themes/$theme/core/img/$image")) { |
|
181 | + $path = \OC::$WEBROOT."/themes/$theme/core/img/$image"; |
|
182 | + } elseif (!file_exists(\OC::$SERVERROOT."/themes/$theme/core/img/$basename.svg") |
|
183 | + && file_exists(\OC::$SERVERROOT."/themes/$theme/core/img/$basename.png")) { |
|
184 | + $path = \OC::$WEBROOT."/themes/$theme/core/img/$basename.png"; |
|
185 | + } elseif ($appPath && file_exists($appPath."/img/$image")) { |
|
186 | + $path = \OC_App::getAppWebPath($app)."/img/$image"; |
|
187 | + } elseif ($appPath && !file_exists($appPath."/img/$basename.svg") |
|
188 | + && file_exists($appPath."/img/$basename.png")) { |
|
189 | + $path = \OC_App::getAppWebPath($app)."/img/$basename.png"; |
|
190 | + } elseif (!empty($app) and file_exists(\OC::$SERVERROOT."/$app/img/$image")) { |
|
191 | + $path = \OC::$WEBROOT."/$app/img/$image"; |
|
192 | + } elseif (!empty($app) and (!file_exists(\OC::$SERVERROOT."/$app/img/$basename.svg") |
|
193 | + && file_exists(\OC::$SERVERROOT."/$app/img/$basename.png"))) { |
|
194 | + $path = \OC::$WEBROOT."/$app/img/$basename.png"; |
|
195 | + } elseif (file_exists(\OC::$SERVERROOT."/core/img/$image")) { |
|
196 | + $path = \OC::$WEBROOT."/core/img/$image"; |
|
197 | + } elseif (!file_exists(\OC::$SERVERROOT."/core/img/$basename.svg") |
|
198 | + && file_exists(\OC::$SERVERROOT."/core/img/$basename.png")) { |
|
199 | + $path = \OC::$WEBROOT."/themes/$theme/core/img/$basename.png"; |
|
200 | 200 | } |
201 | 201 | |
202 | - if($path !== '') { |
|
202 | + if ($path !== '') { |
|
203 | 203 | $cache->set($cacheKey, $path); |
204 | 204 | return $path; |
205 | 205 | } else { |
206 | - throw new RuntimeException('image not found: image:' . $image . ' webroot:' . \OC::$WEBROOT . ' serverroot:' . \OC::$SERVERROOT); |
|
206 | + throw new RuntimeException('image not found: image:'.$image.' webroot:'.\OC::$WEBROOT.' serverroot:'.\OC::$SERVERROOT); |
|
207 | 207 | } |
208 | 208 | } |
209 | 209 | |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | $separator = $url[0] === '/' ? '' : '/'; |
218 | 218 | |
219 | 219 | if (\OC::$CLI && !defined('PHPUNIT_RUN')) { |
220 | - return rtrim($this->config->getSystemValue('overwrite.cli.url'), '/') . '/' . ltrim($url, '/'); |
|
220 | + return rtrim($this->config->getSystemValue('overwrite.cli.url'), '/').'/'.ltrim($url, '/'); |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | // The ownCloud web root can already be prepended. |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | : \OC::$WEBROOT; |
227 | 227 | |
228 | 228 | $request = \OC::$server->getRequest(); |
229 | - return $request->getServerProtocol() . '://' . $request->getServerHost() . $webRoot . $separator . $url; |
|
229 | + return $request->getServerProtocol().'://'.$request->getServerHost().$webRoot.$separator.$url; |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | /** |
@@ -50,12 +50,12 @@ discard block |
||
50 | 50 | * @return array An array of Tag objects. |
51 | 51 | */ |
52 | 52 | public function loadTags($owners, $type) { |
53 | - if(!is_array($owners)) { |
|
53 | + if (!is_array($owners)) { |
|
54 | 54 | $owners = array($owners); |
55 | 55 | } |
56 | 56 | |
57 | - $sql = 'SELECT `id`, `uid`, `type`, `category` FROM `' . $this->getTableName() . '` ' |
|
58 | - . 'WHERE `uid` IN (' . str_repeat('?,', count($owners)-1) . '?) AND `type` = ? ORDER BY `category`'; |
|
57 | + $sql = 'SELECT `id`, `uid`, `type`, `category` FROM `'.$this->getTableName().'` ' |
|
58 | + . 'WHERE `uid` IN ('.str_repeat('?,', count($owners) - 1).'?) AND `type` = ? ORDER BY `category`'; |
|
59 | 59 | return $this->findEntities($sql, array_merge($owners, array($type))); |
60 | 60 | } |
61 | 61 | |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | * @return bool |
67 | 67 | */ |
68 | 68 | public function tagExists($tag) { |
69 | - $sql = 'SELECT `id`, `uid`, `type`, `category` FROM `' . $this->getTableName() . '` ' |
|
69 | + $sql = 'SELECT `id`, `uid`, `type`, `category` FROM `'.$this->getTableName().'` ' |
|
70 | 70 | . 'WHERE `uid` = ? AND `type` = ? AND `category` = ?'; |
71 | 71 | try { |
72 | 72 | $this->findEntity($sql, array($tag->getOwner(), $tag->getType(), $tag->getName())); |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | * @todo migrate existing database columns to the correct names |
63 | 63 | * to be able to drop this direct mapping |
64 | 64 | */ |
65 | - public function columnToProperty($columnName){ |
|
65 | + public function columnToProperty($columnName) { |
|
66 | 66 | if ($columnName === 'category') { |
67 | 67 | return 'name'; |
68 | 68 | } elseif ($columnName === 'uid') { |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * @param string $property the name of the property |
79 | 79 | * @return string the column name |
80 | 80 | */ |
81 | - public function propertyToColumn($property){ |
|
81 | + public function propertyToColumn($property) { |
|
82 | 82 | if ($property === 'name') { |
83 | 83 | return 'category'; |
84 | 84 | } elseif ($property === 'owner') { |
@@ -52,7 +52,7 @@ |
||
52 | 52 | */ |
53 | 53 | public function generate($name, $parameters = array(), $absolute = false) { |
54 | 54 | asort($parameters); |
55 | - $key = $this->context->getHost() . '#' . $this->context->getBaseUrl() . $name . sha1(json_encode($parameters)) . intval($absolute); |
|
55 | + $key = $this->context->getHost().'#'.$this->context->getBaseUrl().$name.sha1(json_encode($parameters)).intval($absolute); |
|
56 | 56 | $cachedKey = $this->cache->get($key); |
57 | 57 | if ($cachedKey) { |
58 | 58 | return $cachedKey; |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | public function __construct(ILogger $logger) { |
73 | 73 | $this->logger = $logger; |
74 | 74 | $baseUrl = \OC::$WEBROOT; |
75 | - if(!(\OC::$server->getConfig()->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true')) { |
|
75 | + if (!(\OC::$server->getConfig()->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true')) { |
|
76 | 76 | $baseUrl = \OC::$server->getURLGenerator()->linkTo('', 'index.php'); |
77 | 77 | } |
78 | 78 | if (!\OC::$CLI) { |
@@ -98,8 +98,8 @@ discard block |
||
98 | 98 | $this->routingFiles = []; |
99 | 99 | foreach (\OC_APP::getEnabledApps() as $app) { |
100 | 100 | $appPath = \OC_App::getAppPath($app); |
101 | - if($appPath !== false) { |
|
102 | - $file = $appPath . '/appinfo/routes.php'; |
|
101 | + if ($appPath !== false) { |
|
102 | + $file = $appPath.'/appinfo/routes.php'; |
|
103 | 103 | if (file_exists($file)) { |
104 | 104 | $this->routingFiles[$app] = $file; |
105 | 105 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | * @param null|string $app |
116 | 116 | */ |
117 | 117 | public function loadRoutes($app = null) { |
118 | - if(is_string($app)) { |
|
118 | + if (is_string($app)) { |
|
119 | 119 | $app = \OC_App::cleanAppId($app); |
120 | 120 | } |
121 | 121 | |
@@ -130,14 +130,14 @@ discard block |
||
130 | 130 | if (isset($this->loadedApps[$app])) { |
131 | 131 | return; |
132 | 132 | } |
133 | - $file = \OC_App::getAppPath($app) . '/appinfo/routes.php'; |
|
133 | + $file = \OC_App::getAppPath($app).'/appinfo/routes.php'; |
|
134 | 134 | if ($file !== false && file_exists($file)) { |
135 | 135 | $routingFiles = [$app => $file]; |
136 | 136 | } else { |
137 | 137 | $routingFiles = []; |
138 | 138 | } |
139 | 139 | } |
140 | - \OC::$server->getEventLogger()->start('loadroutes' . $requestedApp, 'Loading Routes'); |
|
140 | + \OC::$server->getEventLogger()->start('loadroutes'.$requestedApp, 'Loading Routes'); |
|
141 | 141 | foreach ($routingFiles as $app => $file) { |
142 | 142 | if (!isset($this->loadedApps[$app])) { |
143 | 143 | if (!\OC_App::isAppLoaded($app)) { |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | $this->useCollection($app); |
151 | 151 | $this->requireRouteFile($file, $app); |
152 | 152 | $collection = $this->getCollection($app); |
153 | - $collection->addPrefix('/apps/' . $app); |
|
153 | + $collection->addPrefix('/apps/'.$app); |
|
154 | 154 | $this->root->addCollection($collection); |
155 | 155 | |
156 | 156 | // Also add the OCS collection |
@@ -162,8 +162,8 @@ discard block |
||
162 | 162 | if (!isset($this->loadedApps['core'])) { |
163 | 163 | $this->loadedApps['core'] = true; |
164 | 164 | $this->useCollection('root'); |
165 | - require_once __DIR__ . '/../../../settings/routes.php'; |
|
166 | - require_once __DIR__ . '/../../../core/routes.php'; |
|
165 | + require_once __DIR__.'/../../../settings/routes.php'; |
|
166 | + require_once __DIR__.'/../../../core/routes.php'; |
|
167 | 167 | |
168 | 168 | // Also add the OCS collection |
169 | 169 | $collection = $this->getCollection('root.ocs'); |
@@ -172,12 +172,12 @@ discard block |
||
172 | 172 | } |
173 | 173 | if ($this->loaded) { |
174 | 174 | // include ocs routes, must be loaded last for /ocs prefix |
175 | - require_once __DIR__ . '/../../../ocs/routes.php'; |
|
175 | + require_once __DIR__.'/../../../ocs/routes.php'; |
|
176 | 176 | $collection = $this->getCollection('ocs'); |
177 | 177 | $collection->addPrefix('/ocs'); |
178 | 178 | $this->root->addCollection($collection); |
179 | 179 | } |
180 | - \OC::$server->getEventLogger()->end('loadroutes' . $requestedApp); |
|
180 | + \OC::$server->getEventLogger()->end('loadroutes'.$requestedApp); |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | /** |
@@ -248,14 +248,14 @@ discard block |
||
248 | 248 | public function match($url) { |
249 | 249 | if (substr($url, 0, 6) === '/apps/') { |
250 | 250 | // empty string / 'apps' / $app / rest of the route |
251 | - list(, , $app,) = explode('/', $url, 4); |
|
251 | + list(,, $app,) = explode('/', $url, 4); |
|
252 | 252 | |
253 | 253 | $app = \OC_App::cleanAppId($app); |
254 | 254 | \OC::$REQUESTEDAPP = $app; |
255 | 255 | $this->loadRoutes($app); |
256 | 256 | } else if (substr($url, 0, 13) === '/ocsapp/apps/') { |
257 | 257 | // empty string / 'ocsapp' / 'apps' / $app / rest of the route |
258 | - list(, , , $app,) = explode('/', $url, 5); |
|
258 | + list(,,, $app,) = explode('/', $url, 5); |
|
259 | 259 | |
260 | 260 | $app = \OC_App::cleanAppId($app); |
261 | 261 | \OC::$REQUESTEDAPP = $app; |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | // However, since Symfony does not allow empty route names, the route |
280 | 280 | // we need to match is '/', so we need to append the '/' here. |
281 | 281 | try { |
282 | - $parameters = $matcher->match($url . '/'); |
|
282 | + $parameters = $matcher->match($url.'/'); |
|
283 | 283 | } catch (ResourceNotFoundException $newException) { |
284 | 284 | // If we still didn't match a route, we throw the original exception |
285 | 285 | throw $e; |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | if (is_array($routes)) { |
370 | 370 | $appNameSpace = App::buildAppNamespace($appName); |
371 | 371 | |
372 | - $applicationClassName = $appNameSpace . '\\AppInfo\\Application'; |
|
372 | + $applicationClassName = $appNameSpace.'\\AppInfo\\Application'; |
|
373 | 373 | |
374 | 374 | if (class_exists($applicationClassName)) { |
375 | 375 | $application = new $applicationClassName(); |
@@ -41,10 +41,10 @@ discard block |
||
41 | 41 | public function search($pattern, $searchProperties = array(), $options = array()) { |
42 | 42 | $this->loadAddressBooks(); |
43 | 43 | $result = array(); |
44 | - foreach($this->addressBooks as $addressBook) { |
|
44 | + foreach ($this->addressBooks as $addressBook) { |
|
45 | 45 | $r = $addressBook->search($pattern, $searchProperties, $options); |
46 | 46 | $contacts = array(); |
47 | - foreach($r as $c){ |
|
47 | + foreach ($r as $c) { |
|
48 | 48 | $c['addressbook-key'] = $addressBook->getKey(); |
49 | 49 | $contacts[] = $c; |
50 | 50 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | public function getAddressBooks() { |
125 | 125 | $this->loadAddressBooks(); |
126 | 126 | $result = array(); |
127 | - foreach($this->addressBooks as $addressBook) { |
|
127 | + foreach ($this->addressBooks as $addressBook) { |
|
128 | 128 | $result[$addressBook->getKey()] = $addressBook->getDisplayName(); |
129 | 129 | } |
130 | 130 | |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | */ |
182 | 182 | protected function loadAddressBooks() |
183 | 183 | { |
184 | - foreach($this->addressBookLoaders as $callable) { |
|
184 | + foreach ($this->addressBookLoaders as $callable) { |
|
185 | 185 | $callable($this); |
186 | 186 | } |
187 | 187 | $this->addressBookLoaders = array(); |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | |
86 | 86 | // If at least PHP 7.0.0 is used we don't need to disable apps as we catch |
87 | 87 | // fatal errors and exceptions and disable the app just instead. |
88 | - if(version_compare(phpversion(), '7.0.0', '>=')) { |
|
88 | + if (version_compare(phpversion(), '7.0.0', '>=')) { |
|
89 | 89 | $this->skip3rdPartyAppsDisable = true; |
90 | 90 | } |
91 | 91 | } |
@@ -111,43 +111,43 @@ discard block |
||
111 | 111 | $this->logAllEvents(); |
112 | 112 | |
113 | 113 | $logLevel = $this->config->getSystemValue('loglevel', Util::WARN); |
114 | - $this->emit('\OC\Updater', 'setDebugLogLevel', [ $logLevel, $this->logLevelNames[$logLevel] ]); |
|
114 | + $this->emit('\OC\Updater', 'setDebugLogLevel', [$logLevel, $this->logLevelNames[$logLevel]]); |
|
115 | 115 | $this->config->setSystemValue('loglevel', Util::DEBUG); |
116 | 116 | |
117 | 117 | $wasMaintenanceModeEnabled = $this->config->getSystemValue('maintenance', false); |
118 | 118 | |
119 | - if(!$wasMaintenanceModeEnabled) { |
|
119 | + if (!$wasMaintenanceModeEnabled) { |
|
120 | 120 | $this->config->setSystemValue('maintenance', true); |
121 | 121 | $this->emit('\OC\Updater', 'maintenanceEnabled'); |
122 | 122 | } |
123 | 123 | |
124 | 124 | $installedVersion = $this->config->getSystemValue('version', '0.0.0'); |
125 | 125 | $currentVersion = implode('.', \OCP\Util::getVersion()); |
126 | - $this->log->debug('starting upgrade from ' . $installedVersion . ' to ' . $currentVersion, array('app' => 'core')); |
|
126 | + $this->log->debug('starting upgrade from '.$installedVersion.' to '.$currentVersion, array('app' => 'core')); |
|
127 | 127 | |
128 | 128 | $success = true; |
129 | 129 | try { |
130 | 130 | $this->doUpgrade($currentVersion, $installedVersion); |
131 | 131 | } catch (HintException $exception) { |
132 | 132 | $this->log->logException($exception, ['app' => 'core']); |
133 | - $this->emit('\OC\Updater', 'failure', array($exception->getMessage() . ': ' .$exception->getHint())); |
|
133 | + $this->emit('\OC\Updater', 'failure', array($exception->getMessage().': '.$exception->getHint())); |
|
134 | 134 | $success = false; |
135 | 135 | } catch (\Exception $exception) { |
136 | 136 | $this->log->logException($exception, ['app' => 'core']); |
137 | - $this->emit('\OC\Updater', 'failure', array(get_class($exception) . ': ' .$exception->getMessage())); |
|
137 | + $this->emit('\OC\Updater', 'failure', array(get_class($exception).': '.$exception->getMessage())); |
|
138 | 138 | $success = false; |
139 | 139 | } |
140 | 140 | |
141 | 141 | $this->emit('\OC\Updater', 'updateEnd', array($success)); |
142 | 142 | |
143 | - if(!$wasMaintenanceModeEnabled && $success) { |
|
143 | + if (!$wasMaintenanceModeEnabled && $success) { |
|
144 | 144 | $this->config->setSystemValue('maintenance', false); |
145 | 145 | $this->emit('\OC\Updater', 'maintenanceDisabled'); |
146 | 146 | } else { |
147 | 147 | $this->emit('\OC\Updater', 'maintenanceActive'); |
148 | 148 | } |
149 | 149 | |
150 | - $this->emit('\OC\Updater', 'resetLogLevel', [ $logLevel, $this->logLevelNames[$logLevel] ]); |
|
150 | + $this->emit('\OC\Updater', 'resetLogLevel', [$logLevel, $this->logLevelNames[$logLevel]]); |
|
151 | 151 | $this->config->setSystemValue('loglevel', $logLevel); |
152 | 152 | $this->config->setSystemValue('installed', true); |
153 | 153 | |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | */ |
162 | 162 | private function getAllowedPreviousVersions() { |
163 | 163 | // this should really be a JSON file |
164 | - require \OC::$SERVERROOT . '/version.php'; |
|
164 | + require \OC::$SERVERROOT.'/version.php'; |
|
165 | 165 | /** @var array $OC_VersionCanBeUpgradedFrom */ |
166 | 166 | return $OC_VersionCanBeUpgradedFrom; |
167 | 167 | } |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | */ |
174 | 174 | private function getVendor() { |
175 | 175 | // this should really be a JSON file |
176 | - require \OC::$SERVERROOT . '/version.php'; |
|
176 | + require \OC::$SERVERROOT.'/version.php'; |
|
177 | 177 | /** @var string $vendor */ |
178 | 178 | return (string) $vendor; |
179 | 179 | } |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | */ |
188 | 188 | public function isUpgradePossible($oldVersion, $newVersion, array $allowedPreviousVersions) { |
189 | 189 | $version = explode('.', $oldVersion); |
190 | - $majorMinor = $version[0] . '.' . $version[1]; |
|
190 | + $majorMinor = $version[0].'.'.$version[1]; |
|
191 | 191 | |
192 | 192 | $currentVendor = $this->config->getAppValue('core', 'vendor', ''); |
193 | 193 | if ($currentVendor === 'nextcloud') { |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | // create empty file in data dir, so we can later find |
228 | 228 | // out that this is indeed an ownCloud data directory |
229 | 229 | // (in case it didn't exist before) |
230 | - file_put_contents($this->config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/.ocdata', ''); |
|
230 | + file_put_contents($this->config->getSystemValue('datadirectory', \OC::$SERVERROOT.'/data').'/.ocdata', ''); |
|
231 | 231 | |
232 | 232 | // pre-upgrade repairs |
233 | 233 | $repair = new Repair(Repair::getBeforeUpgradeRepairSteps(), \OC::$server->getEventDispatcher()); |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | foreach ($errors as $appId => $exception) { |
256 | 256 | /** @var \Exception $exception */ |
257 | 257 | $this->log->logException($exception, ['app' => $appId]); |
258 | - $this->emit('\OC\Updater', 'failure', [$appId . ': ' . $exception->getMessage()]); |
|
258 | + $this->emit('\OC\Updater', 'failure', [$appId.': '.$exception->getMessage()]); |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | // post-upgrade repairs |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | $this->config->setAppValue('core', 'lastupdatedat', 0); |
267 | 267 | |
268 | 268 | // Check for code integrity if not disabled |
269 | - if(\OC::$server->getIntegrityCodeChecker()->isCodeCheckEnforced()) { |
|
269 | + if (\OC::$server->getIntegrityCodeChecker()->isCodeCheckEnforced()) { |
|
270 | 270 | $this->emit('\OC\Updater', 'startCheckCodeIntegrity'); |
271 | 271 | $this->checker->runInstanceVerification(); |
272 | 272 | $this->emit('\OC\Updater', 'finishedCheckCodeIntegrity'); |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | $this->emit('\OC\Updater', 'dbUpgradeBefore'); |
282 | 282 | |
283 | 283 | // do the real upgrade |
284 | - \OC_DB::updateDbFromStructure(\OC::$SERVERROOT . '/db_structure.xml'); |
|
284 | + \OC_DB::updateDbFromStructure(\OC::$SERVERROOT.'/db_structure.xml'); |
|
285 | 285 | |
286 | 286 | $this->emit('\OC\Updater', 'dbUpgrade'); |
287 | 287 | } |
@@ -305,12 +305,12 @@ discard block |
||
305 | 305 | * @link https://github.com/owncloud/core/issues/10980 |
306 | 306 | * @see \OC_App::updateApp |
307 | 307 | */ |
308 | - if (file_exists(\OC_App::getAppPath($appId) . '/appinfo/preupdate.php')) { |
|
308 | + if (file_exists(\OC_App::getAppPath($appId).'/appinfo/preupdate.php')) { |
|
309 | 309 | $this->includePreUpdate($appId); |
310 | 310 | } |
311 | - if (file_exists(\OC_App::getAppPath($appId) . '/appinfo/database.xml')) { |
|
311 | + if (file_exists(\OC_App::getAppPath($appId).'/appinfo/database.xml')) { |
|
312 | 312 | $this->emit('\OC\Updater', 'appSimulateUpdate', array($appId)); |
313 | - \OC_DB::simulateUpdateDbFromStructure(\OC_App::getAppPath($appId) . '/appinfo/database.xml'); |
|
313 | + \OC_DB::simulateUpdateDbFromStructure(\OC_App::getAppPath($appId).'/appinfo/database.xml'); |
|
314 | 314 | } |
315 | 315 | } |
316 | 316 | } |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | * @param string $appId |
324 | 324 | */ |
325 | 325 | private function includePreUpdate($appId) { |
326 | - include \OC_App::getAppPath($appId) . '/appinfo/preupdate.php'; |
|
326 | + include \OC_App::getAppPath($appId).'/appinfo/preupdate.php'; |
|
327 | 327 | } |
328 | 328 | |
329 | 329 | /** |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | foreach ($apps as $appId) { |
342 | 342 | $priorityType = false; |
343 | 343 | foreach ($priorityTypes as $type) { |
344 | - if(!isset($stacks[$type])) { |
|
344 | + if (!isset($stacks[$type])) { |
|
345 | 345 | $stacks[$type] = array(); |
346 | 346 | } |
347 | 347 | if (\OC_App::isType($appId, $type)) { |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | \OC_App::updateApp($appId); |
362 | 362 | $this->emit('\OC\Updater', 'appUpgrade', [$appId, \OC_App::getAppVersion($appId)]); |
363 | 363 | } |
364 | - if($type !== $pseudoOtherType) { |
|
364 | + if ($type !== $pseudoOtherType) { |
|
365 | 365 | // load authentication, filesystem and logging apps after |
366 | 366 | // upgrading them. Other apps my need to rely on modifying |
367 | 367 | // user and/or filesystem aspects. |
@@ -388,9 +388,9 @@ discard block |
||
388 | 388 | foreach ($apps as $app) { |
389 | 389 | // check if the app is compatible with this version of ownCloud |
390 | 390 | $info = OC_App::getAppInfo($app); |
391 | - if(!OC_App::isAppCompatible($version, $info)) { |
|
391 | + if (!OC_App::isAppCompatible($version, $info)) { |
|
392 | 392 | if (OC_App::isShipped($app)) { |
393 | - throw new \UnexpectedValueException('The files of the app "' . $app . '" were not correctly replaced before running the update'); |
|
393 | + throw new \UnexpectedValueException('The files of the app "'.$app.'" were not correctly replaced before running the update'); |
|
394 | 394 | } |
395 | 395 | OC_App::disable($app); |
396 | 396 | $this->emit('\OC\Updater', 'incompatibleAppDisabled', array($app)); |
@@ -409,9 +409,9 @@ discard block |
||
409 | 409 | } |
410 | 410 | |
411 | 411 | // disable any other 3rd party apps if not overriden |
412 | - if(!$this->skip3rdPartyAppsDisable) { |
|
412 | + if (!$this->skip3rdPartyAppsDisable) { |
|
413 | 413 | \OC_App::disable($app); |
414 | - $disabledApps[]= $app; |
|
414 | + $disabledApps[] = $app; |
|
415 | 415 | $this->emit('\OC\Updater', 'thirdPartyAppDisabled', array($app)); |
416 | 416 | }; |
417 | 417 | } |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | * @throws \Exception |
436 | 436 | */ |
437 | 437 | private function upgradeAppStoreApps(array $disabledApps) { |
438 | - foreach($disabledApps as $app) { |
|
438 | + foreach ($disabledApps as $app) { |
|
439 | 439 | try { |
440 | 440 | $installer = new Installer( |
441 | 441 | \OC::$server->getAppFetcher(), |
@@ -458,22 +458,22 @@ discard block |
||
458 | 458 | */ |
459 | 459 | private function emitRepairEvents() { |
460 | 460 | $dispatcher = \OC::$server->getEventDispatcher(); |
461 | - $dispatcher->addListener('\OC\Repair::warning', function ($event) { |
|
461 | + $dispatcher->addListener('\OC\Repair::warning', function($event) { |
|
462 | 462 | if ($event instanceof GenericEvent) { |
463 | 463 | $this->emit('\OC\Updater', 'repairWarning', $event->getArguments()); |
464 | 464 | } |
465 | 465 | }); |
466 | - $dispatcher->addListener('\OC\Repair::error', function ($event) { |
|
466 | + $dispatcher->addListener('\OC\Repair::error', function($event) { |
|
467 | 467 | if ($event instanceof GenericEvent) { |
468 | 468 | $this->emit('\OC\Updater', 'repairError', $event->getArguments()); |
469 | 469 | } |
470 | 470 | }); |
471 | - $dispatcher->addListener('\OC\Repair::info', function ($event) { |
|
471 | + $dispatcher->addListener('\OC\Repair::info', function($event) { |
|
472 | 472 | if ($event instanceof GenericEvent) { |
473 | 473 | $this->emit('\OC\Updater', 'repairInfo', $event->getArguments()); |
474 | 474 | } |
475 | 475 | }); |
476 | - $dispatcher->addListener('\OC\Repair::step', function ($event) { |
|
476 | + $dispatcher->addListener('\OC\Repair::step', function($event) { |
|
477 | 477 | if ($event instanceof GenericEvent) { |
478 | 478 | $this->emit('\OC\Updater', 'repairStep', $event->getArguments()); |
479 | 479 | } |
@@ -488,13 +488,13 @@ discard block |
||
488 | 488 | if (!$event instanceof GenericEvent) { |
489 | 489 | return; |
490 | 490 | } |
491 | - $log->info('\OC\DB\Migrator::executeSql: ' . $event->getSubject() . ' (' . $event->getArgument(0) . ' of ' . $event->getArgument(1) . ')', ['app' => 'updater']); |
|
491 | + $log->info('\OC\DB\Migrator::executeSql: '.$event->getSubject().' ('.$event->getArgument(0).' of '.$event->getArgument(1).')', ['app' => 'updater']); |
|
492 | 492 | }); |
493 | 493 | $dispatcher->addListener('\OC\DB\Migrator::checkTable', function($event) use ($log) { |
494 | 494 | if (!$event instanceof GenericEvent) { |
495 | 495 | return; |
496 | 496 | } |
497 | - $log->info('\OC\DB\Migrator::checkTable: ' . $event->getSubject() . ' (' . $event->getArgument(0) . ' of ' . $event->getArgument(1) . ')', ['app' => 'updater']); |
|
497 | + $log->info('\OC\DB\Migrator::checkTable: '.$event->getSubject().' ('.$event->getArgument(0).' of '.$event->getArgument(1).')', ['app' => 'updater']); |
|
498 | 498 | }); |
499 | 499 | |
500 | 500 | $repairListener = function($event) use ($log) { |
@@ -503,30 +503,30 @@ discard block |
||
503 | 503 | } |
504 | 504 | switch ($event->getSubject()) { |
505 | 505 | case '\OC\Repair::startProgress': |
506 | - $log->info('\OC\Repair::startProgress: Starting ... ' . $event->getArgument(1) . ' (' . $event->getArgument(0) . ')', ['app' => 'updater']); |
|
506 | + $log->info('\OC\Repair::startProgress: Starting ... '.$event->getArgument(1).' ('.$event->getArgument(0).')', ['app' => 'updater']); |
|
507 | 507 | break; |
508 | 508 | case '\OC\Repair::advance': |
509 | 509 | $desc = $event->getArgument(1); |
510 | 510 | if (empty($desc)) { |
511 | 511 | $desc = ''; |
512 | 512 | } |
513 | - $log->info('\OC\Repair::advance: ' . $desc . ' (' . $event->getArgument(0) . ')', ['app' => 'updater']); |
|
513 | + $log->info('\OC\Repair::advance: '.$desc.' ('.$event->getArgument(0).')', ['app' => 'updater']); |
|
514 | 514 | |
515 | 515 | break; |
516 | 516 | case '\OC\Repair::finishProgress': |
517 | 517 | $log->info('\OC\Repair::finishProgress', ['app' => 'updater']); |
518 | 518 | break; |
519 | 519 | case '\OC\Repair::step': |
520 | - $log->info('\OC\Repair::step: Repair step: ' . $event->getArgument(0), ['app' => 'updater']); |
|
520 | + $log->info('\OC\Repair::step: Repair step: '.$event->getArgument(0), ['app' => 'updater']); |
|
521 | 521 | break; |
522 | 522 | case '\OC\Repair::info': |
523 | - $log->info('\OC\Repair::info: Repair info: ' . $event->getArgument(0), ['app' => 'updater']); |
|
523 | + $log->info('\OC\Repair::info: Repair info: '.$event->getArgument(0), ['app' => 'updater']); |
|
524 | 524 | break; |
525 | 525 | case '\OC\Repair::warning': |
526 | - $log->warning('\OC\Repair::warning: Repair warning: ' . $event->getArgument(0), ['app' => 'updater']); |
|
526 | + $log->warning('\OC\Repair::warning: Repair warning: '.$event->getArgument(0), ['app' => 'updater']); |
|
527 | 527 | break; |
528 | 528 | case '\OC\Repair::error': |
529 | - $log->error('\OC\Repair::error: Repair error: ' . $event->getArgument(0), ['app' => 'updater']); |
|
529 | + $log->error('\OC\Repair::error: Repair error: '.$event->getArgument(0), ['app' => 'updater']); |
|
530 | 530 | break; |
531 | 531 | } |
532 | 532 | }; |
@@ -540,71 +540,71 @@ discard block |
||
540 | 540 | $dispatcher->addListener('\OC\Repair::error', $repairListener); |
541 | 541 | |
542 | 542 | |
543 | - $this->listen('\OC\Updater', 'maintenanceEnabled', function () use($log) { |
|
543 | + $this->listen('\OC\Updater', 'maintenanceEnabled', function() use($log) { |
|
544 | 544 | $log->info('\OC\Updater::maintenanceEnabled: Turned on maintenance mode', ['app' => 'updater']); |
545 | 545 | }); |
546 | - $this->listen('\OC\Updater', 'maintenanceDisabled', function () use($log) { |
|
546 | + $this->listen('\OC\Updater', 'maintenanceDisabled', function() use($log) { |
|
547 | 547 | $log->info('\OC\Updater::maintenanceDisabled: Turned off maintenance mode', ['app' => 'updater']); |
548 | 548 | }); |
549 | - $this->listen('\OC\Updater', 'maintenanceActive', function () use($log) { |
|
549 | + $this->listen('\OC\Updater', 'maintenanceActive', function() use($log) { |
|
550 | 550 | $log->info('\OC\Updater::maintenanceActive: Maintenance mode is kept active', ['app' => 'updater']); |
551 | 551 | }); |
552 | - $this->listen('\OC\Updater', 'updateEnd', function ($success) use($log) { |
|
552 | + $this->listen('\OC\Updater', 'updateEnd', function($success) use($log) { |
|
553 | 553 | if ($success) { |
554 | 554 | $log->info('\OC\Updater::updateEnd: Update successful', ['app' => 'updater']); |
555 | 555 | } else { |
556 | 556 | $log->error('\OC\Updater::updateEnd: Update failed', ['app' => 'updater']); |
557 | 557 | } |
558 | 558 | }); |
559 | - $this->listen('\OC\Updater', 'dbUpgradeBefore', function () use($log) { |
|
559 | + $this->listen('\OC\Updater', 'dbUpgradeBefore', function() use($log) { |
|
560 | 560 | $log->info('\OC\Updater::dbUpgradeBefore: Updating database schema', ['app' => 'updater']); |
561 | 561 | }); |
562 | - $this->listen('\OC\Updater', 'dbUpgrade', function () use($log) { |
|
562 | + $this->listen('\OC\Updater', 'dbUpgrade', function() use($log) { |
|
563 | 563 | $log->info('\OC\Updater::dbUpgrade: Updated database', ['app' => 'updater']); |
564 | 564 | }); |
565 | - $this->listen('\OC\Updater', 'dbSimulateUpgradeBefore', function () use($log) { |
|
565 | + $this->listen('\OC\Updater', 'dbSimulateUpgradeBefore', function() use($log) { |
|
566 | 566 | $log->info('\OC\Updater::dbSimulateUpgradeBefore: Checking whether the database schema can be updated (this can take a long time depending on the database size)', ['app' => 'updater']); |
567 | 567 | }); |
568 | - $this->listen('\OC\Updater', 'dbSimulateUpgrade', function () use($log) { |
|
568 | + $this->listen('\OC\Updater', 'dbSimulateUpgrade', function() use($log) { |
|
569 | 569 | $log->info('\OC\Updater::dbSimulateUpgrade: Checked database schema update', ['app' => 'updater']); |
570 | 570 | }); |
571 | - $this->listen('\OC\Updater', 'incompatibleAppDisabled', function ($app) use($log) { |
|
572 | - $log->info('\OC\Updater::incompatibleAppDisabled: Disabled incompatible app: ' . $app, ['app' => 'updater']); |
|
571 | + $this->listen('\OC\Updater', 'incompatibleAppDisabled', function($app) use($log) { |
|
572 | + $log->info('\OC\Updater::incompatibleAppDisabled: Disabled incompatible app: '.$app, ['app' => 'updater']); |
|
573 | 573 | }); |
574 | - $this->listen('\OC\Updater', 'thirdPartyAppDisabled', function ($app) use ($log) { |
|
575 | - $log->info('\OC\Updater::thirdPartyAppDisabled: Disabled 3rd-party app: ' . $app, ['app' => 'updater']); |
|
574 | + $this->listen('\OC\Updater', 'thirdPartyAppDisabled', function($app) use ($log) { |
|
575 | + $log->info('\OC\Updater::thirdPartyAppDisabled: Disabled 3rd-party app: '.$app, ['app' => 'updater']); |
|
576 | 576 | }); |
577 | - $this->listen('\OC\Updater', 'upgradeAppStoreApp', function ($app) use($log) { |
|
578 | - $log->info('\OC\Updater::upgradeAppStoreApp: Update 3rd-party app: ' . $app, ['app' => 'updater']); |
|
577 | + $this->listen('\OC\Updater', 'upgradeAppStoreApp', function($app) use($log) { |
|
578 | + $log->info('\OC\Updater::upgradeAppStoreApp: Update 3rd-party app: '.$app, ['app' => 'updater']); |
|
579 | 579 | }); |
580 | - $this->listen('\OC\Updater', 'appUpgradeCheckBefore', function () use ($log) { |
|
580 | + $this->listen('\OC\Updater', 'appUpgradeCheckBefore', function() use ($log) { |
|
581 | 581 | $log->info('\OC\Updater::appUpgradeCheckBefore: Checking updates of apps', ['app' => 'updater']); |
582 | 582 | }); |
583 | - $this->listen('\OC\Updater', 'appSimulateUpdate', function ($app) use ($log) { |
|
584 | - $log->info('\OC\Updater::appSimulateUpdate: Checking whether the database schema for <' . $app . '> can be updated (this can take a long time depending on the database size)', ['app' => 'updater']); |
|
583 | + $this->listen('\OC\Updater', 'appSimulateUpdate', function($app) use ($log) { |
|
584 | + $log->info('\OC\Updater::appSimulateUpdate: Checking whether the database schema for <'.$app.'> can be updated (this can take a long time depending on the database size)', ['app' => 'updater']); |
|
585 | 585 | }); |
586 | - $this->listen('\OC\Updater', 'appUpgradeCheck', function () use ($log) { |
|
586 | + $this->listen('\OC\Updater', 'appUpgradeCheck', function() use ($log) { |
|
587 | 587 | $log->info('\OC\Updater::appUpgradeCheck: Checked database schema update for apps', ['app' => 'updater']); |
588 | 588 | }); |
589 | - $this->listen('\OC\Updater', 'appUpgradeStarted', function ($app) use ($log) { |
|
590 | - $log->info('\OC\Updater::appUpgradeStarted: Updating <' . $app . '> ...', ['app' => 'updater']); |
|
589 | + $this->listen('\OC\Updater', 'appUpgradeStarted', function($app) use ($log) { |
|
590 | + $log->info('\OC\Updater::appUpgradeStarted: Updating <'.$app.'> ...', ['app' => 'updater']); |
|
591 | 591 | }); |
592 | - $this->listen('\OC\Updater', 'appUpgrade', function ($app, $version) use ($log) { |
|
593 | - $log->info('\OC\Updater::appUpgrade: Updated <' . $app . '> to ' . $version, ['app' => 'updater']); |
|
592 | + $this->listen('\OC\Updater', 'appUpgrade', function($app, $version) use ($log) { |
|
593 | + $log->info('\OC\Updater::appUpgrade: Updated <'.$app.'> to '.$version, ['app' => 'updater']); |
|
594 | 594 | }); |
595 | - $this->listen('\OC\Updater', 'failure', function ($message) use($log) { |
|
596 | - $log->error('\OC\Updater::failure: ' . $message, ['app' => 'updater']); |
|
595 | + $this->listen('\OC\Updater', 'failure', function($message) use($log) { |
|
596 | + $log->error('\OC\Updater::failure: '.$message, ['app' => 'updater']); |
|
597 | 597 | }); |
598 | - $this->listen('\OC\Updater', 'setDebugLogLevel', function () use($log) { |
|
598 | + $this->listen('\OC\Updater', 'setDebugLogLevel', function() use($log) { |
|
599 | 599 | $log->info('\OC\Updater::setDebugLogLevel: Set log level to debug', ['app' => 'updater']); |
600 | 600 | }); |
601 | - $this->listen('\OC\Updater', 'resetLogLevel', function ($logLevel, $logLevelName) use($log) { |
|
602 | - $log->info('\OC\Updater::resetLogLevel: Reset log level to ' . $logLevelName . '(' . $logLevel . ')', ['app' => 'updater']); |
|
601 | + $this->listen('\OC\Updater', 'resetLogLevel', function($logLevel, $logLevelName) use($log) { |
|
602 | + $log->info('\OC\Updater::resetLogLevel: Reset log level to '.$logLevelName.'('.$logLevel.')', ['app' => 'updater']); |
|
603 | 603 | }); |
604 | - $this->listen('\OC\Updater', 'startCheckCodeIntegrity', function () use($log) { |
|
604 | + $this->listen('\OC\Updater', 'startCheckCodeIntegrity', function() use($log) { |
|
605 | 605 | $log->info('\OC\Updater::startCheckCodeIntegrity: Starting code integrity check...', ['app' => 'updater']); |
606 | 606 | }); |
607 | - $this->listen('\OC\Updater', 'finishedCheckCodeIntegrity', function () use($log) { |
|
607 | + $this->listen('\OC\Updater', 'finishedCheckCodeIntegrity', function() use($log) { |
|
608 | 608 | $log->info('\OC\Updater::finishedCheckCodeIntegrity: Finished code integrity check', ['app' => 'updater']); |
609 | 609 | }); |
610 | 610 |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public function installApp($appId) { |
96 | 96 | $app = \OC_App::findAppInDirectories($appId); |
97 | - if($app === false) { |
|
97 | + if ($app === false) { |
|
98 | 98 | throw new \Exception('App not found in any app directory'); |
99 | 99 | } |
100 | 100 | |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | $info = OC_App::getAppInfo($basedir.'/appinfo/info.xml', true); |
103 | 103 | |
104 | 104 | //install the database |
105 | - if(is_file($basedir.'/appinfo/database.xml')) { |
|
105 | + if (is_file($basedir.'/appinfo/database.xml')) { |
|
106 | 106 | if (\OC::$server->getAppConfig()->getValue($info['id'], 'installed_version') === null) { |
107 | 107 | OC_DB::createDbFromStructure($basedir.'/appinfo/database.xml'); |
108 | 108 | } else { |
@@ -113,8 +113,8 @@ discard block |
||
113 | 113 | \OC_App::setupBackgroundJobs($info['background-jobs']); |
114 | 114 | |
115 | 115 | //run appinfo/install.php |
116 | - if((!isset($data['noinstall']) or $data['noinstall']==false)) { |
|
117 | - self::includeAppScript($basedir . '/appinfo/install.php'); |
|
116 | + if ((!isset($data['noinstall']) or $data['noinstall'] == false)) { |
|
117 | + self::includeAppScript($basedir.'/appinfo/install.php'); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | $appData = OC_App::getAppInfo($appId); |
@@ -125,10 +125,10 @@ discard block |
||
125 | 125 | \OC::$server->getConfig()->setAppValue($info['id'], 'enabled', 'no'); |
126 | 126 | |
127 | 127 | //set remote/public handlers |
128 | - foreach($info['remote'] as $name=>$path) { |
|
128 | + foreach ($info['remote'] as $name=>$path) { |
|
129 | 129 | \OC::$server->getConfig()->setAppValue('core', 'remote_'.$name, $info['id'].'/'.$path); |
130 | 130 | } |
131 | - foreach($info['public'] as $name=>$path) { |
|
131 | + foreach ($info['public'] as $name=>$path) { |
|
132 | 132 | \OC::$server->getConfig()->setAppValue('core', 'public_'.$name, $info['id'].'/'.$path); |
133 | 133 | } |
134 | 134 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | * |
145 | 145 | * Checks whether or not an app is installed, i.e. registered in apps table. |
146 | 146 | */ |
147 | - public static function isInstalled( $app ) { |
|
147 | + public static function isInstalled($app) { |
|
148 | 148 | return (\OC::$server->getConfig()->getAppValue($app, "installed_version", null) !== null); |
149 | 149 | } |
150 | 150 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | * @return bool |
156 | 156 | */ |
157 | 157 | public function updateAppstoreApp($appId) { |
158 | - if(self::isUpdateAvailable($appId, $this->appFetcher)) { |
|
158 | + if (self::isUpdateAvailable($appId, $this->appFetcher)) { |
|
159 | 159 | try { |
160 | 160 | $this->downloadApp($appId); |
161 | 161 | } catch (\Exception $e) { |
@@ -179,18 +179,18 @@ discard block |
||
179 | 179 | $appId = strtolower($appId); |
180 | 180 | |
181 | 181 | $apps = $this->appFetcher->get(); |
182 | - foreach($apps as $app) { |
|
183 | - if($app['id'] === $appId) { |
|
182 | + foreach ($apps as $app) { |
|
183 | + if ($app['id'] === $appId) { |
|
184 | 184 | // Load the certificate |
185 | 185 | $certificate = new X509(); |
186 | - $certificate->loadCA(file_get_contents(__DIR__ . '/../../resources/codesigning/root.crt')); |
|
186 | + $certificate->loadCA(file_get_contents(__DIR__.'/../../resources/codesigning/root.crt')); |
|
187 | 187 | $loadedCertificate = $certificate->loadX509($app['certificate']); |
188 | 188 | |
189 | 189 | // Verify if the certificate has been revoked |
190 | 190 | $crl = new X509(); |
191 | - $crl->loadCA(file_get_contents(__DIR__ . '/../../resources/codesigning/root.crt')); |
|
192 | - $crl->loadCRL(file_get_contents(__DIR__ . '/../../resources/codesigning/root.crl')); |
|
193 | - if($crl->validateSignature() !== true) { |
|
191 | + $crl->loadCA(file_get_contents(__DIR__.'/../../resources/codesigning/root.crt')); |
|
192 | + $crl->loadCRL(file_get_contents(__DIR__.'/../../resources/codesigning/root.crl')); |
|
193 | + if ($crl->validateSignature() !== true) { |
|
194 | 194 | throw new \Exception('Could not validate CRL signature'); |
195 | 195 | } |
196 | 196 | $csn = $loadedCertificate['tbsCertificate']['serialNumber']->toString(); |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | } |
206 | 206 | |
207 | 207 | // Verify if the certificate has been issued by the Nextcloud Code Authority CA |
208 | - if($certificate->validateSignature() !== true) { |
|
208 | + if ($certificate->validateSignature() !== true) { |
|
209 | 209 | throw new \Exception( |
210 | 210 | sprintf( |
211 | 211 | 'App with id %s has a certificate not issued by a trusted Code Signing Authority', |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | |
217 | 217 | // Verify if the certificate is issued for the requested app id |
218 | 218 | $certInfo = openssl_x509_parse($app['certificate']); |
219 | - if(!isset($certInfo['subject']['CN'])) { |
|
219 | + if (!isset($certInfo['subject']['CN'])) { |
|
220 | 220 | throw new \Exception( |
221 | 221 | sprintf( |
222 | 222 | 'App with id %s has a cert with no CN', |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | ) |
225 | 225 | ); |
226 | 226 | } |
227 | - if($certInfo['subject']['CN'] !== $appId) { |
|
227 | + if ($certInfo['subject']['CN'] !== $appId) { |
|
228 | 228 | throw new \Exception( |
229 | 229 | sprintf( |
230 | 230 | 'App with id %s has a cert issued to %s', |
@@ -241,21 +241,21 @@ discard block |
||
241 | 241 | |
242 | 242 | // Check if the signature actually matches the downloaded content |
243 | 243 | $certificate = openssl_get_publickey($app['certificate']); |
244 | - $verified = (bool)openssl_verify(file_get_contents($tempFile), base64_decode($app['releases'][0]['signature']), $certificate, OPENSSL_ALGO_SHA512); |
|
244 | + $verified = (bool) openssl_verify(file_get_contents($tempFile), base64_decode($app['releases'][0]['signature']), $certificate, OPENSSL_ALGO_SHA512); |
|
245 | 245 | openssl_free_key($certificate); |
246 | 246 | |
247 | - if($verified === true) { |
|
247 | + if ($verified === true) { |
|
248 | 248 | // Seems to match, let's proceed |
249 | 249 | $extractDir = $this->tempManager->getTemporaryFolder(); |
250 | 250 | $archive = new TAR($tempFile); |
251 | 251 | |
252 | - if($archive) { |
|
252 | + if ($archive) { |
|
253 | 253 | $archive->extract($extractDir); |
254 | 254 | $allFiles = scandir($extractDir); |
255 | 255 | $folders = array_diff($allFiles, ['.', '..']); |
256 | 256 | $folders = array_values($folders); |
257 | 257 | |
258 | - if(count($folders) > 1) { |
|
258 | + if (count($folders) > 1) { |
|
259 | 259 | throw new \Exception( |
260 | 260 | sprintf( |
261 | 261 | 'Extracted app %s has more than 1 folder', |
@@ -266,22 +266,22 @@ discard block |
||
266 | 266 | |
267 | 267 | // Check if appinfo/info.xml has the same app ID as well |
268 | 268 | $loadEntities = libxml_disable_entity_loader(false); |
269 | - $xml = simplexml_load_file($extractDir . '/' . $folders[0] . '/appinfo/info.xml'); |
|
269 | + $xml = simplexml_load_file($extractDir.'/'.$folders[0].'/appinfo/info.xml'); |
|
270 | 270 | libxml_disable_entity_loader($loadEntities); |
271 | - if((string)$xml->id !== $appId) { |
|
271 | + if ((string) $xml->id !== $appId) { |
|
272 | 272 | throw new \Exception( |
273 | 273 | sprintf( |
274 | 274 | 'App for id %s has a wrong app ID in info.xml: %s', |
275 | 275 | $appId, |
276 | - (string)$xml->id |
|
276 | + (string) $xml->id |
|
277 | 277 | ) |
278 | 278 | ); |
279 | 279 | } |
280 | 280 | |
281 | 281 | // Check if the version is lower than before |
282 | 282 | $currentVersion = OC_App::getAppVersion($appId); |
283 | - $newVersion = (string)$xml->version; |
|
284 | - if(version_compare($currentVersion, $newVersion) === 1) { |
|
283 | + $newVersion = (string) $xml->version; |
|
284 | + if (version_compare($currentVersion, $newVersion) === 1) { |
|
285 | 285 | throw new \Exception( |
286 | 286 | sprintf( |
287 | 287 | 'App for id %s has version %s and tried to update to lower version %s', |
@@ -292,12 +292,12 @@ discard block |
||
292 | 292 | ); |
293 | 293 | } |
294 | 294 | |
295 | - $baseDir = OC_App::getInstallPath() . '/' . $appId; |
|
295 | + $baseDir = OC_App::getInstallPath().'/'.$appId; |
|
296 | 296 | // Remove old app with the ID if existent |
297 | 297 | OC_Helper::rmdirr($baseDir); |
298 | 298 | // Move to app folder |
299 | - if(@mkdir($baseDir)) { |
|
300 | - $extractDir .= '/' . $folders[0]; |
|
299 | + if (@mkdir($baseDir)) { |
|
300 | + $extractDir .= '/'.$folders[0]; |
|
301 | 301 | OC_Helper::copyr($extractDir, $baseDir); |
302 | 302 | } |
303 | 303 | OC_Helper::copyr($extractDir, $baseDir); |
@@ -357,8 +357,8 @@ discard block |
||
357 | 357 | } |
358 | 358 | |
359 | 359 | $apps = $appFetcher->get(); |
360 | - foreach($apps as $app) { |
|
361 | - if($app['id'] === $appId) { |
|
360 | + foreach ($apps as $app) { |
|
361 | + if ($app['id'] === $appId) { |
|
362 | 362 | $currentVersion = OC_App::getAppVersion($appId); |
363 | 363 | $newestVersion = $app['releases'][0]['version']; |
364 | 364 | if (version_compare($newestVersion, $currentVersion, '>')) { |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | * The function will check if the app is already downloaded in the apps repository |
381 | 381 | */ |
382 | 382 | public function isDownloaded($name) { |
383 | - foreach(\OC::$APPSROOTS as $dir) { |
|
383 | + foreach (\OC::$APPSROOTS as $dir) { |
|
384 | 384 | $dirToTest = $dir['path']; |
385 | 385 | $dirToTest .= '/'; |
386 | 386 | $dirToTest .= $name; |
@@ -408,11 +408,11 @@ discard block |
||
408 | 408 | * this has to be done by the function oc_app_uninstall(). |
409 | 409 | */ |
410 | 410 | public function removeApp($appId) { |
411 | - if($this->isDownloaded( $appId )) { |
|
412 | - $appDir = OC_App::getInstallPath() . '/' . $appId; |
|
411 | + if ($this->isDownloaded($appId)) { |
|
412 | + $appDir = OC_App::getInstallPath().'/'.$appId; |
|
413 | 413 | OC_Helper::rmdirr($appDir); |
414 | 414 | return true; |
415 | - }else{ |
|
415 | + } else { |
|
416 | 416 | \OCP\Util::writeLog('core', 'can\'t remove app '.$appId.'. It is not installed.', \OCP\Util::ERROR); |
417 | 417 | |
418 | 418 | return false; |
@@ -430,13 +430,13 @@ discard block |
||
430 | 430 | */ |
431 | 431 | public static function installShippedApps($softErrors = false) { |
432 | 432 | $errors = []; |
433 | - foreach(\OC::$APPSROOTS as $app_dir) { |
|
434 | - if($dir = opendir( $app_dir['path'] )) { |
|
435 | - while( false !== ( $filename = readdir( $dir ))) { |
|
436 | - if( substr( $filename, 0, 1 ) != '.' and is_dir($app_dir['path']."/$filename") ) { |
|
437 | - if( file_exists( $app_dir['path']."/$filename/appinfo/info.xml" )) { |
|
438 | - if(!Installer::isInstalled($filename)) { |
|
439 | - $info=OC_App::getAppInfo($filename); |
|
433 | + foreach (\OC::$APPSROOTS as $app_dir) { |
|
434 | + if ($dir = opendir($app_dir['path'])) { |
|
435 | + while (false !== ($filename = readdir($dir))) { |
|
436 | + if (substr($filename, 0, 1) != '.' and is_dir($app_dir['path']."/$filename")) { |
|
437 | + if (file_exists($app_dir['path']."/$filename/appinfo/info.xml")) { |
|
438 | + if (!Installer::isInstalled($filename)) { |
|
439 | + $info = OC_App::getAppInfo($filename); |
|
440 | 440 | $enabled = isset($info['default_enable']); |
441 | 441 | if (($enabled || in_array($filename, \OC::$server->getAppManager()->getAlwaysEnabledApps())) |
442 | 442 | && \OC::$server->getConfig()->getAppValue($filename, 'enabled') !== 'no') { |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | } |
460 | 460 | } |
461 | 461 | } |
462 | - closedir( $dir ); |
|
462 | + closedir($dir); |
|
463 | 463 | } |
464 | 464 | } |
465 | 465 | |
@@ -474,12 +474,12 @@ discard block |
||
474 | 474 | public static function installShippedApp($app) { |
475 | 475 | //install the database |
476 | 476 | $appPath = OC_App::getAppPath($app); |
477 | - if(is_file("$appPath/appinfo/database.xml")) { |
|
477 | + if (is_file("$appPath/appinfo/database.xml")) { |
|
478 | 478 | try { |
479 | 479 | OC_DB::createDbFromStructure("$appPath/appinfo/database.xml"); |
480 | 480 | } catch (TableExistsException $e) { |
481 | 481 | throw new HintException( |
482 | - 'Failed to enable app ' . $app, |
|
482 | + 'Failed to enable app '.$app, |
|
483 | 483 | 'Please ask for help via one of our <a href="https://nextcloud.com/support/" target="_blank" rel="noreferrer">support channels</a>.', |
484 | 484 | 0, $e |
485 | 485 | ); |
@@ -506,16 +506,16 @@ discard block |
||
506 | 506 | } |
507 | 507 | |
508 | 508 | //set remote/public handlers |
509 | - foreach($info['remote'] as $name=>$path) { |
|
509 | + foreach ($info['remote'] as $name=>$path) { |
|
510 | 510 | $config->setAppValue('core', 'remote_'.$name, $app.'/'.$path); |
511 | 511 | } |
512 | - foreach($info['public'] as $name=>$path) { |
|
512 | + foreach ($info['public'] as $name=>$path) { |
|
513 | 513 | $config->setAppValue('core', 'public_'.$name, $app.'/'.$path); |
514 | 514 | } |
515 | 515 | |
516 | 516 | OC_App::setAppTypes($info['id']); |
517 | 517 | |
518 | - if(isset($info['settings']) && is_array($info['settings'])) { |
|
518 | + if (isset($info['settings']) && is_array($info['settings'])) { |
|
519 | 519 | // requires that autoloading was registered for the app, |
520 | 520 | // as happens before running the install.php some lines above |
521 | 521 | \OC::$server->getSettingsManager()->setupSettings($info['settings']); |
@@ -531,7 +531,7 @@ discard block |
||
531 | 531 | */ |
532 | 532 | public static function checkCode($folder) { |
533 | 533 | // is the code checker enabled? |
534 | - if(!\OC::$server->getConfig()->getSystemValue('appcodechecker', false)) { |
|
534 | + if (!\OC::$server->getConfig()->getSystemValue('appcodechecker', false)) { |
|
535 | 535 | return true; |
536 | 536 | } |
537 | 537 | |
@@ -545,7 +545,7 @@ discard block |
||
545 | 545 | * @param string $script |
546 | 546 | */ |
547 | 547 | private static function includeAppScript($script) { |
548 | - if ( file_exists($script) ){ |
|
548 | + if (file_exists($script)) { |
|
549 | 549 | include $script; |
550 | 550 | } |
551 | 551 | } |