From 02fd99793fd6e33f5ac35a5a45cac6e7ee2791c9 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 26 Nov 2008 02:13:40 +0000 Subject: [PATCH] * (bug 16440) Broken 0-byte math renderings are now deleted and re-rendered when page is re-parsed. --- RELEASE-NOTES | 2 ++ includes/Math.php | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 25b1c40f77..3addd8f649 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -366,6 +366,8 @@ The following extensions are migrated into MediaWiki 1.14: * (bug 7726) Searches for words less than 4 characters now work without requiring customization of MySQL server settings * Honour unchecked "Leave a redirect behind" for moved subpages +* (bug 16440) Broken 0-byte math renderings are now deleted and re-rendered + when page is re-parsed. === API changes in 1.14 === diff --git a/includes/Math.php b/includes/Math.php index ca225d6c22..090400e18b 100644 --- a/includes/Math.php +++ b/includes/Math.php @@ -209,8 +209,14 @@ class MathRenderer { $this->html = $rpage->math_html; $this->mathml = $rpage->math_mathml; - if( file_exists( $this->_getHashPath() . "/{$this->hash}.png" ) ) { - return true; + $filename = $this->_getHashPath() . "/{$this->hash}.png"; + if( file_exists( $filename ) ) { + if( filesize( $filename ) == 0 ) { + // Some horrible error corrupted stuff :( + @unlink( $filename ); + } else { + return true; + } } if( file_exists( $wgMathDirectory . "/{$this->hash}.png" ) ) { -- 2.20.1