diff options
-rw-r--r-- | core/Command/Upgrade.php | 4 | ||||
-rw-r--r-- | core/js/js.js | 4 | ||||
-rw-r--r-- | core/js/sharedialogexpirationview.js | 2 | ||||
-rw-r--r-- | lib/private/Updater.php | 29 | ||||
-rw-r--r-- | lib/private/legacy/app.php | 2 | ||||
-rw-r--r-- | settings/templates/admin.php | 12 | ||||
-rw-r--r-- | tests/lib/UpdaterTest.php | 13 | ||||
-rw-r--r-- | version.php | 2 |
8 files changed, 57 insertions, 11 deletions
diff --git a/core/Command/Upgrade.php b/core/Command/Upgrade.php index 77d67534c6a..69354272de8 100644 --- a/core/Command/Upgrade.php +++ b/core/Command/Upgrade.php @@ -250,10 +250,10 @@ class Upgrade extends Command { $output->writeln('<info>Checked database schema update</info>'); }); $updater->listen('\OC\Updater', 'incompatibleAppDisabled', function ($app) use($output) { - $output->writeln('<info>Disabled incompatible app: ' . $app . '</info>'); + $output->writeln('<comment>Disabled incompatible app: ' . $app . '</comment>'); }); $updater->listen('\OC\Updater', 'thirdPartyAppDisabled', function ($app) use ($output) { - $output->writeln('<info>Disabled 3rd-party app: ' . $app . '</info>'); + $output->writeln('<comment>Disabled 3rd-party app: ' . $app . '</comment>'); }); $updater->listen('\OC\Updater', 'upgradeAppStoreApp', function ($app) use($output) { $output->writeln('<info>Update 3rd-party app: ' . $app . '</info>'); diff --git a/core/js/js.js b/core/js/js.js index d2bbbae6362..4e8d3a01416 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -1574,6 +1574,10 @@ function initCore() { $target.closest('.app-navigation-noclose').length) { return; } + if($target.is('.app-navigation-entry-utils-menu-button') || + $target.closest('.app-navigation-entry-utils-menu-button').length) { + return; + } if($target.is('.add-new') || $target.closest('.add-new').length) { return; diff --git a/core/js/sharedialogexpirationview.js b/core/js/sharedialogexpirationview.js index fa5c0c00986..1770bdd5a7b 100644 --- a/core/js/sharedialogexpirationview.js +++ b/core/js/sharedialogexpirationview.js @@ -96,6 +96,8 @@ this.model.saveLinkShare({ expireDate: '' }); + } else { + this.$el.find('#expirationDate').focus(); } }, diff --git a/lib/private/Updater.php b/lib/private/Updater.php index 0a6d9c9a31d..609e965bfad 100644 --- a/lib/private/Updater.php +++ b/lib/private/Updater.php @@ -184,6 +184,18 @@ class Updater extends BasicEmitter { } /** + * Return vendor from which this version was published + * + * @return string Get the vendor + */ + private function getVendor() { + // this should really be a JSON file + require \OC::$SERVERROOT . '/version.php'; + /** @var string $vendor */ + return (string) $vendor; + } + + /** * Whether an upgrade to a specified version is possible * @param string $oldVersion * @param string $newVersion @@ -191,8 +203,22 @@ class Updater extends BasicEmitter { * @return bool */ public function isUpgradePossible($oldVersion, $newVersion, $allowedPreviousVersion) { - return (version_compare($allowedPreviousVersion, $oldVersion, '<=') + $allowedUpgrade = (version_compare($allowedPreviousVersion, $oldVersion, '<=') && (version_compare($oldVersion, $newVersion, '<=') || $this->config->getSystemValue('debug', false))); + + if ($allowedUpgrade) { + return $allowedUpgrade; + } + + // Upgrade not allowed, someone switching vendor? + if ($this->getVendor() !== $this->config->getAppValue('core', 'vendor', '')) { + $oldVersion = explode('.', $oldVersion); + $newVersion = explode('.', $newVersion); + + return $oldVersion[0] === $newVersion[0] && $oldVersion[1] === $newVersion[1]; + } + + return false; } /** @@ -279,6 +305,7 @@ class Updater extends BasicEmitter { // only set the final version if everything went well $this->config->setSystemValue('version', implode('.', \OCP\Util::getVersion())); + $this->config->setAppValue('core', 'vendor', $this->getVendor()); } } diff --git a/lib/private/legacy/app.php b/lib/private/legacy/app.php index 5395d1daeee..2d5e5ba1932 100644 --- a/lib/private/legacy/app.php +++ b/lib/private/legacy/app.php @@ -989,7 +989,7 @@ class OC_App { $currentVersion = OC_App::getAppVersion($app); if ($currentVersion && isset($versions[$app])) { $installedVersion = $versions[$app]; - if (version_compare($currentVersion, $installedVersion, '>')) { + if (!version_compare($currentVersion, $installedVersion, '=')) { return true; } } diff --git a/settings/templates/admin.php b/settings/templates/admin.php index 74fe585962d..730e60cfad4 100644 --- a/settings/templates/admin.php +++ b/settings/templates/admin.php @@ -39,14 +39,14 @@ $mail_smtpsecure = [ ]; $mail_smtpmode = [ - 'php', - 'smtp', + ['php', 'PHP'], + ['smtp', 'SMTP'], ]; if ($_['sendmail_is_available']) { - $mail_smtpmode[] = 'sendmail'; + $mail_smtpmode[] = ['sendmail', 'Sendmail']; } if ($_['mail_smtpmode'] == 'qmail') { - $mail_smtpmode[] = 'qmail'; + $mail_smtpmode[] = ['qmail', 'qmail']; } ?> @@ -414,10 +414,10 @@ if ($_['cronErrors']) { <select name='mail_smtpmode' id='mail_smtpmode'> <?php foreach ($mail_smtpmode as $smtpmode): $selected = ''; - if ($smtpmode == $_['mail_smtpmode']): + if ($smtpmode[0] == $_['mail_smtpmode']): $selected = 'selected="selected"'; endif; ?> - <option value='<?php p($smtpmode)?>' <?php p($selected) ?>><?php p($smtpmode) ?></option> + <option value='<?php p($smtpmode[0])?>' <?php p($selected) ?>><?php p($smtpmode[1]) ?></option> <?php endforeach;?> </select> diff --git a/tests/lib/UpdaterTest.php b/tests/lib/UpdaterTest.php index 643a18cc714..e45a9f08243 100644 --- a/tests/lib/UpdaterTest.php +++ b/tests/lib/UpdaterTest.php @@ -137,6 +137,12 @@ class UpdaterTest extends \Test\TestCase { ['8.1.0.0', '8.2.0.0', '8.1', true, true], ['8.2.0.1', '8.2.0.1', '8.1', true, true], ['8.3.0.0', '8.2.0.0', '8.1', true, true], + + // Downgrade of maintenance + ['9.0.53.0', '9.0.4.0', '8.1', false, false, 'nextcloud'], + // with vendor switch + ['9.0.53.0', '9.0.4.0', '8.1', true, false, ''], + ['9.0.53.0', '9.0.4.0', '8.1', true, false, 'owncloud'], ]; } @@ -148,12 +154,17 @@ class UpdaterTest extends \Test\TestCase { * @param string $allowedVersion * @param bool $result * @param bool $debug + * @param string $vendor */ - public function testIsUpgradePossible($oldVersion, $newVersion, $allowedVersion, $result, $debug = false) { + public function testIsUpgradePossible($oldVersion, $newVersion, $allowedVersion, $result, $debug = false, $vendor = 'nextcloud') { $this->config->expects($this->any()) ->method('getSystemValue') ->with('debug', false) ->willReturn($debug); + $this->config->expects($this->any()) + ->method('getAppValue') + ->with('core', 'vendor', '') + ->willReturn($vendor); $this->assertSame($result, $this->updater->isUpgradePossible($oldVersion, $newVersion, $allowedVersion)); } diff --git a/version.php b/version.php index e6298ae238f..2c0c2029aca 100644 --- a/version.php +++ b/version.php @@ -38,3 +38,5 @@ $OC_Channel = 'git'; // The build number $OC_Build = ''; +// Vendor of this package +$vendor = 'nextcloud'; |