Merge "1.24 -> 1.25"
[lhc/web/wiklou.git] / includes / MediaWiki.php
index 8ec6d35..9585c5f 100644 (file)
@@ -59,7 +59,7 @@ class MediaWiki {
                $request = $this->context->getRequest();
                $curid = $request->getInt( 'curid' );
                $title = $request->getVal( 'title' );
-               $action = $this->getAction();
+               $action = $request->getVal( 'action', 'view' );
 
                if ( $request->getCheck( 'search' ) ) {
                        // Compatibility with old search URLs which didn't use Special:Search
@@ -229,7 +229,7 @@ class MediaWiki {
                                throw new BadTitleError();
                        }
                // Redirect loops, no title in URL, $wgUsePathInfo URLs, and URLs with a variant
-               } elseif ( $this->getAction() === 'view' && !$request->wasPosted()
+               } elseif ( $request->getVal( 'action', 'view' ) == 'view' && !$request->wasPosted()
                        && ( $request->getVal( 'title' ) === null
                                || $title->getPrefixedDBkey() != $request->getVal( 'title' ) )
                        && !count( $request->getValueNames( array( 'action', 'title' ) ) )
@@ -330,7 +330,7 @@ class MediaWiki {
 
                // Namespace might change when using redirects
                // Check for redirects ...
-               $action = $this->getAction();
+               $action = $request->getVal( 'action', 'view' );
                $file = ( $title->getNamespace() == NS_FILE ) ? $article->getFile() : null;
                if ( ( $action == 'view' || $action == 'render' ) // ... for actions that show content
                        && !$request->getVal( 'oldid' ) // ... and are not old revisions
@@ -416,7 +416,7 @@ class MediaWiki {
                        return;
                }
 
-               if ( wfRunHooks( 'UnknownAction', array( $this->getAction(), $page ) ) ) {
+               if ( wfRunHooks( 'UnknownAction', array( $request->getVal( 'action', 'view' ), $page ) ) ) {
                        $output->setStatusCode( 404 );
                        $output->showErrorPage( 'nosuchaction', 'nosuchactiontext' );
                }
@@ -489,7 +489,8 @@ class MediaWiki {
                $request = $this->context->getRequest();
 
                // Send Ajax requests to the Ajax dispatcher.
-               if ( $this->config->get( 'UseAjax' ) && $this->getAction() === 'ajax' ) {
+               if ( $this->config->get( 'UseAjax' ) && $request->getVal( 'action', 'view' ) == 'ajax' ) {
+
                        // Set a dummy title, because $wgTitle == null might break things
                        $title = Title::makeTitle( NS_MAIN, 'AJAX' );
                        $this->context->setTitle( $title );
@@ -681,7 +682,7 @@ class MediaWiki {
                }
 
                $url = wfAppendQuery( wfScript( 'index' ), $query );
-               $req = "POST $url HTTP/1.1\r\nHost: {$info['host']}\r\nConnection: Close\r\n\r\n";
+               $req = "POST $url HTTP/1.1\r\nHost: {$info['host']}\r\nConnection: Close\r\nContent-Length: 0\r\n\r\n";
 
                wfDebugLog( 'runJobs', "Running $n job(s) via '$url'\n" );
                // Send a cron API request to be performed in the background.