X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialImport.php;h=a2930fcebe0cd8d7fe6bd74b3c761d084b21edf3;hb=512a187a2f58b020fb866f0fdc5703091f9e47e3;hp=ce886247a949d538089a7e664e98d1d3d5523a98;hpb=0e80bbf07dd6bfc5130561e7dfe5738e85518807;p=lhc%2Fweb%2Fwiklou.git
diff --git a/includes/specials/SpecialImport.php b/includes/specials/SpecialImport.php
index ce886247a9..a2930fcebe 100644
--- a/includes/specials/SpecialImport.php
+++ b/includes/specials/SpecialImport.php
@@ -536,6 +536,7 @@ class SpecialImport extends SpecialPage {
*/
class ImportReporter extends ContextSource {
private $reason = false;
+ private $logTags = [];
private $mOriginalLogCallback = null;
private $mOriginalPageOutCallback = null;
private $mLogItemCount = 0;
@@ -558,6 +559,16 @@ class ImportReporter extends ContextSource {
$this->reason = $reason;
}
+ /**
+ * Sets change tags to apply to the import log entry and null revision.
+ *
+ * @param array $tags
+ * @since 1.29
+ */
+ public function setChangeTags( array $tags ) {
+ $this->logTags = $tags;
+ }
+
function open() {
$this->getOutput()->addHTML( "
\n" );
}
@@ -628,14 +639,6 @@ class ImportReporter extends ContextSource {
. $this->reason;
}
- $logEntry = new ManualLogEntry( 'import', $action );
- $logEntry->setTarget( $title );
- $logEntry->setComment( $this->reason );
- $logEntry->setPerformer( $this->getUser() );
- $logEntry->setParameters( $logParams );
- $logid = $logEntry->insert();
- $logEntry->publish( $logid );
-
$comment = $detail; // quick
$dbw = wfGetDB( DB_MASTER );
$latest = $title->getLatestRevID();
@@ -647,8 +650,9 @@ class ImportReporter extends ContextSource {
$this->getUser()
);
+ $nullRevId = null;
if ( !is_null( $nullRevision ) ) {
- $nullRevision->insertOn( $dbw );
+ $nullRevId = $nullRevision->insertOn( $dbw );
$page = WikiPage::factory( $title );
# Update page record
$page->updateRevisionOn( $dbw, $nullRevision );
@@ -657,6 +661,22 @@ class ImportReporter extends ContextSource {
[ $page, $nullRevision, $latest, $this->getUser() ]
);
}
+
+ // Create the import log entry
+ $logEntry = new ManualLogEntry( 'import', $action );
+ $logEntry->setTarget( $title );
+ $logEntry->setComment( $this->reason );
+ $logEntry->setPerformer( $this->getUser() );
+ $logEntry->setParameters( $logParams );
+ $logid = $logEntry->insert();
+ if ( count( $this->logTags ) ) {
+ $logEntry->setTags( $this->logTags );
+ }
+ // Make sure the null revision will be tagged as well
+ $logEntry->setAssociatedRevId( $nullRevId );
+
+ $logEntry->publish( $logid );
+
} else {
$this->getOutput()->addHTML( "- " . $linkRenderer->makeKnownLink( $title ) . " " .
$this->msg( 'import-nonewrevisions' )->escaped() . "
\n" );