@@ -40,187 +40,187 @@ |
||
| 40 | 40 | use OCP\ILogger; |
| 41 | 41 | |
| 42 | 42 | abstract class Fetcher { |
| 43 | - const INVALIDATE_AFTER_SECONDS = 300; |
|
| 44 | - |
|
| 45 | - /** @var IAppData */ |
|
| 46 | - protected $appData; |
|
| 47 | - /** @var IClientService */ |
|
| 48 | - protected $clientService; |
|
| 49 | - /** @var ITimeFactory */ |
|
| 50 | - protected $timeFactory; |
|
| 51 | - /** @var IConfig */ |
|
| 52 | - protected $config; |
|
| 53 | - /** @var Ilogger */ |
|
| 54 | - protected $logger; |
|
| 55 | - /** @var string */ |
|
| 56 | - protected $fileName; |
|
| 57 | - /** @var string */ |
|
| 58 | - protected $endpointName; |
|
| 59 | - /** @var string */ |
|
| 60 | - protected $version; |
|
| 61 | - /** @var string */ |
|
| 62 | - protected $channel; |
|
| 63 | - |
|
| 64 | - /** |
|
| 65 | - * @param Factory $appDataFactory |
|
| 66 | - * @param IClientService $clientService |
|
| 67 | - * @param ITimeFactory $timeFactory |
|
| 68 | - * @param IConfig $config |
|
| 69 | - * @param ILogger $logger |
|
| 70 | - */ |
|
| 71 | - public function __construct(Factory $appDataFactory, |
|
| 72 | - IClientService $clientService, |
|
| 73 | - ITimeFactory $timeFactory, |
|
| 74 | - IConfig $config, |
|
| 75 | - ILogger $logger) { |
|
| 76 | - $this->appData = $appDataFactory->get('appstore'); |
|
| 77 | - $this->clientService = $clientService; |
|
| 78 | - $this->timeFactory = $timeFactory; |
|
| 79 | - $this->config = $config; |
|
| 80 | - $this->logger = $logger; |
|
| 81 | - } |
|
| 82 | - |
|
| 83 | - /** |
|
| 84 | - * Fetches the response from the server |
|
| 85 | - * |
|
| 86 | - * @param string $ETag |
|
| 87 | - * @param string $content |
|
| 88 | - * |
|
| 89 | - * @return array |
|
| 90 | - */ |
|
| 91 | - protected function fetch($ETag, $content) { |
|
| 92 | - $appstoreenabled = $this->config->getSystemValue('appstoreenabled', true); |
|
| 93 | - |
|
| 94 | - if (!$appstoreenabled) { |
|
| 95 | - return []; |
|
| 96 | - } |
|
| 97 | - |
|
| 98 | - $options = [ |
|
| 99 | - 'timeout' => 10, |
|
| 100 | - ]; |
|
| 101 | - |
|
| 102 | - if ($ETag !== '') { |
|
| 103 | - $options['headers'] = [ |
|
| 104 | - 'If-None-Match' => $ETag, |
|
| 105 | - ]; |
|
| 106 | - } |
|
| 107 | - |
|
| 108 | - $client = $this->clientService->newClient(); |
|
| 109 | - $response = $client->get($this->getEndpoint(), $options); |
|
| 110 | - |
|
| 111 | - $responseJson = []; |
|
| 112 | - if ($response->getStatusCode() === Http::STATUS_NOT_MODIFIED) { |
|
| 113 | - $responseJson['data'] = json_decode($content, true); |
|
| 114 | - } else { |
|
| 115 | - $responseJson['data'] = json_decode($response->getBody(), true); |
|
| 116 | - $ETag = $response->getHeader('ETag'); |
|
| 117 | - } |
|
| 118 | - |
|
| 119 | - $responseJson['timestamp'] = $this->timeFactory->getTime(); |
|
| 120 | - $responseJson['ncversion'] = $this->getVersion(); |
|
| 121 | - if ($ETag !== '') { |
|
| 122 | - $responseJson['ETag'] = $ETag; |
|
| 123 | - } |
|
| 124 | - |
|
| 125 | - return $responseJson; |
|
| 126 | - } |
|
| 127 | - |
|
| 128 | - /** |
|
| 129 | - * Returns the array with the categories on the appstore server |
|
| 130 | - * |
|
| 131 | - * @return array |
|
| 132 | - */ |
|
| 133 | - public function get() { |
|
| 134 | - $appstoreenabled = $this->config->getSystemValue('appstoreenabled', true); |
|
| 135 | - $internetavailable = $this->config->getSystemValue('has_internet_connection', true); |
|
| 136 | - |
|
| 137 | - if (!$appstoreenabled || !$internetavailable) { |
|
| 138 | - return []; |
|
| 139 | - } |
|
| 140 | - |
|
| 141 | - $rootFolder = $this->appData->getFolder('/'); |
|
| 142 | - |
|
| 143 | - $ETag = ''; |
|
| 144 | - $content = ''; |
|
| 145 | - |
|
| 146 | - try { |
|
| 147 | - // File does already exists |
|
| 148 | - $file = $rootFolder->getFile($this->fileName); |
|
| 149 | - $jsonBlob = json_decode($file->getContent(), true); |
|
| 150 | - if (is_array($jsonBlob)) { |
|
| 151 | - |
|
| 152 | - // No caching when the version has been updated |
|
| 153 | - if (isset($jsonBlob['ncversion']) && $jsonBlob['ncversion'] === $this->getVersion()) { |
|
| 154 | - |
|
| 155 | - // If the timestamp is older than 300 seconds request the files new |
|
| 156 | - if ((int)$jsonBlob['timestamp'] > ($this->timeFactory->getTime() - self::INVALIDATE_AFTER_SECONDS)) { |
|
| 157 | - return $jsonBlob['data']; |
|
| 158 | - } |
|
| 159 | - |
|
| 160 | - if (isset($jsonBlob['ETag'])) { |
|
| 161 | - $ETag = $jsonBlob['ETag']; |
|
| 162 | - $content = json_encode($jsonBlob['data']); |
|
| 163 | - } |
|
| 164 | - } |
|
| 165 | - } |
|
| 166 | - } catch (NotFoundException $e) { |
|
| 167 | - // File does not already exists |
|
| 168 | - $file = $rootFolder->newFile($this->fileName); |
|
| 169 | - } |
|
| 170 | - |
|
| 171 | - // Refresh the file content |
|
| 172 | - try { |
|
| 173 | - $responseJson = $this->fetch($ETag, $content); |
|
| 174 | - $file->putContent(json_encode($responseJson)); |
|
| 175 | - return json_decode($file->getContent(), true)['data']; |
|
| 176 | - } catch (ConnectException $e) { |
|
| 177 | - $this->logger->warning('Could not connect to appstore: ' . $e->getMessage(), ['app' => 'appstoreFetcher']); |
|
| 178 | - return []; |
|
| 179 | - } catch (\Exception $e) { |
|
| 180 | - $this->logger->logException($e, ['app' => 'appstoreFetcher', 'level' => ILogger::WARN]); |
|
| 181 | - return []; |
|
| 182 | - } |
|
| 183 | - } |
|
| 184 | - |
|
| 185 | - /** |
|
| 186 | - * Get the currently Nextcloud version |
|
| 187 | - * @return string |
|
| 188 | - */ |
|
| 189 | - protected function getVersion() { |
|
| 190 | - if ($this->version === null) { |
|
| 191 | - $this->version = $this->config->getSystemValue('version', '0.0.0'); |
|
| 192 | - } |
|
| 193 | - return $this->version; |
|
| 194 | - } |
|
| 195 | - |
|
| 196 | - /** |
|
| 197 | - * Set the current Nextcloud version |
|
| 198 | - * @param string $version |
|
| 199 | - */ |
|
| 200 | - public function setVersion(string $version) { |
|
| 201 | - $this->version = $version; |
|
| 202 | - } |
|
| 203 | - |
|
| 204 | - /** |
|
| 205 | - * Get the currently Nextcloud update channel |
|
| 206 | - * @return string |
|
| 207 | - */ |
|
| 208 | - protected function getChannel() { |
|
| 209 | - if ($this->channel === null) { |
|
| 210 | - $this->channel = \OC_Util::getChannel(); |
|
| 211 | - } |
|
| 212 | - return $this->channel; |
|
| 213 | - } |
|
| 214 | - |
|
| 215 | - /** |
|
| 216 | - * Set the current Nextcloud update channel |
|
| 217 | - * @param string $channel |
|
| 218 | - */ |
|
| 219 | - public function setChannel(string $channel) { |
|
| 220 | - $this->channel = $channel; |
|
| 221 | - } |
|
| 222 | - |
|
| 223 | - protected function getEndpoint(): string { |
|
| 224 | - return $this->config->getSystemValue('appstoreurl', 'https://apps.nextcloud.com/api/v1') . '/' . $this->endpointName; |
|
| 225 | - } |
|
| 43 | + const INVALIDATE_AFTER_SECONDS = 300; |
|
| 44 | + |
|
| 45 | + /** @var IAppData */ |
|
| 46 | + protected $appData; |
|
| 47 | + /** @var IClientService */ |
|
| 48 | + protected $clientService; |
|
| 49 | + /** @var ITimeFactory */ |
|
| 50 | + protected $timeFactory; |
|
| 51 | + /** @var IConfig */ |
|
| 52 | + protected $config; |
|
| 53 | + /** @var Ilogger */ |
|
| 54 | + protected $logger; |
|
| 55 | + /** @var string */ |
|
| 56 | + protected $fileName; |
|
| 57 | + /** @var string */ |
|
| 58 | + protected $endpointName; |
|
| 59 | + /** @var string */ |
|
| 60 | + protected $version; |
|
| 61 | + /** @var string */ |
|
| 62 | + protected $channel; |
|
| 63 | + |
|
| 64 | + /** |
|
| 65 | + * @param Factory $appDataFactory |
|
| 66 | + * @param IClientService $clientService |
|
| 67 | + * @param ITimeFactory $timeFactory |
|
| 68 | + * @param IConfig $config |
|
| 69 | + * @param ILogger $logger |
|
| 70 | + */ |
|
| 71 | + public function __construct(Factory $appDataFactory, |
|
| 72 | + IClientService $clientService, |
|
| 73 | + ITimeFactory $timeFactory, |
|
| 74 | + IConfig $config, |
|
| 75 | + ILogger $logger) { |
|
| 76 | + $this->appData = $appDataFactory->get('appstore'); |
|
| 77 | + $this->clientService = $clientService; |
|
| 78 | + $this->timeFactory = $timeFactory; |
|
| 79 | + $this->config = $config; |
|
| 80 | + $this->logger = $logger; |
|
| 81 | + } |
|
| 82 | + |
|
| 83 | + /** |
|
| 84 | + * Fetches the response from the server |
|
| 85 | + * |
|
| 86 | + * @param string $ETag |
|
| 87 | + * @param string $content |
|
| 88 | + * |
|
| 89 | + * @return array |
|
| 90 | + */ |
|
| 91 | + protected function fetch($ETag, $content) { |
|
| 92 | + $appstoreenabled = $this->config->getSystemValue('appstoreenabled', true); |
|
| 93 | + |
|
| 94 | + if (!$appstoreenabled) { |
|
| 95 | + return []; |
|
| 96 | + } |
|
| 97 | + |
|
| 98 | + $options = [ |
|
| 99 | + 'timeout' => 10, |
|
| 100 | + ]; |
|
| 101 | + |
|
| 102 | + if ($ETag !== '') { |
|
| 103 | + $options['headers'] = [ |
|
| 104 | + 'If-None-Match' => $ETag, |
|
| 105 | + ]; |
|
| 106 | + } |
|
| 107 | + |
|
| 108 | + $client = $this->clientService->newClient(); |
|
| 109 | + $response = $client->get($this->getEndpoint(), $options); |
|
| 110 | + |
|
| 111 | + $responseJson = []; |
|
| 112 | + if ($response->getStatusCode() === Http::STATUS_NOT_MODIFIED) { |
|
| 113 | + $responseJson['data'] = json_decode($content, true); |
|
| 114 | + } else { |
|
| 115 | + $responseJson['data'] = json_decode($response->getBody(), true); |
|
| 116 | + $ETag = $response->getHeader('ETag'); |
|
| 117 | + } |
|
| 118 | + |
|
| 119 | + $responseJson['timestamp'] = $this->timeFactory->getTime(); |
|
| 120 | + $responseJson['ncversion'] = $this->getVersion(); |
|
| 121 | + if ($ETag !== '') { |
|
| 122 | + $responseJson['ETag'] = $ETag; |
|
| 123 | + } |
|
| 124 | + |
|
| 125 | + return $responseJson; |
|
| 126 | + } |
|
| 127 | + |
|
| 128 | + /** |
|
| 129 | + * Returns the array with the categories on the appstore server |
|
| 130 | + * |
|
| 131 | + * @return array |
|
| 132 | + */ |
|
| 133 | + public function get() { |
|
| 134 | + $appstoreenabled = $this->config->getSystemValue('appstoreenabled', true); |
|
| 135 | + $internetavailable = $this->config->getSystemValue('has_internet_connection', true); |
|
| 136 | + |
|
| 137 | + if (!$appstoreenabled || !$internetavailable) { |
|
| 138 | + return []; |
|
| 139 | + } |
|
| 140 | + |
|
| 141 | + $rootFolder = $this->appData->getFolder('/'); |
|
| 142 | + |
|
| 143 | + $ETag = ''; |
|
| 144 | + $content = ''; |
|
| 145 | + |
|
| 146 | + try { |
|
| 147 | + // File does already exists |
|
| 148 | + $file = $rootFolder->getFile($this->fileName); |
|
| 149 | + $jsonBlob = json_decode($file->getContent(), true); |
|
| 150 | + if (is_array($jsonBlob)) { |
|
| 151 | + |
|
| 152 | + // No caching when the version has been updated |
|
| 153 | + if (isset($jsonBlob['ncversion']) && $jsonBlob['ncversion'] === $this->getVersion()) { |
|
| 154 | + |
|
| 155 | + // If the timestamp is older than 300 seconds request the files new |
|
| 156 | + if ((int)$jsonBlob['timestamp'] > ($this->timeFactory->getTime() - self::INVALIDATE_AFTER_SECONDS)) { |
|
| 157 | + return $jsonBlob['data']; |
|
| 158 | + } |
|
| 159 | + |
|
| 160 | + if (isset($jsonBlob['ETag'])) { |
|
| 161 | + $ETag = $jsonBlob['ETag']; |
|
| 162 | + $content = json_encode($jsonBlob['data']); |
|
| 163 | + } |
|
| 164 | + } |
|
| 165 | + } |
|
| 166 | + } catch (NotFoundException $e) { |
|
| 167 | + // File does not already exists |
|
| 168 | + $file = $rootFolder->newFile($this->fileName); |
|
| 169 | + } |
|
| 170 | + |
|
| 171 | + // Refresh the file content |
|
| 172 | + try { |
|
| 173 | + $responseJson = $this->fetch($ETag, $content); |
|
| 174 | + $file->putContent(json_encode($responseJson)); |
|
| 175 | + return json_decode($file->getContent(), true)['data']; |
|
| 176 | + } catch (ConnectException $e) { |
|
| 177 | + $this->logger->warning('Could not connect to appstore: ' . $e->getMessage(), ['app' => 'appstoreFetcher']); |
|
| 178 | + return []; |
|
| 179 | + } catch (\Exception $e) { |
|
| 180 | + $this->logger->logException($e, ['app' => 'appstoreFetcher', 'level' => ILogger::WARN]); |
|
| 181 | + return []; |
|
| 182 | + } |
|
| 183 | + } |
|
| 184 | + |
|
| 185 | + /** |
|
| 186 | + * Get the currently Nextcloud version |
|
| 187 | + * @return string |
|
| 188 | + */ |
|
| 189 | + protected function getVersion() { |
|
| 190 | + if ($this->version === null) { |
|
| 191 | + $this->version = $this->config->getSystemValue('version', '0.0.0'); |
|
| 192 | + } |
|
| 193 | + return $this->version; |
|
| 194 | + } |
|
| 195 | + |
|
| 196 | + /** |
|
| 197 | + * Set the current Nextcloud version |
|
| 198 | + * @param string $version |
|
| 199 | + */ |
|
| 200 | + public function setVersion(string $version) { |
|
| 201 | + $this->version = $version; |
|
| 202 | + } |
|
| 203 | + |
|
| 204 | + /** |
|
| 205 | + * Get the currently Nextcloud update channel |
|
| 206 | + * @return string |
|
| 207 | + */ |
|
| 208 | + protected function getChannel() { |
|
| 209 | + if ($this->channel === null) { |
|
| 210 | + $this->channel = \OC_Util::getChannel(); |
|
| 211 | + } |
|
| 212 | + return $this->channel; |
|
| 213 | + } |
|
| 214 | + |
|
| 215 | + /** |
|
| 216 | + * Set the current Nextcloud update channel |
|
| 217 | + * @param string $channel |
|
| 218 | + */ |
|
| 219 | + public function setChannel(string $channel) { |
|
| 220 | + $this->channel = $channel; |
|
| 221 | + } |
|
| 222 | + |
|
| 223 | + protected function getEndpoint(): string { |
|
| 224 | + return $this->config->getSystemValue('appstoreurl', 'https://apps.nextcloud.com/api/v1') . '/' . $this->endpointName; |
|
| 225 | + } |
|
| 226 | 226 | } |
@@ -28,46 +28,46 @@ |
||
| 28 | 28 | |
| 29 | 29 | |
| 30 | 30 | class AdapterPgSql extends Adapter { |
| 31 | - protected $compatModePre9_5 = null; |
|
| 31 | + protected $compatModePre9_5 = null; |
|
| 32 | 32 | |
| 33 | - public function lastInsertId($table) { |
|
| 34 | - return $this->conn->fetchColumn('SELECT lastval()'); |
|
| 35 | - } |
|
| 33 | + public function lastInsertId($table) { |
|
| 34 | + return $this->conn->fetchColumn('SELECT lastval()'); |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | - const UNIX_TIMESTAMP_REPLACEMENT = 'cast(extract(epoch from current_timestamp) as integer)'; |
|
| 38 | - public function fixupStatement($statement) { |
|
| 39 | - $statement = str_replace( '`', '"', $statement ); |
|
| 40 | - $statement = str_ireplace( 'UNIX_TIMESTAMP()', self::UNIX_TIMESTAMP_REPLACEMENT, $statement ); |
|
| 41 | - return $statement; |
|
| 42 | - } |
|
| 37 | + const UNIX_TIMESTAMP_REPLACEMENT = 'cast(extract(epoch from current_timestamp) as integer)'; |
|
| 38 | + public function fixupStatement($statement) { |
|
| 39 | + $statement = str_replace( '`', '"', $statement ); |
|
| 40 | + $statement = str_ireplace( 'UNIX_TIMESTAMP()', self::UNIX_TIMESTAMP_REPLACEMENT, $statement ); |
|
| 41 | + return $statement; |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * @suppress SqlInjectionChecker |
|
| 46 | - */ |
|
| 47 | - public function insertIgnoreConflict(string $table,array $values) : int { |
|
| 48 | - if($this->isPre9_5CompatMode() === true) { |
|
| 49 | - return parent::insertIgnoreConflict($table, $values); |
|
| 50 | - } |
|
| 44 | + /** |
|
| 45 | + * @suppress SqlInjectionChecker |
|
| 46 | + */ |
|
| 47 | + public function insertIgnoreConflict(string $table,array $values) : int { |
|
| 48 | + if($this->isPre9_5CompatMode() === true) { |
|
| 49 | + return parent::insertIgnoreConflict($table, $values); |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - // "upsert" is only available since PgSQL 9.5, but the generic way |
|
| 53 | - // would leave error logs in the DB. |
|
| 54 | - $builder = $this->conn->getQueryBuilder(); |
|
| 55 | - $builder->insert($table); |
|
| 56 | - foreach ($values as $key => $value) { |
|
| 57 | - $builder->setValue($key, $builder->createNamedParameter($value)); |
|
| 58 | - } |
|
| 59 | - $queryString = $builder->getSQL() . ' ON CONFLICT DO NOTHING'; |
|
| 60 | - return $this->conn->executeUpdate($queryString, $builder->getParameters(), $builder->getParameterTypes()); |
|
| 61 | - } |
|
| 52 | + // "upsert" is only available since PgSQL 9.5, but the generic way |
|
| 53 | + // would leave error logs in the DB. |
|
| 54 | + $builder = $this->conn->getQueryBuilder(); |
|
| 55 | + $builder->insert($table); |
|
| 56 | + foreach ($values as $key => $value) { |
|
| 57 | + $builder->setValue($key, $builder->createNamedParameter($value)); |
|
| 58 | + } |
|
| 59 | + $queryString = $builder->getSQL() . ' ON CONFLICT DO NOTHING'; |
|
| 60 | + return $this->conn->executeUpdate($queryString, $builder->getParameters(), $builder->getParameterTypes()); |
|
| 61 | + } |
|
| 62 | 62 | |
| 63 | - protected function isPre9_5CompatMode(): bool { |
|
| 64 | - if($this->compatModePre9_5 !== null) { |
|
| 65 | - return $this->compatModePre9_5; |
|
| 66 | - } |
|
| 63 | + protected function isPre9_5CompatMode(): bool { |
|
| 64 | + if($this->compatModePre9_5 !== null) { |
|
| 65 | + return $this->compatModePre9_5; |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - $version = $this->conn->fetchColumn('SHOW SERVER_VERSION'); |
|
| 69 | - $this->compatModePre9_5 = version_compare($version, '9.5', '<'); |
|
| 68 | + $version = $this->conn->fetchColumn('SHOW SERVER_VERSION'); |
|
| 69 | + $this->compatModePre9_5 = version_compare($version, '9.5', '<'); |
|
| 70 | 70 | |
| 71 | - return $this->compatModePre9_5; |
|
| 72 | - } |
|
| 71 | + return $this->compatModePre9_5; |
|
| 72 | + } |
|
| 73 | 73 | } |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | use OCP\AppFramework\Http\DataResponse; |
| 29 | 29 | use OCP\AppFramework\Http\Response; |
| 30 | 30 | |
| 31 | -abstract class BaseResponse extends Response { |
|
| 31 | +abstract class BaseResponse extends Response { |
|
| 32 | 32 | /** @var array */ |
| 33 | 33 | protected $data; |
| 34 | 34 | |
@@ -35,28 +35,28 @@ |
||
| 35 | 35 | * This property contains multiple "sharee" elements, each containing a share sharee |
| 36 | 36 | */ |
| 37 | 37 | class ShareeList implements XmlSerializable { |
| 38 | - const NS_NEXTCLOUD = 'http://nextcloud.org/ns'; |
|
| 39 | - |
|
| 40 | - /** @var IShare[] */ |
|
| 41 | - private $shares; |
|
| 42 | - |
|
| 43 | - public function __construct(array $shares) { |
|
| 44 | - $this->shares = $shares; |
|
| 45 | - } |
|
| 46 | - |
|
| 47 | - /** |
|
| 48 | - * The xmlSerialize metod is called during xml writing. |
|
| 49 | - * |
|
| 50 | - * @param Writer $writer |
|
| 51 | - * @return void |
|
| 52 | - */ |
|
| 53 | - function xmlSerialize(Writer $writer) { |
|
| 54 | - foreach ($this->shares as $share) { |
|
| 55 | - $writer->startElement('{' . self::NS_NEXTCLOUD . '}sharee'); |
|
| 56 | - $writer->writeElement('{' . self::NS_NEXTCLOUD . '}id', $share->getSharedWith()); |
|
| 57 | - $writer->writeElement('{' . self::NS_NEXTCLOUD . '}display-name', $share->getSharedWithDisplayName()); |
|
| 58 | - $writer->writeElement('{' . self::NS_NEXTCLOUD . '}type', $share->getShareType()); |
|
| 59 | - $writer->endElement(); |
|
| 60 | - } |
|
| 61 | - } |
|
| 38 | + const NS_NEXTCLOUD = 'http://nextcloud.org/ns'; |
|
| 39 | + |
|
| 40 | + /** @var IShare[] */ |
|
| 41 | + private $shares; |
|
| 42 | + |
|
| 43 | + public function __construct(array $shares) { |
|
| 44 | + $this->shares = $shares; |
|
| 45 | + } |
|
| 46 | + |
|
| 47 | + /** |
|
| 48 | + * The xmlSerialize metod is called during xml writing. |
|
| 49 | + * |
|
| 50 | + * @param Writer $writer |
|
| 51 | + * @return void |
|
| 52 | + */ |
|
| 53 | + function xmlSerialize(Writer $writer) { |
|
| 54 | + foreach ($this->shares as $share) { |
|
| 55 | + $writer->startElement('{' . self::NS_NEXTCLOUD . '}sharee'); |
|
| 56 | + $writer->writeElement('{' . self::NS_NEXTCLOUD . '}id', $share->getSharedWith()); |
|
| 57 | + $writer->writeElement('{' . self::NS_NEXTCLOUD . '}display-name', $share->getSharedWithDisplayName()); |
|
| 58 | + $writer->writeElement('{' . self::NS_NEXTCLOUD . '}type', $share->getShareType()); |
|
| 59 | + $writer->endElement(); |
|
| 60 | + } |
|
| 61 | + } |
|
| 62 | 62 | } |
@@ -36,64 +36,64 @@ |
||
| 36 | 36 | use OCP\AppFramework\IAppContainer; |
| 37 | 37 | |
| 38 | 38 | class Application extends App { |
| 39 | - public function __construct (array $urlParams = []) { |
|
| 40 | - parent::__construct('files_trashbin', $urlParams); |
|
| 39 | + public function __construct (array $urlParams = []) { |
|
| 40 | + parent::__construct('files_trashbin', $urlParams); |
|
| 41 | 41 | |
| 42 | - $container = $this->getContainer(); |
|
| 43 | - /* |
|
| 42 | + $container = $this->getContainer(); |
|
| 43 | + /* |
|
| 44 | 44 | * Register capabilities |
| 45 | 45 | */ |
| 46 | - $container->registerCapability(Capabilities::class); |
|
| 46 | + $container->registerCapability(Capabilities::class); |
|
| 47 | 47 | |
| 48 | - /* |
|
| 48 | + /* |
|
| 49 | 49 | * Register expiration |
| 50 | 50 | */ |
| 51 | - $container->registerAlias('Expiration', Expiration::class); |
|
| 51 | + $container->registerAlias('Expiration', Expiration::class); |
|
| 52 | 52 | |
| 53 | - /* |
|
| 53 | + /* |
|
| 54 | 54 | * Register $principalBackend for the DAV collection |
| 55 | 55 | */ |
| 56 | - $container->registerService('principalBackend', function () { |
|
| 57 | - return new Principal( |
|
| 58 | - \OC::$server->getUserManager(), |
|
| 59 | - \OC::$server->getGroupManager(), |
|
| 60 | - \OC::$server->getShareManager(), |
|
| 61 | - \OC::$server->getUserSession(), |
|
| 62 | - \OC::$server->getAppManager(), |
|
| 63 | - \OC::$server->query(ProxyMapper::class), |
|
| 64 | - \OC::$server->getConfig() |
|
| 65 | - ); |
|
| 66 | - }); |
|
| 56 | + $container->registerService('principalBackend', function () { |
|
| 57 | + return new Principal( |
|
| 58 | + \OC::$server->getUserManager(), |
|
| 59 | + \OC::$server->getGroupManager(), |
|
| 60 | + \OC::$server->getShareManager(), |
|
| 61 | + \OC::$server->getUserSession(), |
|
| 62 | + \OC::$server->getAppManager(), |
|
| 63 | + \OC::$server->query(ProxyMapper::class), |
|
| 64 | + \OC::$server->getConfig() |
|
| 65 | + ); |
|
| 66 | + }); |
|
| 67 | 67 | |
| 68 | - $container->registerService(ITrashManager::class, function(IAppContainer $c) { |
|
| 69 | - return new TrashManager(); |
|
| 70 | - }); |
|
| 68 | + $container->registerService(ITrashManager::class, function(IAppContainer $c) { |
|
| 69 | + return new TrashManager(); |
|
| 70 | + }); |
|
| 71 | 71 | |
| 72 | - $this->registerTrashBackends(); |
|
| 73 | - } |
|
| 72 | + $this->registerTrashBackends(); |
|
| 73 | + } |
|
| 74 | 74 | |
| 75 | - public function registerTrashBackends() { |
|
| 76 | - $server = $this->getContainer()->getServer(); |
|
| 77 | - $logger = $server->getLogger(); |
|
| 78 | - $appManager = $server->getAppManager(); |
|
| 79 | - /** @var ITrashManager $trashManager */ |
|
| 80 | - $trashManager = $this->getContainer()->getServer()->query(ITrashManager::class); |
|
| 81 | - foreach($appManager->getInstalledApps() as $app) { |
|
| 82 | - $appInfo = $appManager->getAppInfo($app); |
|
| 83 | - if (isset($appInfo['trash'])) { |
|
| 84 | - $backends = $appInfo['trash']; |
|
| 85 | - foreach($backends as $backend) { |
|
| 86 | - $class = $backend['@value']; |
|
| 87 | - $for = $backend['@attributes']['for']; |
|
| 75 | + public function registerTrashBackends() { |
|
| 76 | + $server = $this->getContainer()->getServer(); |
|
| 77 | + $logger = $server->getLogger(); |
|
| 78 | + $appManager = $server->getAppManager(); |
|
| 79 | + /** @var ITrashManager $trashManager */ |
|
| 80 | + $trashManager = $this->getContainer()->getServer()->query(ITrashManager::class); |
|
| 81 | + foreach($appManager->getInstalledApps() as $app) { |
|
| 82 | + $appInfo = $appManager->getAppInfo($app); |
|
| 83 | + if (isset($appInfo['trash'])) { |
|
| 84 | + $backends = $appInfo['trash']; |
|
| 85 | + foreach($backends as $backend) { |
|
| 86 | + $class = $backend['@value']; |
|
| 87 | + $for = $backend['@attributes']['for']; |
|
| 88 | 88 | |
| 89 | - try { |
|
| 90 | - $backendObject = $server->query($class); |
|
| 91 | - $trashManager->registerBackend($for, $backendObject); |
|
| 92 | - } catch (\Exception $e) { |
|
| 93 | - $logger->logException($e); |
|
| 94 | - } |
|
| 95 | - } |
|
| 96 | - } |
|
| 97 | - } |
|
| 98 | - } |
|
| 89 | + try { |
|
| 90 | + $backendObject = $server->query($class); |
|
| 91 | + $trashManager->registerBackend($for, $backendObject); |
|
| 92 | + } catch (\Exception $e) { |
|
| 93 | + $logger->logException($e); |
|
| 94 | + } |
|
| 95 | + } |
|
| 96 | + } |
|
| 97 | + } |
|
| 98 | + } |
|
| 99 | 99 | } |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | use OCP\AppFramework\IAppContainer; |
| 37 | 37 | |
| 38 | 38 | class Application extends App { |
| 39 | - public function __construct (array $urlParams = []) { |
|
| 39 | + public function __construct(array $urlParams = []) { |
|
| 40 | 40 | parent::__construct('files_trashbin', $urlParams); |
| 41 | 41 | |
| 42 | 42 | $container = $this->getContainer(); |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | /* |
| 54 | 54 | * Register $principalBackend for the DAV collection |
| 55 | 55 | */ |
| 56 | - $container->registerService('principalBackend', function () { |
|
| 56 | + $container->registerService('principalBackend', function() { |
|
| 57 | 57 | return new Principal( |
| 58 | 58 | \OC::$server->getUserManager(), |
| 59 | 59 | \OC::$server->getGroupManager(), |
@@ -78,11 +78,11 @@ discard block |
||
| 78 | 78 | $appManager = $server->getAppManager(); |
| 79 | 79 | /** @var ITrashManager $trashManager */ |
| 80 | 80 | $trashManager = $this->getContainer()->getServer()->query(ITrashManager::class); |
| 81 | - foreach($appManager->getInstalledApps() as $app) { |
|
| 81 | + foreach ($appManager->getInstalledApps() as $app) { |
|
| 82 | 82 | $appInfo = $appManager->getAppInfo($app); |
| 83 | 83 | if (isset($appInfo['trash'])) { |
| 84 | 84 | $backends = $appInfo['trash']; |
| 85 | - foreach($backends as $backend) { |
|
| 85 | + foreach ($backends as $backend) { |
|
| 86 | 86 | $class = $backend['@value']; |
| 87 | 87 | $for = $backend['@attributes']['for']; |
| 88 | 88 | |
@@ -31,67 +31,67 @@ |
||
| 31 | 31 | use OCP\Files\FileInfo; |
| 32 | 32 | |
| 33 | 33 | abstract class AbstractTrash implements ITrash { |
| 34 | - /** @var ITrashItem */ |
|
| 35 | - protected $data; |
|
| 34 | + /** @var ITrashItem */ |
|
| 35 | + protected $data; |
|
| 36 | 36 | |
| 37 | - /** @var ITrashManager */ |
|
| 38 | - protected $trashManager; |
|
| 37 | + /** @var ITrashManager */ |
|
| 38 | + protected $trashManager; |
|
| 39 | 39 | |
| 40 | - public function __construct(ITrashManager $trashManager, ITrashItem $data) { |
|
| 41 | - $this->trashManager = $trashManager; |
|
| 42 | - $this->data = $data; |
|
| 43 | - } |
|
| 40 | + public function __construct(ITrashManager $trashManager, ITrashItem $data) { |
|
| 41 | + $this->trashManager = $trashManager; |
|
| 42 | + $this->data = $data; |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - public function getFilename(): string { |
|
| 46 | - return $this->data->getName(); |
|
| 47 | - } |
|
| 45 | + public function getFilename(): string { |
|
| 46 | + return $this->data->getName(); |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | - public function getDeletionTime(): int { |
|
| 50 | - return $this->data->getDeletedTime(); |
|
| 51 | - } |
|
| 49 | + public function getDeletionTime(): int { |
|
| 50 | + return $this->data->getDeletedTime(); |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - public function getFileId(): int { |
|
| 54 | - return $this->data->getId(); |
|
| 55 | - } |
|
| 53 | + public function getFileId(): int { |
|
| 54 | + return $this->data->getId(); |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | - public function getFileInfo(): FileInfo { |
|
| 58 | - return $this->data; |
|
| 59 | - } |
|
| 57 | + public function getFileInfo(): FileInfo { |
|
| 58 | + return $this->data; |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | - public function getSize(): int { |
|
| 62 | - return $this->data->getSize(); |
|
| 63 | - } |
|
| 61 | + public function getSize(): int { |
|
| 62 | + return $this->data->getSize(); |
|
| 63 | + } |
|
| 64 | 64 | |
| 65 | - public function getLastModified(): int { |
|
| 66 | - return $this->data->getMtime(); |
|
| 67 | - } |
|
| 65 | + public function getLastModified(): int { |
|
| 66 | + return $this->data->getMtime(); |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | - public function getContentType(): string { |
|
| 70 | - return $this->data->getMimetype(); |
|
| 71 | - } |
|
| 69 | + public function getContentType(): string { |
|
| 70 | + return $this->data->getMimetype(); |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | - public function getETag(): string { |
|
| 74 | - return $this->data->getEtag(); |
|
| 75 | - } |
|
| 73 | + public function getETag(): string { |
|
| 74 | + return $this->data->getEtag(); |
|
| 75 | + } |
|
| 76 | 76 | |
| 77 | - public function getName(): string { |
|
| 78 | - return $this->data->getName(); |
|
| 79 | - } |
|
| 77 | + public function getName(): string { |
|
| 78 | + return $this->data->getName(); |
|
| 79 | + } |
|
| 80 | 80 | |
| 81 | - public function getOriginalLocation(): string { |
|
| 82 | - return $this->data->getOriginalLocation(); |
|
| 83 | - } |
|
| 81 | + public function getOriginalLocation(): string { |
|
| 82 | + return $this->data->getOriginalLocation(); |
|
| 83 | + } |
|
| 84 | 84 | |
| 85 | - public function getTitle(): string { |
|
| 86 | - return $this->data->getTitle(); |
|
| 87 | - } |
|
| 85 | + public function getTitle(): string { |
|
| 86 | + return $this->data->getTitle(); |
|
| 87 | + } |
|
| 88 | 88 | |
| 89 | - public function delete() { |
|
| 90 | - $this->trashManager->removeItem($this->data); |
|
| 91 | - } |
|
| 89 | + public function delete() { |
|
| 90 | + $this->trashManager->removeItem($this->data); |
|
| 91 | + } |
|
| 92 | 92 | |
| 93 | - public function restore(): bool { |
|
| 94 | - $this->trashManager->restoreItem($this->data); |
|
| 95 | - return true; |
|
| 96 | - } |
|
| 93 | + public function restore(): bool { |
|
| 94 | + $this->trashManager->restoreItem($this->data); |
|
| 95 | + return true; |
|
| 96 | + } |
|
| 97 | 97 | } |
@@ -36,117 +36,117 @@ |
||
| 36 | 36 | use OCP\ILogger; |
| 37 | 37 | |
| 38 | 38 | class SetupController { |
| 39 | - /** @var Setup */ |
|
| 40 | - protected $setupHelper; |
|
| 41 | - /** @var string */ |
|
| 42 | - private $autoConfigFile; |
|
| 43 | - |
|
| 44 | - /** |
|
| 45 | - * @param Setup $setupHelper |
|
| 46 | - */ |
|
| 47 | - function __construct(Setup $setupHelper) { |
|
| 48 | - $this->autoConfigFile = \OC::$configDir.'autoconfig.php'; |
|
| 49 | - $this->setupHelper = $setupHelper; |
|
| 50 | - } |
|
| 51 | - |
|
| 52 | - /** |
|
| 53 | - * @param $post |
|
| 54 | - */ |
|
| 55 | - public function run($post) { |
|
| 56 | - // Check for autosetup: |
|
| 57 | - $post = $this->loadAutoConfig($post); |
|
| 58 | - $opts = $this->setupHelper->getSystemInfo(); |
|
| 59 | - |
|
| 60 | - // convert 'abcpassword' to 'abcpass' |
|
| 61 | - if (isset($post['adminpassword'])) { |
|
| 62 | - $post['adminpass'] = $post['adminpassword']; |
|
| 63 | - } |
|
| 64 | - if (isset($post['dbpassword'])) { |
|
| 65 | - $post['dbpass'] = $post['dbpassword']; |
|
| 66 | - } |
|
| 67 | - |
|
| 68 | - if (!is_file(\OC::$configDir.'/CAN_INSTALL')) { |
|
| 69 | - $this->displaySetupForbidden(); |
|
| 70 | - return; |
|
| 71 | - } |
|
| 72 | - |
|
| 73 | - if(isset($post['install']) AND $post['install']=='true') { |
|
| 74 | - // We have to launch the installation process : |
|
| 75 | - $e = $this->setupHelper->install($post); |
|
| 76 | - $errors = ['errors' => $e]; |
|
| 77 | - |
|
| 78 | - if(count($e) > 0) { |
|
| 79 | - $options = array_merge($opts, $post, $errors); |
|
| 80 | - $this->display($options); |
|
| 81 | - } else { |
|
| 82 | - $this->finishSetup(isset($post['install-recommended-apps'])); |
|
| 83 | - } |
|
| 84 | - } else { |
|
| 85 | - $options = array_merge($opts, $post); |
|
| 86 | - $this->display($options); |
|
| 87 | - } |
|
| 88 | - } |
|
| 89 | - |
|
| 90 | - private function displaySetupForbidden() { |
|
| 91 | - \OC_Template::printGuestPage('', 'installation_forbidden'); |
|
| 92 | - } |
|
| 93 | - |
|
| 94 | - public function display($post) { |
|
| 95 | - $defaults = [ |
|
| 96 | - 'adminlogin' => '', |
|
| 97 | - 'adminpass' => '', |
|
| 98 | - 'dbuser' => '', |
|
| 99 | - 'dbpass' => '', |
|
| 100 | - 'dbname' => '', |
|
| 101 | - 'dbtablespace' => '', |
|
| 102 | - 'dbhost' => 'localhost', |
|
| 103 | - 'dbtype' => '', |
|
| 104 | - ]; |
|
| 105 | - $parameters = array_merge($defaults, $post); |
|
| 106 | - |
|
| 107 | - \OC_Util::addScript('setup'); |
|
| 108 | - \OC_Template::printGuestPage('', 'installation', $parameters); |
|
| 109 | - } |
|
| 110 | - |
|
| 111 | - private function finishSetup(bool $installRecommended) { |
|
| 112 | - if( file_exists( $this->autoConfigFile )) { |
|
| 113 | - unlink($this->autoConfigFile); |
|
| 114 | - } |
|
| 115 | - \OC::$server->getIntegrityCodeChecker()->runInstanceVerification(); |
|
| 116 | - |
|
| 117 | - if (\OC_Util::getChannel() !== 'git' && is_file(\OC::$configDir.'/CAN_INSTALL')) { |
|
| 118 | - if (!unlink(\OC::$configDir.'/CAN_INSTALL')) { |
|
| 119 | - \OC_Template::printGuestPage('', 'installation_incomplete'); |
|
| 120 | - } |
|
| 121 | - } |
|
| 122 | - |
|
| 123 | - if ($installRecommended) { |
|
| 124 | - $urlGenerator = \OC::$server->getURLGenerator(); |
|
| 125 | - $location = $urlGenerator->getAbsoluteURL('index.php/core/apps/recommended'); |
|
| 126 | - header('Location: ' . $location); |
|
| 127 | - exit(); |
|
| 128 | - } |
|
| 129 | - \OC_Util::redirectToDefaultPage(); |
|
| 130 | - } |
|
| 131 | - |
|
| 132 | - public function loadAutoConfig($post) { |
|
| 133 | - if( file_exists($this->autoConfigFile)) { |
|
| 134 | - \OCP\Util::writeLog('core', 'Autoconfig file found, setting up Nextcloud…', ILogger::INFO); |
|
| 135 | - $AUTOCONFIG = []; |
|
| 136 | - include $this->autoConfigFile; |
|
| 137 | - $post = array_merge ($post, $AUTOCONFIG); |
|
| 138 | - } |
|
| 139 | - |
|
| 140 | - $dbIsSet = isset($post['dbtype']); |
|
| 141 | - $directoryIsSet = isset($post['directory']); |
|
| 142 | - $adminAccountIsSet = isset($post['adminlogin']); |
|
| 143 | - |
|
| 144 | - if ($dbIsSet AND $directoryIsSet AND $adminAccountIsSet) { |
|
| 145 | - $post['install'] = 'true'; |
|
| 146 | - } |
|
| 147 | - $post['dbIsSet'] = $dbIsSet; |
|
| 148 | - $post['directoryIsSet'] = $directoryIsSet; |
|
| 149 | - |
|
| 150 | - return $post; |
|
| 151 | - } |
|
| 39 | + /** @var Setup */ |
|
| 40 | + protected $setupHelper; |
|
| 41 | + /** @var string */ |
|
| 42 | + private $autoConfigFile; |
|
| 43 | + |
|
| 44 | + /** |
|
| 45 | + * @param Setup $setupHelper |
|
| 46 | + */ |
|
| 47 | + function __construct(Setup $setupHelper) { |
|
| 48 | + $this->autoConfigFile = \OC::$configDir.'autoconfig.php'; |
|
| 49 | + $this->setupHelper = $setupHelper; |
|
| 50 | + } |
|
| 51 | + |
|
| 52 | + /** |
|
| 53 | + * @param $post |
|
| 54 | + */ |
|
| 55 | + public function run($post) { |
|
| 56 | + // Check for autosetup: |
|
| 57 | + $post = $this->loadAutoConfig($post); |
|
| 58 | + $opts = $this->setupHelper->getSystemInfo(); |
|
| 59 | + |
|
| 60 | + // convert 'abcpassword' to 'abcpass' |
|
| 61 | + if (isset($post['adminpassword'])) { |
|
| 62 | + $post['adminpass'] = $post['adminpassword']; |
|
| 63 | + } |
|
| 64 | + if (isset($post['dbpassword'])) { |
|
| 65 | + $post['dbpass'] = $post['dbpassword']; |
|
| 66 | + } |
|
| 67 | + |
|
| 68 | + if (!is_file(\OC::$configDir.'/CAN_INSTALL')) { |
|
| 69 | + $this->displaySetupForbidden(); |
|
| 70 | + return; |
|
| 71 | + } |
|
| 72 | + |
|
| 73 | + if(isset($post['install']) AND $post['install']=='true') { |
|
| 74 | + // We have to launch the installation process : |
|
| 75 | + $e = $this->setupHelper->install($post); |
|
| 76 | + $errors = ['errors' => $e]; |
|
| 77 | + |
|
| 78 | + if(count($e) > 0) { |
|
| 79 | + $options = array_merge($opts, $post, $errors); |
|
| 80 | + $this->display($options); |
|
| 81 | + } else { |
|
| 82 | + $this->finishSetup(isset($post['install-recommended-apps'])); |
|
| 83 | + } |
|
| 84 | + } else { |
|
| 85 | + $options = array_merge($opts, $post); |
|
| 86 | + $this->display($options); |
|
| 87 | + } |
|
| 88 | + } |
|
| 89 | + |
|
| 90 | + private function displaySetupForbidden() { |
|
| 91 | + \OC_Template::printGuestPage('', 'installation_forbidden'); |
|
| 92 | + } |
|
| 93 | + |
|
| 94 | + public function display($post) { |
|
| 95 | + $defaults = [ |
|
| 96 | + 'adminlogin' => '', |
|
| 97 | + 'adminpass' => '', |
|
| 98 | + 'dbuser' => '', |
|
| 99 | + 'dbpass' => '', |
|
| 100 | + 'dbname' => '', |
|
| 101 | + 'dbtablespace' => '', |
|
| 102 | + 'dbhost' => 'localhost', |
|
| 103 | + 'dbtype' => '', |
|
| 104 | + ]; |
|
| 105 | + $parameters = array_merge($defaults, $post); |
|
| 106 | + |
|
| 107 | + \OC_Util::addScript('setup'); |
|
| 108 | + \OC_Template::printGuestPage('', 'installation', $parameters); |
|
| 109 | + } |
|
| 110 | + |
|
| 111 | + private function finishSetup(bool $installRecommended) { |
|
| 112 | + if( file_exists( $this->autoConfigFile )) { |
|
| 113 | + unlink($this->autoConfigFile); |
|
| 114 | + } |
|
| 115 | + \OC::$server->getIntegrityCodeChecker()->runInstanceVerification(); |
|
| 116 | + |
|
| 117 | + if (\OC_Util::getChannel() !== 'git' && is_file(\OC::$configDir.'/CAN_INSTALL')) { |
|
| 118 | + if (!unlink(\OC::$configDir.'/CAN_INSTALL')) { |
|
| 119 | + \OC_Template::printGuestPage('', 'installation_incomplete'); |
|
| 120 | + } |
|
| 121 | + } |
|
| 122 | + |
|
| 123 | + if ($installRecommended) { |
|
| 124 | + $urlGenerator = \OC::$server->getURLGenerator(); |
|
| 125 | + $location = $urlGenerator->getAbsoluteURL('index.php/core/apps/recommended'); |
|
| 126 | + header('Location: ' . $location); |
|
| 127 | + exit(); |
|
| 128 | + } |
|
| 129 | + \OC_Util::redirectToDefaultPage(); |
|
| 130 | + } |
|
| 131 | + |
|
| 132 | + public function loadAutoConfig($post) { |
|
| 133 | + if( file_exists($this->autoConfigFile)) { |
|
| 134 | + \OCP\Util::writeLog('core', 'Autoconfig file found, setting up Nextcloud…', ILogger::INFO); |
|
| 135 | + $AUTOCONFIG = []; |
|
| 136 | + include $this->autoConfigFile; |
|
| 137 | + $post = array_merge ($post, $AUTOCONFIG); |
|
| 138 | + } |
|
| 139 | + |
|
| 140 | + $dbIsSet = isset($post['dbtype']); |
|
| 141 | + $directoryIsSet = isset($post['directory']); |
|
| 142 | + $adminAccountIsSet = isset($post['adminlogin']); |
|
| 143 | + |
|
| 144 | + if ($dbIsSet AND $directoryIsSet AND $adminAccountIsSet) { |
|
| 145 | + $post['install'] = 'true'; |
|
| 146 | + } |
|
| 147 | + $post['dbIsSet'] = $dbIsSet; |
|
| 148 | + $post['directoryIsSet'] = $directoryIsSet; |
|
| 149 | + |
|
| 150 | + return $post; |
|
| 151 | + } |
|
| 152 | 152 | } |