jenkins-bot has submitted this change and it was merged.

Change subject: XML text dumps: skip rev length check for weird content models
......................................................................


XML text dumps: skip rev length check for weird content models

Change-Id: I199531901d91185a578e7857bc15f28ce2021eef
---
M maintenance/backupTextPass.inc
1 file changed, 19 insertions(+), 1 deletion(-)

Approvals:
  Demon: Looks good to me, approved
  Daniel Kinzler: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/maintenance/backupTextPass.inc b/maintenance/backupTextPass.inc
index c5e48f4..7aac4d4 100644
--- a/maintenance/backupTextPass.inc
+++ b/maintenance/backupTextPass.inc
@@ -414,6 +414,8 @@
         * @throws MWException
         */
        function getText( $id ) {
+               global $wgContentHandlerUseDB;
+
                $prefetchNotTried = true; // Whether or not we already tried to 
get the text via prefetch.
                $text = false; // The candidate for a good text. false if no 
proper value.
                $failures = 0; // The number of times, this invocation of 
getText already failed.
@@ -479,7 +481,23 @@
                                if ( ! isset( $this->db ) ) {
                                        throw new MWException( "No database 
available" );
                                }
-                               $revLength = $this->db->selectField( 
'revision', 'rev_len', array( 'rev_id' => $revID ) );
+
+                               $revLength = strlen( $text );
+                               if ( $wgContentHandlerUseDB ) {
+                                       $row  = $this->db->selectRow( 
'revision', array( 'rev_len', 'rev_content_model' ), array( 'rev_id' => $revID 
), __METHOD__ );
+                                       if ( $row ) {
+                                               // only check the length for 
the wikitext content handler,
+                                               // it's a wasted (and failed) 
check otherwise
+                                               if ( $row->rev_content_model == 
CONTENT_MODEL_WIKITEXT ) {
+                                                       $revLength = 
$row->rev_len;
+                                               }
+                                       }
+
+                               }
+                               else {
+                                       $revLength = $this->db->selectField( 
'revision', 'rev_len', array( 'rev_id' => $revID ) );
+                               }
+
                                if ( strlen( $text ) == $revLength ) {
                                        if ( $tryIsPrefetch ) {
                                                $this->prefetchCount++;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I199531901d91185a578e7857bc15f28ce2021eef
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: ArielGlenn <[email protected]>
Gerrit-Reviewer: ArielGlenn <[email protected]>
Gerrit-Reviewer: Daniel Kinzler <[email protected]>
Gerrit-Reviewer: Demon <[email protected]>
Gerrit-Reviewer: Reedy <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to