X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fpage%2FWikiPage.php;h=f0164944325caadaa70cebf329768aadfe28042d;hp=b72f7bd36f8b7970e1cf52caccde7635e2f338a4;hb=3a4105ba01fc92f2d41e0faee316d02e29f82fe5;hpb=def66030794051d9818075bb886a7d6e4f585a06 diff --git a/includes/page/WikiPage.php b/includes/page/WikiPage.php index b72f7bd36f..f016494432 100644 --- a/includes/page/WikiPage.php +++ b/includes/page/WikiPage.php @@ -624,7 +624,7 @@ class WikiPage implements Page, IDBAccessObject { // 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 ) { @@ -938,8 +938,8 @@ class WikiPage implements Page, IDBAccessObject { $dbw->startAtomic( __METHOD__ ); if ( !$oldLatest || $oldLatest == $this->lockAndGetLatest() ) { - $dbw->replace( 'redirect', - [ 'rd_from' ], + $dbw->upsert( + 'redirect', [ 'rd_from' => $this->getId(), 'rd_namespace' => $rt->getNamespace(), @@ -947,6 +947,13 @@ class WikiPage implements Page, IDBAccessObject { '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__ ); } @@ -2485,13 +2492,13 @@ class WikiPage implements Page, IDBAccessObject { } 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'; } @@ -2675,16 +2682,14 @@ class WikiPage implements Page, IDBAccessObject { 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; } @@ -2863,7 +2868,7 @@ class WikiPage implements Page, IDBAccessObject { */ public function doDeleteArticleReal( $reason, $suppress = false, $u1 = null, $u2 = null, &$error = '', User $user = null, - $tags = [] + $tags = [], $logsubtype = 'delete' ) { global $wgUser, $wgContentHandlerUseDB; @@ -2994,7 +2999,7 @@ class WikiPage implements Page, IDBAccessObject { // 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 );