Difference between revisions of "MediaWiki/archive/embedding/old/extract.php/v2"
m (extract.php for embedding MediaWiki contents moved to MediaWiki/extract.php/old: this version is obsolete) |
|
(No difference)
|
Revision as of 22:58, 6 June 2009
computing: software: MediaWiki: embedding content: extract.php
Notes
The following contents are based on index.php from MediaWiki (I'm not sure which version, but probably later than 1.7.1). Some code may be redundant, but I was trying to make the fewest possible changes in order to avoid breaking anything. It's currently in use as the front page for Outside Life, a webcomic.
- /examples - also from Outside Life
Contents
<php> <?php /*
This is essentially index.php with some minor tweaks TWEAKS:
these lines commented out: $action = $wgRequest->getVal( 'action', 'view' ); $title = $wgRequest->getVal( 'title' ); this line commented out $wgTitle = $mediaWiki->checkInitialQueries( $title,$action,$wgOut, $wgRequest, $wgContLang ); this line inserted immediately after: $wgTitle = Title::newFromURL( $title );
- /
- Initialise common code
require_once( './includes/WebStart.php' );
- Initialize MediaWiki base class
require_once( "includes/Wiki.php" ); $mediaWiki = new MediaWiki();
wfProfileIn( 'main-misc-setup' ); OutputPage::setEncodings(); # Not really used yet
$maxLag = $wgRequest->getVal( 'maxlag' ); if ( !is_null( $maxLag ) ) { if ( !$mediaWiki->checkMaxLag( $maxLag ) ) { exit; } }
- Query string fields
//$action = $wgRequest->getVal( 'action', 'view' ); //$title = $wgRequest->getVal( 'title' );
//$wgTitle = $mediaWiki->checkInitialQueries( $title,$action,$wgOut, $wgRequest, $wgContLang ); $wgTitle = Title::newFromURL( $title ); if ($wgTitle == NULL) { unset( $wgTitle ); }
- Send Ajax requests to the Ajax dispatcher.
/* if ( $wgUseAjax && $action == 'ajax' ) { require_once( $IP . '/includes/AjaxDispatcher.php' );
$dispatcher = new AjaxDispatcher(); $dispatcher->performAction(); $mediaWiki->restInPeace( $wgLoadBalancer ); exit; }
- /
wfProfileOut( 'main-misc-setup' );
- Setting global variables in mediaWiki
$mediaWiki->setVal( 'Server', $wgServer ); $mediaWiki->setVal( 'DisableInternalSearch', $wgDisableInternalSearch ); $mediaWiki->setVal( 'action', $action ); $mediaWiki->setVal( 'SquidMaxage', $wgSquidMaxage ); $mediaWiki->setVal( 'EnableDublinCoreRdf', $wgEnableDublinCoreRdf ); $mediaWiki->setVal( 'EnableCreativeCommonsRdf', $wgEnableCreativeCommonsRdf ); $mediaWiki->setVal( 'CommandLineMode', $wgCommandLineMode ); $mediaWiki->setVal( 'UseExternalEditor', $wgUseExternalEditor ); $mediaWiki->setVal( 'DisabledActions', $wgDisabledActions );
$wgArticle = $mediaWiki->initialize ( $wgTitle, $wgOut, $wgUser, $wgRequest ); $mediaWiki->finalCleanup ( $wgDeferredUpdateList, $wgLoadBalancer, $wgOut );
- Not sure when $wgPostCommitUpdateList gets set, so I keep this separate from finalCleanup
$mediaWiki->doUpdates( $wgPostCommitUpdateList );
$mediaWiki->restInPeace( $wgLoadBalancer ); ?> </php>