Alex Monk has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/198464

Change subject: Don't emit warnings when viewing old AbuseLog entries
......................................................................

Don't emit warnings when viewing old AbuseLog entries

Warning: Untested. Looks like it should work based on the data in production
though
E.g. check enwiki afl_id=6426786, old_id=482371851, DB://cluster22/203012734
var_dump( unserialize( gzinflate( ExternalStore::fetchFromURL(
        "DB://cluster22/203012734"
) ) )->mVars["new_html"]->mParameters );

Follows up r102497

Bug: T75473
Change-Id: I84305a754a1f8aa1c58edd702380e288de770e2a
---
M AbuseFilterVariableHolder.php
1 file changed, 23 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/AbuseFilter 
refs/changes/64/198464/1

diff --git a/AbuseFilterVariableHolder.php b/AbuseFilterVariableHolder.php
index f77c1b9..b3702c9 100644
--- a/AbuseFilterVariableHolder.php
+++ b/AbuseFilterVariableHolder.php
@@ -363,10 +363,17 @@
                                // This should ONLY be used when sharing a 
parse operation with the edit.
 
                                /* @var WikiPage $article */
-                               $article = $parameters['article'];
-                               if ( $article !== null
-                                       && ( !defined( 
'MW_SUPPORTS_CONTENTHANDLER' )
-                                               || $article->getContentModel() 
=== CONTENT_MODEL_WIKITEXT )
+                               if ( isset( $parameters['article'] ) ) {
+                                       $article = $parameters['article'];
+                               } else {
+                                       $article = self::articleFromTitle(
+                                               $parameters['namespace'],
+                                               $parameters['title']
+                                       );
+                               }
+                               if (
+                                       !defined( 'MW_SUPPORTS_CONTENTHANDLER' 
) ||
+                                       $article->getContentModel() === 
CONTENT_MODEL_WIKITEXT
                                ) {
                                        $textVar = $parameters['text-var'];
 
@@ -428,11 +435,18 @@
                                break;
                        case 'parse-wikitext':
                                // Should ONLY be used when sharing a parse 
operation with the edit.
-                               $article = $parameters['article'];
-
-                               if ( $article !== null
-                                       && ( !defined( 
'MW_SUPPORTS_CONTENTHANDLER' )
-                                               || $article->getContentModel() 
=== CONTENT_MODEL_WIKITEXT ) ) {
+                               if ( isset( $parameters['article'] ) ) {
+                                       $article = $parameters['article'];
+                               } else {
+                                       $article = self::articleFromTitle(
+                                               $parameters['namespace'],
+                                               $parameters['title']
+                                       );
+                               }
+                               if (
+                                       !defined( 'MW_SUPPORTS_CONTENTHANDLER' 
) ||
+                                       $article->getContentModel() === 
CONTENT_MODEL_WIKITEXT
+                               ) {
                                        $textVar = $parameters['wikitext-var'];
 
                                        // XXX: Use prepareContentForEdit. But 
we need a Content object for that.

-- 
To view, visit https://gerrit.wikimedia.org/r/198464
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I84305a754a1f8aa1c58edd702380e288de770e2a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/AbuseFilter
Gerrit-Branch: master
Gerrit-Owner: Alex Monk <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to