Re r111197 Fix Bug 33691 - PHP Warning on showing Release Notes due to the fact that...
[lhc/web/wiklou.git] / includes / installer / WebInstallerPage.php
index 9f5b0e4..aa45f80 100644 (file)
@@ -1251,7 +1251,11 @@ abstract class WebInstaller_Document extends WebInstallerPage {
        }
 
        public function getFileContents() {
-               return file_get_contents( dirname( __FILE__ ) . '/../../' . $this->getFileName() );
+               $file = dirname( __FILE__ ) . '/../../' . $this->getFileName();
+               if( ! file_exists( $file ) ) {
+                       return wfMsgNoTrans( 'config-nofile', $file );
+               }
+               return file_get_contents( $file );
        }
 
 }
@@ -1261,7 +1265,15 @@ class WebInstaller_Readme extends WebInstaller_Document {
 }
 
 class WebInstaller_ReleaseNotes extends WebInstaller_Document {
-       protected function getFileName() { return 'RELEASE-NOTES'; }
+       protected function getFileName() {
+               global $wgVersion;
+
+               if(! preg_match( '/^(\d+)\.(\d+).*/i', $wgVersion, $result ) ) {
+                       throw new MWException('Variable $wgVersion has an invalid value.');
+               }
+
+               return 'RELEASE-NOTES-' . $result[1] . '.' . $result[2];
+       }
 }
 
 class WebInstaller_UpgradeDoc extends WebInstaller_Document {