Lines Matching +full:php +full:- +full:version
1 <?php
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
79 private const string UPDATE_URL = 'https://dev.webtrees.net/build/latest-version.txt';
91 $this->timeout_service = $timeout_service;
104 // The Flysystem ZIP archive adapter is painfully slow, so use the native PHP library.
107 if ($zip->open($zip_file) === true) {
108 $zip->extractTo($target_folder);
109 $zip->close();
129 $files = $zip_filesystem->listContents('', FilesystemReader::LIST_DEEP)
130 ->filter(static fn (StorageAttributes $attributes): bool => $attributes->isFile())
131 ->map(static fn (StorageAttributes $attributes): string => $attributes->path());
150 // We store the data in PHP temporary storage.
151 $tmp = fopen('php://memory', 'wb+');
155 $response = $client->get($url, self::GUZZLE_OPTIONS);
156 $stream = $response->getBody();
159 while (!$stream->eof()) {
160 $data = $stream->read(self::READ_BLOCK_SIZE);
168 if ($this->timeout_service->isTimeNearlyUp()) {
169 $stream->close();
174 $stream->close();
179 $filesystem->writeStream($path, $tmp);
196 foreach ($source->listContents('', FilesystemReader::LIST_DEEP) as $attributes) {
197 if ($attributes->isFile()) {
198 $destination->write($attributes->path(), $source->read($attributes->path()));
199 $source->delete($attributes->path());
201 if ($this->timeout_service->isTimeNearlyUp()) {
221 … foreach ($filesystem->listContents($folder_to_clean, FilesystemReader::LIST_DEEP) as $path) {
222 if ($path['type'] === 'file' && !$files_to_keep->contains($path['path'])) {
224 $filesystem->delete($path['path']);
231 if ($this->timeout_service->isTimeNearlyUp()) {
248 … // If the latest version is unavailable, we will have an empty string which equates to version 0.
250 return version_compare(Webtrees::VERSION, $this->fetchLatestVersion($force)) < 0;
254 * What is the latest version of webtrees.
260 $latest_version = $this->fetchLatestVersion(false);
262 [$version] = explode('|', $latest_version);
264 return $version;
268 * What, if any, error did we have when fetching the latest version of webtrees.
278 * When did we last try to fetch the latest version of webtrees.
286 return Registry::timestampFactory()->make($latest_version_wt_timestamp);
290 * Where can we download the latest version of webtrees.
296 $latest_version = $this->fetchLatestVersion(false);
324 * Check with the webtrees.net server for the latest version of webtrees.
326 * Pass the current versions of webtrees, PHP and database, as the response
340 … if ($force || $last_update_timestamp < $current_timestamp - self::CHECK_FOR_UPDATE_INTERVAL) {
348 $response = $client->get(self::UPDATE_URL, [
349 'query' => $this->serverParameters(),
352 if ($response->getStatusCode() === StatusCodeInterface::STATUS_OK) {
353 Site::setPreference('LATEST_WT_VERSION', $response->getBody()->getContents());
356 … Site::setPreference('LATEST_WT_VERSION_ERROR', 'HTTP' . $response->getStatusCode());
361 Site::setPreference('LATEST_WT_VERSION_ERROR', $ex->getMessage());
378 $site_uuid = Registry::idFactory()->uuid();
383 'w' => Webtrees::VERSION,