From: Mark A. Hershberger Date: Fri, 10 Feb 2012 20:37:21 +0000 (+0000) Subject: Re r111197 Fix Bug 33691 - PHP Warning on showing Release Notes due to the fact that... X-Git-Tag: 1.31.0-rc.0~24788 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=7c8d2c9f068a654ad64543dd97fe45a75622231c;p=lhc%2Fweb%2Fwiklou.git Re r111197 Fix Bug 33691 - PHP Warning on showing Release Notes due to the fact that file does not exist Patch from moejoe0000 --- diff --git a/includes/installer/Installer.i18n.php b/includes/installer/Installer.i18n.php index 4f04409718..2294a398df 100644 --- a/includes/installer/Installer.i18n.php +++ b/includes/installer/Installer.i18n.php @@ -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. diff --git a/includes/installer/WebInstallerPage.php b/includes/installer/WebInstallerPage.php index 9f5b0e4ef1..aa45f803f8 100644 --- a/includes/installer/WebInstallerPage.php +++ b/includes/installer/WebInstallerPage.php @@ -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 {