Skip to content

Commit

Permalink
disable upgrades to 26 on 32-bit
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 5c31ef1 commit 9cc0541
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
*
*/

use Composer\Semver\Semver;

class UpdateException extends \Exception {
protected $data;
Expand Down Expand Up @@ -167,6 +168,11 @@ public function checkForUpdate() {
$versionString = isset($response['versionstring']) ? $response['versionstring'] : '';

if ($version !== '' && $version !== $this->currentVersion) {
if (PHP_INT_SIZE < 8 && Semver::satisfies($version, '> 25')) {
$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.';
}
$this->updateAvailable = true;
$releaseChannel = $this->getCurrentReleaseChannel();
$updateText = 'Update to ' . htmlentities($versionString) . ' available. (channel: "' . htmlentities($releaseChannel) . '")<br /><span class="light">Following file will be downloaded automatically:</span> <code class="light">' . $response['url'] . '</code>';
Expand Down
7 changes: 7 additions & 0 deletions lib/Updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@

namespace NC\Updater;

use Composer\Semver\Semver;

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

if ($version !== '' && $version !== $this->currentVersion) {
if (PHP_INT_SIZE < 8 && Semver::satisfies($version, '> 25')) {
$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.';
}
$this->updateAvailable = true;
$releaseChannel = $this->getCurrentReleaseChannel();
$updateText = 'Update to ' . htmlentities($versionString) . ' available. (channel: "' . htmlentities($releaseChannel) . '")<br /><span class="light">Following file will be downloaded automatically:</span> <code class="light">' . $response['url'] . '</code>';
Expand Down

0 comments on commit 9cc0541

Please sign in to comment.