Re r111197 Fix Bug 33691 - PHP Warning on showing Release Notes due to the fact that...
authorMark A. Hershberger <mah@users.mediawiki.org>
Fri, 10 Feb 2012 20:37:21 +0000 (20:37 +0000)
committerMark A. Hershberger <mah@users.mediawiki.org>
Fri, 10 Feb 2012 20:37:21 +0000 (20:37 +0000)
Patch from moejoe0000

includes/installer/Installer.i18n.php
includes/installer/WebInstallerPage.php

index 4f04409..2294a39 100644 (file)
@@ -550,6 +550,7 @@ $3
 When that has been done, you can '''[$2 enter your wiki]'''.",
        'config-download-localsettings' => 'Download LocalSettings.php',
        'config-help' => 'help',
+       'config-nofile'     => 'File "$1" could not be found. Has it been deleted?',
        'mainpagetext'      => "'''MediaWiki has been successfully installed.'''",
        'mainpagedocfooter' => "Consult the [//meta.wikimedia.org/wiki/Help:Contents User's Guide] for information on using the wiki software.
 
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 {