// SELECT. Thus we need S1 to also gets the revision row FOR UPDATE; otherwise, it
// may not find it since a page row UPDATE and revision row INSERT by S2 may have
// happened after the first S1 SELECT.
- // http://dev.mysql.com/doc/refman/5.0/en/set-transaction.html#isolevel_repeatable-read
+ // https://dev.mysql.com/doc/refman/5.0/en/set-transaction.html#isolevel_repeatable-read
$flags = Revision::READ_LOCKING;
$revision = Revision::newFromPageId( $this->getId(), $latest, $flags );
} elseif ( $this->mDataLoadedFrom == self::READ_LATEST ) {
$dbw->startAtomic( __METHOD__ );
if ( !$oldLatest || $oldLatest == $this->lockAndGetLatest() ) {
- $dbw->replace( 'redirect',
- [ 'rd_from' ],
+ $dbw->upsert(
+ 'redirect',
[
'rd_from' => $this->getId(),
'rd_namespace' => $rt->getNamespace(),
'rd_fragment' => $rt->getFragment(),
'rd_interwiki' => $rt->getInterwiki(),
],
+ [ 'rd_from' ],
+ [
+ 'rd_namespace' => $rt->getNamespace(),
+ 'rd_title' => $rt->getDBkey(),
+ 'rd_fragment' => $rt->getFragment(),
+ 'rd_interwiki' => $rt->getInterwiki(),
+ ],
__METHOD__
);
}
}
if ( !$protect ) { // No protection at all means unprotection
- $revCommentMsg = 'unprotectedarticle';
+ $revCommentMsg = 'unprotectedarticle-comment';
$logAction = 'unprotect';
} elseif ( $isProtected ) {
- $revCommentMsg = 'modifiedarticleprotection';
+ $revCommentMsg = 'modifiedarticleprotection-comment';
$logAction = 'modify';
} else {
- $revCommentMsg = 'protectedarticle';
+ $revCommentMsg = 'protectedarticle-comment';
$logAction = 'protect';
}
public function insertProtectNullRevision( $revCommentMsg, array $limit,
array $expiry, $cascade, $reason, $user = null
) {
- global $wgContLang;
$dbw = wfGetDB( DB_MASTER );
// Prepare a null revision to be added to the history
- $editComment = $wgContLang->ucfirst(
- wfMessage(
- $revCommentMsg,
- $this->mTitle->getPrefixedText()
- )->inContentLanguage()->text()
- );
+ $editComment = wfMessage(
+ $revCommentMsg,
+ $this->mTitle->getPrefixedText(),
+ $user ? $user->getName() : ''
+ )->inContentLanguage()->text();
if ( $reason ) {
$editComment .= wfMessage( 'colon-separator' )->inContentLanguage()->text() . $reason;
}
*/
public function doDeleteArticleReal(
$reason, $suppress = false, $u1 = null, $u2 = null, &$error = '', User $user = null,
- $tags = []
+ $tags = [], $logsubtype = 'delete'
) {
global $wgUser, $wgContentHandlerUseDB;
// Log the deletion, if the page was suppressed, put it in the suppression log instead
$logtype = $suppress ? 'suppress' : 'delete';
- $logEntry = new ManualLogEntry( $logtype, 'delete' );
+ $logEntry = new ManualLogEntry( $logtype, $logsubtype );
$logEntry->setPerformer( $user );
$logEntry->setTarget( $logTitle );
$logEntry->setComment( $reason );