From 03c575f9e7416fb655d914d020ef11e06bc52378 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Tue, 25 Oct 2005 07:28:22 +0000 Subject: [PATCH] fixed relative path bug --- maintenance/dumpHTML.inc | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/maintenance/dumpHTML.inc b/maintenance/dumpHTML.inc index 250f8d502f..ec29fb02dd 100644 --- a/maintenance/dumpHTML.inc +++ b/maintenance/dumpHTML.inc @@ -96,16 +96,12 @@ class DumpHTML { /** Write the main page as index.html */ function doMainPage() { - global $wgMakeDumpLinks; print "Making index.html "; // Set up globals with no ../../.. in the link URLs $this->setupGlobals( 0 ); - // But still use that directory style - $wgMakeDumpLinks = 3; - $title = Title::newMainPage(); $text = $this->getArticleHTML( $title ); $file = fopen( "{$this->dest}/index.html", "w" ); @@ -123,7 +119,7 @@ class DumpHTML { $fname = 'DumpHTML::doImageDescriptions'; - $this->setupGlobals( 3 ); + $this->setupGlobals(); /** * Dump image description pages that don't have an associated article, but do @@ -280,8 +276,8 @@ class DumpHTML { } /** Set up globals required for parsing */ - function setupGlobals( $depth = NULL ) { - global $wgUser, $wgTitle, $wgMakeDumpLinks, $wgStylePath, $wgArticlePath; + function setupGlobals( $currentDepth = NULL ) { + global $wgUser, $wgTitle, $wgStylePath, $wgArticlePath; global $wgUploadPath, $wgLogo, $wgMaxCredits, $wgSharedUploadPath; global $wgHideInterlanguageLinks, $wgUploadDirectory, $wgThumbnailScriptPath; global $wgSharedThumbnailScriptPath, $wgEnableParserCache, $wgHooks, $wgServer; @@ -295,23 +291,21 @@ class DumpHTML { $this->oldArticlePath = $wgServer . $wgArticlePath; } - if ( is_null( $depth ) ) { - $wgMakeDumpLinks = $this->depth; - } else { - $wgMakeDumpLinks = $depth; + if ( is_null( $currentDepth ) ) { + $currentDepth = $this->depth; } if ( $this->alternateScriptPath ) { - if ( $wgMakeDumpLinks == 0 ) { + if ( $currentDepth == 0 ) { $wgScriptPath = '.'; } else { - $wgScriptPath = '..' . str_repeat( '/..', $wgMakeDumpLinks - 1 ); + $wgScriptPath = '..' . str_repeat( '/..', $currentDepth - 1 ); } } else { - $wgScriptPath = '..' . str_repeat( '/..', $wgMakeDumpLinks ); + $wgScriptPath = '..' . str_repeat( '/..', $currentDepth ); } - $wgArticlePath = str_repeat( '../', $wgMakeDumpLinks ) . '$1'; + $wgArticlePath = str_repeat( '../', $currentDepth ) . '$1'; # Logo image # Allow for repeated setup @@ -369,6 +363,9 @@ class DumpHTML { $ns = $wgTitle->getNamespace(); if ( $ns == NS_SPECIAL ) { + $wgOut = new OutputPage; + $wgOut->setParserOptions( new ParserOptions ); + $wgLinkCache = new LinkCache; SpecialPage::executePath( $wgTitle ); } else { if ( $ns == NS_IMAGE ) { @@ -539,6 +536,7 @@ ENDTEXT; if ( $url === false ) { $url = str_replace( '$1', wfUrlencode( $this->getHashedFilename( $title ) ), $wgArticlePath ); } + return false; } -- 2.20.1