* @return Title
*/
public function getTitle() {
- if( $this->context->getTitle() === null ){
+ if ( $this->context->getTitle() === null ) {
$this->context->setTitle( $this->parseTitle() );
}
return $this->context->getTitle();
// Redirect loops, no title in URL, $wgUsePathInfo URLs, and URLs with a variant
} elseif ( $request->getVal( 'action', 'view' ) == 'view' && !$request->wasPosted()
&& ( $request->getVal( 'title' ) === null ||
- $title->getPrefixedDBKey() != $request->getVal( 'title' ) )
+ $title->getPrefixedDBkey() != $request->getVal( 'title' ) )
&& !count( $request->getValueNames( array( 'action', 'title' ) ) )
&& wfRunHooks( 'TestCanonicalRedirect', array( $request, $title, $output ) ) )
{
// Check for redirects ...
$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
- !$request->getVal( 'diff' ) && // ... and not when showing diff
- $request->getVal( 'redirect' ) != 'no' && // ... unless explicitly told not to
+ if ( ( $action == 'view' || $action == 'render' ) // ... for actions that show content
+ && !$request->getVal( 'oldid' ) && // ... and are not old revisions
+ !$request->getVal( 'diff' ) && // ... and not when showing diff
+ $request->getVal( 'redirect' ) != 'no' && // ... unless explicitly told not to
// ... and the article is not a non-redirect image page with associated file
!( is_object( $file ) && $file->exists() && !$file->getRedirected() ) )
{
$resp->header( 'Retry-After: ' . max( intval( $maxLag ), 5 ) );
$resp->header( 'X-Database-Lag: ' . intval( $lag ) );
$resp->header( 'Content-Type: text/plain' );
- if( $wgShowHostnames ) {
+ if ( $wgShowHostnames ) {
echo "Waiting for $host: $lag seconds lagged\n";
} else {
echo "Waiting for a database server: $lag seconds lagged\n";
&& $request->getMethod() == 'GET'
) {
$redirUrl = $request->getFullRequestURL();
- $redirUrl = str_replace( 'http://' , 'https://' , $redirUrl );
+ $redirUrl = str_replace( 'http://', 'https://', $redirUrl );
// Setup dummy Title, otherwise OutputPage::redirect will fail
$title = Title::newFromText( NS_MAIN, 'REDIR' );
}
$group = JobQueueGroup::singleton();
- $types = $group->getDefaultQueueTypes();
- shuffle( $types ); // avoid starvation
-
- // Scan the queues for a job N times...
do {
- $jobFound = false; // found a job in any queue?
- // Find a queue with a job on it and run it...
- foreach ( $types as $i => $type ) {
- $queue = $group->get( $type );
- if ( $queue->isEmpty() ) {
- unset( $types[$i] ); // don't keep checking this queue
- continue;
- }
- $job = $queue->pop();
- if ( $job ) {
- $jobFound = true;
- $output = $job->toString() . "\n";
- $t = - microtime( true );
- $success = $job->run();
- $queue->ack( $job ); // done
- $t += microtime( true );
- $t = round( $t * 1000 );
- if ( !$success ) {
- $output .= "Error: " . $job->getLastError() . ", Time: $t ms\n";
- } else {
- $output .= "Success, Time: $t ms\n";
- }
- wfDebugLog( 'jobqueue', $output );
- break;
+ $job = $group->pop( JobQueueGroup::USE_CACHE ); // job from any queue
+ if ( $job ) {
+ $output = $job->toString() . "\n";
+ $t = - microtime( true );
+ wfProfileIn( __METHOD__ . '-' . get_class( $job ) );
+ $success = $job->run();
+ wfProfileOut( __METHOD__ . '-' . get_class( $job ) );
+ $group->ack( $job ); // done
+ $t += microtime( true );
+ $t = round( $t * 1000 );
+ if ( $success === false ) {
+ $output .= "Error: " . $job->getLastError() . ", Time: $t ms\n";
} else {
- unset( $types[$i] ); // don't keep checking this queue
+ $output .= "Success, Time: $t ms\n";
}
+ wfDebugLog( 'jobqueue', $output );
}
- } while ( --$n && $jobFound );
+ } while ( --$n && $job );
}
}