Avoid fatals when the filter tags is empty
[lhc/web/wiklou.git] / includes / import / ImportableUploadRevisionImporter.php
index b64114c..95a171b 100644 (file)
@@ -17,6 +17,11 @@ class ImportableUploadRevisionImporter implements UploadRevisionImporter {
         */
        private $enableUploads;
 
+       /**
+        * @var bool
+        */
+       private $shouldCreateNullRevision = true;
+
        /**
         * @param bool $enableUploads
         * @param LoggerInterface $logger
@@ -29,6 +34,16 @@ class ImportableUploadRevisionImporter implements UploadRevisionImporter {
                $this->logger = $logger;
        }
 
+       /**
+        * Setting this to false will deactivate the creation of a null revision as part of the upload
+        * process logging in LocalFile::recordUpload2, see T193621
+        *
+        * @param bool $shouldCreateNullRevision
+        */
+       public function setNullRevisionCreation( $shouldCreateNullRevision ) {
+               $this->shouldCreateNullRevision = $shouldCreateNullRevision;
+       }
+
        /**
         * @return StatusValue
         */
@@ -100,7 +115,9 @@ class ImportableUploadRevisionImporter implements UploadRevisionImporter {
                                $flags,
                                false,
                                $importableRevision->getTimestamp(),
-                               $user
+                               $user,
+                               [],
+                               $this->shouldCreateNullRevision
                        );
                }