Restore returning old value
private $context;
public function request( WebRequest $x = null ){
private $context;
public function request( WebRequest $x = null ){
+ $old = $this->context->getRequest();
$this->context->setRequest( $x );
$this->context->setRequest( $x );
- return $this->context->getRequest();
}
public function output( OutputPage $x = null ){
}
public function output( OutputPage $x = null ){
+ $old = $this->context->getOutput();
$this->context->setOutput( $x );
$this->context->setOutput( $x );
- return $this->context->getOutput();
}
public function __construct( RequestContext $context = null ) {
if ( !$context ) {
$context = RequestContext::getMain();
}
}
public function __construct( RequestContext $context = null ) {
if ( !$context ) {
$context = RequestContext::getMain();
}
$this->context = $context;
$this->context->setTitle( $this->parseTitle() );
}
$this->context = $context;
$this->context->setTitle( $this->parseTitle() );
}
*/
global $wgArticle;
$wgArticle = $article;
*/
global $wgArticle;
$wgArticle = $article;
$this->performAction( $article );
wfProfileOut( __METHOD__ );
return $article;
$this->performAction( $article );
wfProfileOut( __METHOD__ );
return $article;
/**
* Run the current MediaWiki instance
/**
* Run the current MediaWiki instance
- * index.php just calls this
- */
+ * index.php just calls this
+ */
function run() {
try {
$this->checkMaxLag( true );
function run() {
try {
$this->checkMaxLag( true );
} catch ( Exception $e ) {
MWExceptionHandler::handle( $e );
}
} catch ( Exception $e ) {
MWExceptionHandler::handle( $e );
}
- * Checks if the request should abort due to a lagged server,
+ * Checks if the request should abort due to a lagged server,
* for given maxlag parameter.
* for given maxlag parameter.
- *
- * @param boolean $abort True if this class should abort the
+ *
+ * @param boolean $abort True if this class should abort the
* script execution. False to return the result as a boolean.
* @return boolean True if we passed the check, false if we surpass the maxlag
*/
function checkMaxLag( $abort ) {
global $wgShowHostnames;
* script execution. False to return the result as a boolean.
* @return boolean True if we passed the check, false if we surpass the maxlag
*/
function checkMaxLag( $abort ) {
global $wgShowHostnames;
wfProfileIn( __METHOD__ );
$maxLag = $this->context->getRequest()->getVal( 'maxlag' );
if ( !is_null( $maxLag ) ) {
wfProfileIn( __METHOD__ );
$maxLag = $this->context->getRequest()->getVal( 'maxlag' );
if ( !is_null( $maxLag ) ) {
echo "Waiting for a database server: $lag seconds lagged\n";
}
}
echo "Waiting for a database server: $lag seconds lagged\n";
}
}
wfProfileOut( __METHOD__ );
wfProfileOut( __METHOD__ );
function main() {
global $wgUseFileCache, $wgTitle, $wgUseAjax;
function main() {
global $wgUseFileCache, $wgTitle, $wgUseAjax;
wfProfileIn( __METHOD__ );
wfProfileIn( __METHOD__ );
# Set title from request parameters
$wgTitle = $this->getTitle();
$action = $this->getAction();
# Set title from request parameters
$wgTitle = $this->getTitle();
$action = $this->getAction();
# Send Ajax requests to the Ajax dispatcher.
if ( $wgUseAjax && $action == 'ajax' ) {
$dispatcher = new AjaxDispatcher();
# Send Ajax requests to the Ajax dispatcher.
if ( $wgUseAjax && $action == 'ajax' ) {
$dispatcher = new AjaxDispatcher();
wfProfileOut( __METHOD__ );
return;
}
wfProfileOut( __METHOD__ );
return;
}
if ( $wgUseFileCache && $wgTitle !== null ) {
wfProfileIn( 'main-try-filecache' );
// Raw pages should handle cache control on their own,
if ( $wgUseFileCache && $wgTitle !== null ) {
wfProfileIn( 'main-try-filecache' );
// Raw pages should handle cache control on their own,
}
wfProfileOut( 'main-try-filecache' );
}
}
wfProfileOut( 'main-try-filecache' );
}
$this->performRequest();
$this->finalCleanup();
$this->performRequest();
$this->finalCleanup();
wfProfileOut( __METHOD__ );
}
}
wfProfileOut( __METHOD__ );
}
}