Skip to content

Commit

Permalink
address review and fix one test
Browse files Browse the repository at this point in the history
Signed-off-by: szaimen <szaimen@e.mail.de>
  • Loading branch information
szaimen committed Nov 14, 2022
1 parent 163f362 commit ddc200d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
5 changes: 2 additions & 3 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ public function accept(): bool {
}
}

use Composer\Semver\Semver;

class Updater {
/** @var string */
Expand Down Expand Up @@ -167,9 +166,9 @@ public function checkForUpdate() {
$versionString = isset($response['versionstring']) ? $response['versionstring'] : '';

if ($version !== '' && $version !== $this->currentVersion) {
if (PHP_INT_SIZE < 8 && Semver::satisfies($version, '> 25')) {
if (PHP_INT_SIZE < 8 && version_compare($version, '26.0.0', '>=')) {
$this->updateAvailable = false;
$updateText = '<br />You are running a 32-bit PHP version. Cannot upgrade to Nextcloud 26 and higher. Please switch to 64-bit PHP.';
$updateText = '<br />You are running a 32-bit system. Nextcloud 26 supports 64-bit only, therefore an update cannot be offered. Please switch to a 64-bit system first.';
return $updateText;
}
$this->updateAvailable = true;
Expand Down
6 changes: 2 additions & 4 deletions lib/Updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@

namespace NC\Updater;

use Composer\Semver\Semver;

class Updater {
/** @var string */
private $baseDir;
Expand Down Expand Up @@ -139,9 +137,9 @@ public function checkForUpdate() {
$versionString = isset($response['versionstring']) ? $response['versionstring'] : '';

if ($version !== '' && $version !== $this->currentVersion) {
if (PHP_INT_SIZE < 8 && Semver::satisfies($version, '> 25')) {
if (PHP_INT_SIZE < 8 && version_compare($version, '26.0.0', '>=')) {
$this->updateAvailable = false;
$updateText = '<br />You are running a 32-bit PHP version. Cannot upgrade to Nextcloud 26 and higher. Please switch to 64-bit PHP.';
$updateText = '<br />You are running a 32-bit system. Nextcloud 26 supports 64-bit only, therefore an update cannot be offered. Please switch to a 64-bit system first.';
return $updateText;
}
$this->updateAvailable = true;
Expand Down

0 comments on commit ddc200d

Please sign in to comment.