mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
BUGFIX #5073: Fixed CMS version indicator for alpha and beta versions.
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.4@99789 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
a11effb33a
commit
6b1f258c44
@ -1089,20 +1089,9 @@ JS;
|
|||||||
public function CMSVersion() {
|
public function CMSVersion() {
|
||||||
$sapphireVersionFile = file_get_contents(BASE_PATH . '/sapphire/silverstripe_version');
|
$sapphireVersionFile = file_get_contents(BASE_PATH . '/sapphire/silverstripe_version');
|
||||||
$cmsVersionFile = file_get_contents(BASE_PATH . '/cms/silverstripe_version');
|
$cmsVersionFile = file_get_contents(BASE_PATH . '/cms/silverstripe_version');
|
||||||
|
|
||||||
if(strstr($sapphireVersionFile, "/sapphire/trunk")) {
|
$sapphireVersion = $this->versionFromVersionFile($sapphireVersionFile);
|
||||||
$sapphireVersion = "trunk";
|
$cmsVersion = $this->versionFromVersionFile($cmsVersionFile);
|
||||||
} else {
|
|
||||||
preg_match("/sapphire\/(?:(?:branches)|(?:tags))(?:\/rc)?\/([A-Za-z0-9._-]+)\/silverstripe_version/", $sapphireVersionFile, $matches);
|
|
||||||
$sapphireVersion = ($matches) ? $matches[1] : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(strstr($cmsVersionFile, "/cms/trunk")) {
|
|
||||||
$cmsVersion = "trunk";
|
|
||||||
} else {
|
|
||||||
preg_match("/cms\/(?:(?:branches)|(?:tags))(?:\/rc)?\/([A-Za-z0-9._-]+)\/silverstripe_version/", $cmsVersionFile, $matches);
|
|
||||||
$cmsVersion = ($matches) ? $matches[1] : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if($sapphireVersion == $cmsVersion) {
|
if($sapphireVersion == $cmsVersion) {
|
||||||
return $sapphireVersion;
|
return $sapphireVersion;
|
||||||
@ -1111,6 +1100,18 @@ JS;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the version from the content of a silverstripe_version file
|
||||||
|
*/
|
||||||
|
public function versionFromVersionFile($fileContent) {
|
||||||
|
if(preg_match('/\/trunk\/silverstripe_version/', $fileContent)) {
|
||||||
|
return "trunk";
|
||||||
|
} else {
|
||||||
|
preg_match("/\/(?:branches|tags\/rc|tags\/beta|tags\/alpha|tags)\/([A-Za-z0-9._-]+)\/silverstripe_version/", $fileContent, $matches);
|
||||||
|
return ($matches) ? $matches[1] : null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
|
@ -14,6 +14,25 @@ class LeftAndMainTest extends FunctionalTest {
|
|||||||
CMSMenu::populate_menu();
|
CMSMenu::populate_menu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test that CMS versions can be interpreted appropriately
|
||||||
|
*/
|
||||||
|
public function testCMSVersion() {
|
||||||
|
$l = new LeftAndMain();
|
||||||
|
$this->assertEquals("2.4", $l->versionFromVersionFile(
|
||||||
|
'$URL: http://svn.silverstripe.com/open/modules/cms/branches/2.4/silverstripe_version $'));
|
||||||
|
$this->assertEquals("2.2.0", $l->versionFromVersionFile(
|
||||||
|
'$URL: http://svn.silverstripe.com/open/modules/cms/tags/2.2.0/silverstripe_version $'));
|
||||||
|
$this->assertEquals("trunk", $l->versionFromVersionFile(
|
||||||
|
'$URL: http://svn.silverstripe.com/open/modules/cms/trunk/silverstripe_version $'));
|
||||||
|
$this->assertEquals("2.4.0-alpha1", $l->versionFromVersionFile(
|
||||||
|
'$URL: http://svn.silverstripe.com/open/modules/cms/tags/alpha/2.4.0-alpha1/silverstripe_version $'));
|
||||||
|
$this->assertEquals("2.4.0-beta1", $l->versionFromVersionFile(
|
||||||
|
'$URL: http://svn.silverstripe.com/open/modules/cms/tags/beta/2.4.0-beta1/silverstripe_version $'));
|
||||||
|
$this->assertEquals("2.4.0-rc1", $l->versionFromVersionFile(
|
||||||
|
'$URL: http://svn.silverstripe.com/open/modules/cms/tags/rc/2.4.0-rc1/silverstripe_version $'));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check that all subclasses of leftandmain can be accessed
|
* Check that all subclasses of leftandmain can be accessed
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user