Fix fatal "Call to setExpectation() on non-object" in MediaWiki::main()
authorTimo Tijhof <krinklemail@gmail.com>
Fri, 27 Feb 2015 14:02:24 +0000 (14:02 +0000)
committerTimo Tijhof <krinklemail@gmail.com>
Fri, 27 Feb 2015 14:03:03 +0000 (14:03 +0000)
Follows-up b403a757726e2762888e0d0ee50d.

Caught by the qunit tests via Special:RunJobs. The test is still
work-in-progress (T50002) but it's already paying off :)

Change-Id: Idb37ecb97ff77950a981bfe10a46f27e532e1abb

includes/MediaWiki.php

index 9428d49..3b463ae 100644 (file)
@@ -489,12 +489,13 @@ class MediaWiki {
                $action = $this->getAction();
                $wgTitle = $title;
 
+               $trxProfiler = Profiler::instance()->getTransactionProfiler();
+
                // Aside from rollback, master queries should not happen on GET requests.
                // Periodic or "in passing" updates on GET should use the job queue.
                if ( !$request->wasPosted()
                        && in_array( $action, array( 'view', 'edit', 'history' ) )
                ) {
-                       $trxProfiler = Profiler::instance()->getTransactionProfiler();
                        $trxProfiler->setExpectation( 'masterConns', 0, __METHOD__ );
                        $trxProfiler->setExpectation( 'writes', 0, __METHOD__ );
                } else {