Index: trunk/phase3/includes/DefaultSettings.php |
— | — | @@ -1864,6 +1864,19 @@ |
1865 | 1865 | /** Location of the texvc binary */ |
1866 | 1866 | $wgTexvc = './math/texvc'; |
1867 | 1867 | |
| 1868 | +/** |
| 1869 | + * Normally when generating math images, we double-check that the |
| 1870 | + * directories we want to write to exist, and that files that have |
| 1871 | + * been generated still exist when we need to bring them up again. |
| 1872 | + * |
| 1873 | + * This lets us give useful error messages in case of permission |
| 1874 | + * problems, and automatically rebuild images that have been lost. |
| 1875 | + * |
| 1876 | + * On a big site with heavy NFS traffic this can be slow and flaky, |
| 1877 | + * so sometimes we want to short-circuit it by setting this to false. |
| 1878 | + */ |
| 1879 | +$wgMathCheckFiles = true; |
| 1880 | + |
1868 | 1881 | # |
1869 | 1882 | # Profiling / debugging |
1870 | 1883 | # |
Index: trunk/phase3/includes/Math.php |
— | — | @@ -33,7 +33,7 @@ |
34 | 34 | |
35 | 35 | function render() { |
36 | 36 | global $wgTmpDirectory, $wgInputEncoding; |
37 | | - global $wgTexvc; |
| 37 | + global $wgTexvc, $wgMathCheckFiles; |
38 | 38 | $fname = 'MathRenderer::render'; |
39 | 39 | |
40 | 40 | if( $this->mode == MW_MATH_SOURCE ) { |
— | — | @@ -45,13 +45,15 @@ |
46 | 46 | } |
47 | 47 | |
48 | 48 | if( !$this->_recall() ) { |
49 | | - # Ensure that the temp and output directories are available before continuing... |
50 | | - if( !file_exists( $wgTmpDirectory ) ) { |
51 | | - if( !wfMkdirParents( $wgTmpDirectory ) ) { |
| 49 | + if( $wgMathCheckFiles ) { |
| 50 | + # Ensure that the temp and output directories are available before continuing... |
| 51 | + if( !file_exists( $wgTmpDirectory ) ) { |
| 52 | + if( !wfMkdirParents( $wgTmpDirectory ) ) { |
| 53 | + return $this->_error( 'math_bad_tmpdir' ); |
| 54 | + } |
| 55 | + } elseif( !is_dir( $wgTmpDirectory ) || !is_writable( $wgTmpDirectory ) ) { |
52 | 56 | return $this->_error( 'math_bad_tmpdir' ); |
53 | 57 | } |
54 | | - } elseif( !is_dir( $wgTmpDirectory ) || !is_writable( $wgTmpDirectory ) ) { |
55 | | - return $this->_error( 'math_bad_tmpdir' ); |
56 | 58 | } |
57 | 59 | |
58 | 60 | if( function_exists( 'is_executable' ) && !is_executable( $wgTexvc ) ) { |
— | — | @@ -200,7 +202,7 @@ |
201 | 203 | } |
202 | 204 | |
203 | 205 | function _recall() { |
204 | | - global $wgMathDirectory; |
| 206 | + global $wgMathDirectory, $wgMathCheckFiles; |
205 | 207 | $fname = 'MathRenderer::_recall'; |
206 | 208 | |
207 | 209 | $this->md5 = md5( $this->tex ); |
— | — | @@ -221,6 +223,12 @@ |
222 | 224 | $this->mathml = $rpage->math_mathml; |
223 | 225 | |
224 | 226 | $filename = $this->_getHashPath() . "/{$this->hash}.png"; |
| 227 | + |
| 228 | + if( !$wgMathCheckFiles ) { |
| 229 | + // Short-circuit the file existence & migration checks |
| 230 | + return true; |
| 231 | + } |
| 232 | + |
225 | 233 | if( file_exists( $filename ) ) { |
226 | 234 | if( filesize( $filename ) == 0 ) { |
227 | 235 | // Some horrible error corrupted stuff :( |