From b897c81f8cbf117828fb710f0827f124025f9a89 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Sun, 12 Mar 2017 15:02:06 +0100 Subject: [PATCH] Use 'dev' version on the master branch Allowed check branches are now `latest` and `stable`. --- application/ApplicationUtils.php | 13 +++++-------- index.php | 4 ++-- shaarli_version.php | 2 +- tests/ApplicationUtilsTest.php | 11 +++++++++++ 4 files changed, 19 insertions(+), 11 deletions(-) diff --git a/application/ApplicationUtils.php b/application/ApplicationUtils.php index a0f482b0..94c49040 100644 --- a/application/ApplicationUtils.php +++ b/application/ApplicationUtils.php @@ -5,7 +5,7 @@ class ApplicationUtils { private static $GIT_URL = 'https://raw.githubusercontent.com/shaarli/Shaarli'; - private static $GIT_BRANCHES = array('master', 'stable'); + private static $GIT_BRANCHES = array('latest', 'stable'); private static $VERSION_FILE = 'shaarli_version.php'; private static $VERSION_START_TAG = ''; @@ -65,13 +65,10 @@ class ApplicationUtils $isLoggedIn, $branch='stable') { - if (! $isLoggedIn) { - // Do not check versions for visitors - return false; - } - - if (empty($enableCheck)) { - // Do not check if the user doesn't want to + // Do not check versions for visitors + // Do not check if the user doesn't want to + // Do not check with dev version + if (! $isLoggedIn || empty($enableCheck) || $currentVersion === 'dev') { return false; } diff --git a/index.php b/index.php index cc7f3ca3..bf35f1d4 100644 --- a/index.php +++ b/index.php @@ -1,6 +1,6 @@ /shaarli/ define('WEB_PATH', substr($_SERVER['REQUEST_URI'], 0, 1+strrpos($_SERVER['REQUEST_URI'], '/', 0))); diff --git a/shaarli_version.php b/shaarli_version.php index 3f79a4c6..9167b43e 100644 --- a/shaarli_version.php +++ b/shaarli_version.php @@ -1 +1 @@ - + diff --git a/tests/ApplicationUtilsTest.php b/tests/ApplicationUtilsTest.php index ad86e21c..ef4f46a8 100644 --- a/tests/ApplicationUtilsTest.php +++ b/tests/ApplicationUtilsTest.php @@ -332,4 +332,15 @@ class ApplicationUtilsTest extends PHPUnit_Framework_TestCase ApplicationUtils::checkResourcePermissions($conf) ); } + + /** + * Check update with 'dev' as curent version (master branch). + * It should always return false. + */ + public function testCheckUpdateDev() + { + $this->assertFalse( + ApplicationUtils::checkUpdate('dev', self::$testUpdateFile, 100, true, true) + ); + } } -- 2.41.0