* Performs the request too
*
* @param Title $title
+ * @param Article $article
* @param OutputPage $output
* @param User $user
* @param WebRequest $request
- * @return Article either the object to become $wgArticle, or NULL
*/
- function initialize( &$title, &$output, &$user, $request ) {
+ function initialize( &$title, &$article, &$output, &$user, $request ) {
wfProfileIn( __METHOD__ );
$this->preliminaryChecks( $title, $output, $request ) ;
- $article = NULL;
if ( !$this->initializeSpecialCases( $title, $output, $request ) ) {
- $article = $this->initializeArticle( $title, $request );
- if( is_object( $article ) ) {
+ $new_article = $this->initializeArticle( $title, $request );
+ if( is_object( $new_article ) ) {
+ $article = $new_article;
$this->performAction( $output, $article, $title, $user, $request );
- } elseif( is_string( $article ) ) {
- $output->redirect( $article );
+ } elseif( is_string( $new_article ) ) {
+ $output->redirect( $new_article );
} else {
throw new MWException( "Shouldn't happen: MediaWiki::initializeArticle() returned neither an object nor a URL" );
}
}
wfProfileOut( __METHOD__ );
- return $article;
}
/**
* Check if the maximum lag of database slaves is higher that $maxLag, and
* if it's the case, output an error message
*
- * @param LoadBalancer $loadBalancer
* @param int $maxLag maximum lag allowed for the request, as supplied by
* the client
- * @return bool true if the requet can continue
+ * @return bool true if the request can continue
*/
- function checkMaxLag( $loadBalancer, $maxLag ) {
- list( $host, $lag ) = $loadBalancer->getMaxLag();
+ function checkMaxLag( $maxLag ) {
+ list( $host, $lag ) = wfGetLB()->getMaxLag();
if ( $lag > $maxLag ) {
wfMaxlagError( $host, $lag, $maxLag );
return false;
*
* @param String $title
* @param String $action
- * @param OutputPage $output
- * @param WebRequest $request
- * @param Language $lang
* @return Title object to be $wgTitle
*/
- function checkInitialQueries( $title, $action, &$output, $request, $lang ) {
- if( $request->getVal( 'printable' ) == 'yes' ){
- $output->setPrintable();
+ function checkInitialQueries( $title, $action ) {
+ global $wgOut, $wgRequest, $wgContLang;
+ if( $wgRequest->getVal( 'printable' ) == 'yes' ){
+ $wgOut->setPrintable();
}
$ret = NULL;
if ( '' == $title && 'delete' != $action ) {
$ret = Title::newMainPage();
- } elseif ( $curid = $request->getInt( 'curid' ) ) {
+ } elseif ( $curid = $wgRequest->getInt( 'curid' ) ) {
# URLs like this are generated by RC, because rc_title isn't always accurate
$ret = Title::newFromID( $curid );
} else {
$ret = Title::newFromURL( $title );
// check variant links so that interwiki links don't have to worry
// about the possible different language variants
- if( count( $lang->getVariants() ) > 1 && !is_null( $ret ) && $ret->getArticleID() == 0 )
- $lang->findVariantLink( $title, $ret );
+ if( count( $wgContLang->getVariants() ) > 1 && !is_null( $ret ) && $ret->getArticleID() == 0 )
+ $wgContLang->findVariantLink( $title, $ret );
}
- if ( ( $oldid = $request->getInt( 'oldid' ) )
+ if ( ( $oldid = $wgRequest->getInt( 'oldid' ) )
&& ( is_null( $ret ) || $ret->getNamespace() != NS_SPECIAL ) ) {
// Allow oldid to override a changed or missing title.
$rev = Revision::newFromId( $oldid );
}
/**
- * Cleaning up by doing deferred updates, calling loadbalancer and doing the
- * output
+ * Cleaning up by doing deferred updates, calling LBFactory and doing the output
*
* @param Array $deferredUpdates array of updates to do
- * @param LoadBalancer $loadBalancer
* @param OutputPage $output
*/
- function finalCleanup( &$deferredUpdates, &$loadBalancer, &$output ) {
+ function finalCleanup ( &$deferredUpdates, &$output ) {
wfProfileIn( __METHOD__ );
$this->doUpdates( $deferredUpdates );
$this->doJobs();
- $loadBalancer->saveMasterPos();
# Now commit any transactions, so that unreported errors after output() don't roll back the whole thing
- $loadBalancer->commitMasterChanges();
+ $factory = wfGetLBFactory();
+ $factory->shutdown();
$output->output();
wfProfileOut( __METHOD__ );
}