Skip to content
This repository
Browse code

API CHANGE silverstripe_version file now contains the plain version n…

…umber, rather than an SVN path
  • Loading branch information...
commit d261f4406afb732280f20c30c33fba2703abe0e8 1 parent a67c6ce
Ingo Schommer authored
24  admin/code/LeftAndMain.php
@@ -1131,27 +1131,17 @@ public function PreviewLink() {
1131 1131
 	/**
1132 1132
 	 * Return the version number of this application.
1133 1133
 	 * Uses the subversion path information in <mymodule>/silverstripe_version
1134  
-	 * (automacially replaced $URL$ placeholder).
  1134
+	 * (automacially replaced by build scripts).
1135 1135
 	 * 
1136 1136
 	 * @return string
1137 1137
 	 */
1138 1138
 	public function CMSVersion() {
1139  
-		$sapphireVersionFile = file_get_contents(BASE_PATH . '/sapphire/silverstripe_version');		
1140  
-		$sapphireVersion = $this->versionFromVersionFile($sapphireVersionFile);
1141  
-
1142  
-		return "sapphire: $sapphireVersion";
1143  
-	}
1144  
-	
1145  
-	/**
1146  
-	 * Return the version from the content of a silverstripe_version file
1147  
-	 */
1148  
-	public function versionFromVersionFile($fileContent) {
1149  
-		if(preg_match('/\/trunk\/silverstripe_version/', $fileContent)) {
1150  
-			return "trunk";
1151  
-		} else {
1152  
-			preg_match("/\/(?:branches|tags\/rc|tags\/beta|tags\/alpha|tags)\/([A-Za-z0-9._-]+)\/silverstripe_version/", $fileContent, $matches);
1153  
-			return ($matches) ? $matches[1] : null;
1154  
-		}
  1139
+		$sapphireVersion = file_get_contents(BASE_PATH . '/cms/silverstripe_version');
  1140
+		if(!$sapphireVersion) $sapphireVersion = _t('LeftAndMain.VersionUnknown', 'unknown');
  1141
+		return sprintf(
  1142
+			"sapphire: %s",
  1143
+			$sapphireVersion
  1144
+		);
1155 1145
 	}
1156 1146
 	
1157 1147
 	/**
2  admin/templates/Includes/LeftAndMain_Menu.ss
... ...
@@ -1,7 +1,7 @@
1 1
 <div class="cms-menu cms-panel cms-panel-layout west" id="cms-menu" data-layout="{type: 'border'}">
2 2
 	<div class="cms-panel-header cms-logo-header north">
3 3
 		<div class="cms-logo">
4  
-			<a href="http://www.silverstripe.org/" target="_blank">
  4
+			<a href="http://www.silverstripe.org/" target="_blank" title="SilverStripe (Version - $CMSVersion)">
5 5
 				SilverStripe <% if CMSVersion %><abbr class="version">$CMSVersion</abbr><% end_if %>
6 6
 			</a>
7 7
 			<span>$SiteConfig.Title</span>
19  admin/tests/LeftAndMainTest.php
@@ -83,25 +83,6 @@ public function testSaveTreeNodeParentID() {
83 83
 	}
84 84
 	
85 85
 	/**
86  
-	 * Test that CMS versions can be interpreted appropriately
87  
-	 */
88  
-	public function testCMSVersion() {
89  
-		$l = new LeftAndMain();
90  
-		$this->assertEquals("2.4", $l->versionFromVersionFile(
91  
-			'$URL: http://svn.silverstripe.com/open/modules/sapphire/branches/2.4/silverstripe_version $'));
92  
-		$this->assertEquals("2.2.0", $l->versionFromVersionFile(
93  
-			'$URL: http://svn.silverstripe.com/open/modules/sapphire/tags/2.2.0/silverstripe_version $'));
94  
-		$this->assertEquals("trunk", $l->versionFromVersionFile(
95  
-			'$URL: http://svn.silverstripe.com/open/modules/sapphire/trunk/silverstripe_version $'));
96  
-		$this->assertEquals("2.4.0-alpha1", $l->versionFromVersionFile(
97  
-			'$URL: http://svn.silverstripe.com/open/modules/sapphire/tags/alpha/2.4.0-alpha1/silverstripe_version $'));
98  
-		$this->assertEquals("2.4.0-beta1", $l->versionFromVersionFile(
99  
-			'$URL: http://svn.silverstripe.com/open/modules/sapphire/tags/beta/2.4.0-beta1/silverstripe_version $'));
100  
-		$this->assertEquals("2.4.0-rc1", $l->versionFromVersionFile(
101  
-			'$URL: http://svn.silverstripe.com/open/modules/sapphire/tags/rc/2.4.0-rc1/silverstripe_version $'));
102  
-	}
103  
-	
104  
-	/**
105 86
 	 * Check that all subclasses of leftandmain can be accessed
106 87
 	 */
107 88
 	public function testLeftAndMainSubclasses() {
1  silverstripe_version
... ...
@@ -1 +0,0 @@
1  
-$URL$

0 notes on commit d261f44

Please sign in to comment.
Something went wrong with that request. Please try again.