Re r111197 Fix Bug 33691 - PHP Warning on showing Release Notes due to the fact that file does not exist

Patch from moejoe0000
This commit is contained in:
Mark A. Hershberger 2012-02-10 20:37:21 +00:00
parent bb1c6eeeb4
commit 7c8d2c9f06
2 changed files with 15 additions and 2 deletions

View 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.

View 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 {