$url = str_replace( '$1', $dbkey, $wgArticlePath );
}
} else {
- $url = false;
-
global $wgActionPaths;
- if( !empty( $wgActionPaths ) ) {
- $url = Title::resolveActionPath( $dbkey, $query );
+ $url = false;
+ $matches = array();
+ if ( !empty( $wgActionPaths ) &&
+ preg_match( '/^(.*&|)action=([^&]*)(&(.*)|)$/', $query, $matches ) )
+ {
+ $action = urldecode( $matches[2] );
+ if ( isset( $wgActionPaths[$action] ) ) {
+ $query = $matches[1];
+ if ( isset( $matches[4] ) ) {
+ $query .= $matches[4];
+ }
+ $url = str_replace( '$1', $dbkey, $wgActionPaths[$action] );
+ if ( $query != '' ) {
+ $url = wfAppendQuery( $url, $query );
+ }
+ }
}
-
if ( $url === false ) {
if ( $query == '-' ) {
$query = '';
}
- #$url = "{$wgScript}?title={$dbkey}&{$query}";
- # forge a nice URL (ex: /wiki/Special:Foo?q=1&r=2 )
- $baseurl = str_replace( '$1', $dbkey, $wgArticlePath );
- $url = wfAppendQuery( $baseurl, $query );
+ $url = "{$wgScript}?title={$dbkey}&{$query}";
}
}
return $url;
}
- /**
- * Helper for getLocalUrl() to handles $wgActionPaths
- *
- * @param $dbkey string Title in database key format
- * @param $query string request parameters in CGI format (p=1&q=2&..)
- * @return Url resolved or boolean false
- */
- private static function resolveActionPath( $dbkey, $query ) {
- $url = '';
-
- # query parameters are easier to handle using an array:
- $queryArray = wfCGIToArray( $query );
-
- global $wgActionPaths;
- if( !array_key_exists( 'action', $queryArray ) ) {
- // Makes the default action 'view' and points to $wgArticlePath
- // FIXME: this should be handled in Setup or Wiki!
- global $wgArticlePath;
- $url = str_replace( '$1', $dbkey, $wgArticlePath );
- } elseif( isset( $wgActionPaths[$queryArray['action']] ) ) {
- $url = str_replace( '$1', $dbkey, $wgActionPaths[$queryArray['action']] );
- } else {
- # No path found
- return false;
- }
-
- # No need to append the action since we have embed it in the path
- unset( $queryArray['action'] );
- $url = wfAppendQuery( $url, wfArrayToCGI( $queryArray ) );
- return $url;
- }
-
/**
* Get a URL that's the simplest URL that will be valid to link, locally,
* to the current Title. It includes the fragment, but does not include
}
$link = '[[' . $wgContLang->getNsText( NS_USER ) . ":{$name}|{$name}]]";
- $blockid = $block->mId;
+ $blockid = $block->getId();
$blockExpiry = $user->mBlock->mExpiry;
$blockTimestamp = $wgLang->timeanddate( wfTimestamp( TS_MW, $user->mBlock->mTimestamp ), true );
if ( $blockExpiry == 'infinity' ) {
$blockExpiry = $wgLang->timeanddate( wfTimestamp( TS_MW, $blockExpiry ), true );
}
- $intended = $user->mBlock->mAddress;
+ $intended = $user->mBlock->getTarget();
$errors[] = array( ( $block->mAuto ? 'autoblockedtext' : 'blockedtext' ), $link, $reason, $ip, $name,
$blockid, $blockExpiry, $intended, $blockTimestamp );
}
$destFile = wfLocalFile( $nt );
- if ( !$wgUser->isAllowed( 'reupload-shared' ) && !$destfile->exists() && wfFindFile( $nt ) ) {
+ if ( !$wgUser->isAllowed( 'reupload-shared' ) && !$destFile->exists() && wfFindFile( $nt ) ) {
$errors[] = array( 'file-exists-sharedrepo' );
}
}
}
- $pageid = $this->getArticleID();
+ $dbw->begin(); # If $file was a LocalFile, its transaction would have closed our own.
+ $pageid = $this->getArticleID( GAID_FOR_UPDATE );
$protected = $this->isProtected();
$pageCountChange = ( $createRedirect ? 1 : 0 ) - ( $nt->exists() ? 1 : 0 );
// Do the actual move
$err = $this->moveToInternal( $nt, $reason, $createRedirect );
if ( is_array( $err ) ) {
+ # FIXME: What about the File we have already moved?
+ $dbw->rollback();
return $err;
}
$u = new SearchUpdate( $redirid, $this->getPrefixedDBkey(), '' );
$u->doUpdate();
+ $dbw->commit();
+
# Update site_stats
if ( $this->isContentPage() && !$nt->isContentPage() ) {
# No longer a content page
if ( $reason ) {
$comment .= wfMsgForContent( 'colon-separator' ) . $reason;
}
- # Truncate for whole multibyte characters. +5 bytes for ellipsis
- $comment = $wgContLang->truncate( $comment, 250 );
+ # Truncate for whole multibyte characters.
+ $comment = $wgContLang->truncate( $comment, 255 );
$oldid = $this->getArticleID();
$latest = $this->getLatestRevID();
$redirectSuppressed = false;
} else {
// Get rid of old new page entries in Special:NewPages and RC.
- // Needs to be before $this->resetArticleUD( 0 ).
+ // Needs to be before $this->resetArticleID( 0 ).
$dbw->delete( 'recentchanges', array(
'rc_timestamp' => $dbw->timestamp( $this->getEarliestRevTime() ),
'rc_namespace' => $oldns,