// Check variant links so that interwiki links don't have to worry
// about the possible different language variants
if ( count( $wgContLang->getVariants() ) > 1
- && !is_null( $ret ) && $ret->getArticleID() == 0 )
- {
+ && !is_null( $ret ) && $ret->getArticleID() == 0
+ ) {
$wgContLang->findVariantLink( $title, $ret );
}
}
}
// Use the main page as default title if nothing else has been provided
- if ( $ret === null && strval( $title ) === '' && $action !== 'delete' ) {
+ if ( $ret === null && strval( $title ) === '' && !$request->getCheck( 'curid' ) && $action !== 'delete' ) {
$ret = Title::newMainPage();
}
- if ( $ret === null || ( $ret->getDBkey() == '' && $ret->getInterwiki() == '' ) ) {
+ if ( $ret === null || ( $ret->getDBkey() == '' && !$ret->isExternal() ) ) {
$ret = SpecialPage::getTitleFor( 'Badtitle' );
}
return $action;
}
- /**
- * Create an Article object of the appropriate class for the given page.
- *
- * @deprecated in 1.18; use Article::newFromTitle() instead
- * @param $title Title
- * @param $context IContextSource
- * @return Article object
- */
- public static function articleFromTitle( $title, IContextSource $context ) {
- wfDeprecated( __METHOD__, '1.18' );
- return Article::newFromTitle( $title, $context );
- }
-
/**
* Performs the request.
* - bad titles
wfRunHooks( 'BeforeInitialize', array( &$title, &$unused, &$output, &$user, $request, $this ) );
// Invalid titles. Bug 21776: The interwikis must redirect even if the page name is empty.
- if ( is_null( $title ) || ( $title->getDBkey() == '' && $title->getInterwiki() == '' ) ||
- $title->isSpecial( 'Badtitle' ) )
- {
+ if ( is_null( $title ) || ( $title->getDBkey() == '' && !$title->isExternal() )
+ || $title->isSpecial( 'Badtitle' )
+ ) {
$this->context->setTitle( SpecialPage::getTitleFor( 'Badtitle' ) );
wfProfileOut( __METHOD__ );
throw new BadTitleError();
$pageView = false; // was an article or special page viewed?
// Interwiki redirects
- if ( $title->getInterwiki() != '' ) {
+ if ( $title->isExternal() ) {
$rdfrom = $request->getVal( 'rdfrom' );
if ( $rdfrom ) {
$url = $title->getFullURL( array( 'rdfrom' => $rdfrom ) );
}
// Check for a redirect loop
if ( !preg_match( '/^' . preg_quote( $wgServer, '/' ) . '/', $url )
- && $title->isLocal() )
- {
+ && $title->isLocal()
+ ) {
// 301 so google et al report the target as the actual url.
$output->redirect( $url, 301 );
} else {
}
// 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' ) )
+ && ( $request->getVal( 'title' ) === null
+ || $title->getPrefixedDBkey() != $request->getVal( 'title' ) )
&& !count( $request->getValueNames( array( 'action', 'title' ) ) )
- && wfRunHooks( 'TestCanonicalRedirect', array( $request, $title, $output ) ) )
- {
+ && wfRunHooks( 'TestCanonicalRedirect', array( $request, $title, $output ) )
+ ) {
if ( $title->isSpecialPage() ) {
list( $name, $subpage ) = SpecialPageFactory::resolveAlias( $title->getDBkey() );
if ( $name ) {
$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
+ && !$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() ) )
- {
+ && !( is_object( $file ) && $file->exists() && !$file->getRedirected() )
+ ) {
// Give extensions a change to ignore/handle redirects as needed
$ignoreRedirect = $target = false;
$user = $this->context->getUser();
if ( !wfRunHooks( 'MediaWikiPerformAction',
- array( $output, $page, $title, $user, $request, $this ) ) )
- {
+ array( $output, $page, $title, $user, $request, $this ) )
+ ) {
wfProfileOut( __METHOD__ );
return;
}
}
if ( !wfShellExecDisabled() && is_executable( $wgPhpCli ) ) {
- // Start a background process to run some of the jobs.
- // This will be asynchronous on *nix though not on Windows.
+ // Start a background process to run some of the jobs
wfProfileIn( __METHOD__ . '-exec' );
$retVal = 1;
$cmd = wfShellWikiCmd( "$IP/maintenance/runJobs.php", array( '--maxjobs', $n ) );
- wfShellExec( "$cmd &", $retVal );
+ $cmd .= " >" . wfGetNull() . " 2>&1"; // don't hang PHP on pipes
+ if ( wfIsWindows() ) {
+ // Using START makes this async and also works around a bug where using
+ // wfShellExec() with a quoted script name causes a filename syntax error.
+ $cmd = "START /B \"bg\" $cmd";
+ } else {
+ $cmd = "$cmd &";
+ }
+ wfShellExec( $cmd, $retVal );
wfProfileOut( __METHOD__ . '-exec' );
} else {
try {