X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fpage%2FWikiPage.php;h=6fc36f685849efd1fc4fdd3d4324c3fd1e6f5325;hb=670c94ebf528155b9a9017784591e23ef57b9884;hp=5a0670ca8f8ea7af1ff0f98b2f970bd2c2527932;hpb=c2720d56865fb62e7044620b2d18ac71815c2dc2;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/page/WikiPage.php b/includes/page/WikiPage.php index 5a0670ca8f..6fc36f6858 100644 --- a/includes/page/WikiPage.php +++ b/includes/page/WikiPage.php @@ -213,6 +213,7 @@ class WikiPage implements Page, IDBAccessObject { * @todo Move this UI stuff somewhere else * * @see ContentHandler::getActionOverrides + * @return array */ public function getActionOverrides() { return $this->getContentHandler()->getActionOverrides(); @@ -1070,7 +1071,8 @@ class WikiPage implements Page, IDBAccessObject { } if ( $useParserCache ) { - $parserOutput = ParserCache::singleton()->get( $this, $parserOptions ); + $parserOutput = MediaWikiServices::getInstance()->getParserCache() + ->get( $this, $parserOptions ); if ( $parserOutput !== false ) { return $parserOutput; } @@ -1657,7 +1659,7 @@ class WikiPage implements Page, IDBAccessObject { // Convenience variables $now = wfTimestampNow(); $oldid = $meta['oldId']; - /** @var $oldContent Content|null */ + /** @var Content|null $oldContent */ $oldContent = $meta['oldContent']; $newsize = $content->getSize(); @@ -2162,7 +2164,7 @@ class WikiPage implements Page, IDBAccessObject { // Save it to the parser cache. // Make sure the cache time matches page_touched to avoid double parsing. - ParserCache::singleton()->save( + MediaWikiServices::getInstance()->getParserCache()->save( $editInfo->output, $this, $editInfo->popts, $revision->getTimestamp(), $editInfo->revid ); @@ -2297,7 +2299,7 @@ class WikiPage implements Page, IDBAccessObject { public function doUpdateRestrictions( array $limit, array $expiry, &$cascade, $reason, User $user, $tags = null ) { - global $wgCascadingRestrictionLevels, $wgContLang; + global $wgCascadingRestrictionLevels; if ( wfReadOnly() ) { return Status::newFatal( wfMessage( 'readonlytext', wfReadOnlyReason() ) ); @@ -2370,9 +2372,6 @@ class WikiPage implements Page, IDBAccessObject { $logAction = 'protect'; } - // Truncate for whole multibyte characters - $reason = $wgContLang->truncate( $reason, 255 ); - $logRelationsValues = []; $logRelationsField = null; $logParamsDetails = []; @@ -2735,6 +2734,7 @@ class WikiPage implements Page, IDBAccessObject { * @param array|string &$error Array of errors to append to * @param User $user The deleting user * @param array $tags Tags to apply to the deletion action + * @param string $logsubtype * @return Status Status object; if successful, $status->value is the log_id of the * deletion log entry. If the page couldn't be deleted because it wasn't * found, $status is a non-fatal 'cannotdelete' error @@ -2836,9 +2836,14 @@ class WikiPage implements Page, IDBAccessObject { 'FOR UPDATE', $commentQuery['joins'] ); + // Build their equivalent archive rows $rowsInsert = []; $revids = []; + + /** @var int[] Revision IDs of edits that were made by IPs */ + $ipRevIds = []; + foreach ( $res as $row ) { $comment = $revCommentStore->getComment( $row ); $rowInsert = [ @@ -2864,6 +2869,12 @@ class WikiPage implements Page, IDBAccessObject { } $rowsInsert[] = $rowInsert; $revids[] = $row->rev_id; + + // Keep track of IP edits, so that the corresponding rows can + // be deleted in the ip_changes table. + if ( (int)$row->rev_user === 0 && IP::isValid( $row->rev_user_text ) ) { + $ipRevIds[] = $row->rev_id; + } } // Copy them into the archive table $dbw->insert( 'archive', $rowsInsert, __METHOD__ ); @@ -2882,6 +2893,11 @@ class WikiPage implements Page, IDBAccessObject { $dbw->delete( 'revision_comment_temp', [ 'revcomment_rev' => $revids ], __METHOD__ ); } + // Also delete records from ip_changes as applicable. + if ( count( $ipRevIds ) > 0 ) { + $dbw->delete( 'ip_changes', [ 'ipc_rev_id' => $ipRevIds ], __METHOD__ ); + } + // Log the deletion, if the page was suppressed, put it in the suppression log instead $logtype = $suppress ? 'suppress' : 'delete'; @@ -3145,9 +3161,6 @@ class WikiPage implements Page, IDBAccessObject { // Trim spaces on user supplied text $summary = trim( $summary ); - // Truncate for whole multibyte characters. - $summary = $wgContLang->truncate( $summary, 255 ); - // Save $flags = EDIT_UPDATE | EDIT_INTERNAL;