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

Change subject: Make GWToolset properly record events in CU log
......................................................................


Make GWToolset properly record events in CU log

Bug: T126450
Change-Id: Ib5c5ae3ee02dc4201add88b66556b04efd86afe3
---
M includes/Jobs/UploadMediafileJob.php
M includes/Jobs/UploadMetadataJob.php
2 files changed, 23 insertions(+), 0 deletions(-)

Approvals:
  Legoktm: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/Jobs/UploadMediafileJob.php 
b/includes/Jobs/UploadMediafileJob.php
index ca2e4d0..fa7044a 100755
--- a/includes/Jobs/UploadMediafileJob.php
+++ b/includes/Jobs/UploadMediafileJob.php
@@ -22,6 +22,7 @@
 use ScopedCallback;
 use Title;
 use User;
+use RequestContext;
 
 class UploadMediafileJob extends Job {
 
@@ -38,6 +39,9 @@
         * @param {int} $id
         */
        public function __construct( $title, $params, $id = 0 ) {
+               if ( !isset( $params['session'] ) ) {
+                       $params['session'] = 
RequestContext::getMain()->exportSession();
+               }
                parent::__construct( 'gwtoolsetUploadMediafileJob', $title, 
$params, $id );
        }
 
@@ -117,6 +121,13 @@
                        return $result;
                }
 
+               if ( isset( $this->params['session'] ) ) {
+                       $sessionScope = RequestContext::importScopedSession( 
$this->params['session'] );
+                       $this->addTeardownCallback( function () use ( 
&$sessionScope ) {
+                               ScopedCallback::consume( $sessionScope ); // 
T126450
+                       } );
+               }
+
                $this->User = User::newFromName( $this->params['user-name'] );
 
                try {
diff --git a/includes/Jobs/UploadMetadataJob.php 
b/includes/Jobs/UploadMetadataJob.php
index f44623d..5577bcc 100644
--- a/includes/Jobs/UploadMetadataJob.php
+++ b/includes/Jobs/UploadMetadataJob.php
@@ -20,6 +20,8 @@
 use Exception;
 use Title;
 use User;
+use RequestContext;
+use ScopedCallback;
 
 /**
  * runs the MetadataMappingHandler with the originally $_POST’ed form fields 
when
@@ -46,6 +48,9 @@
         * @param {int} $id
         */
        public function __construct( $title, $params, $id = 0 ) {
+               if ( !isset( $params['session'] ) ) {
+                       $params['session'] = 
RequestContext::getMain()->exportSession();
+               }
                parent::__construct( 'gwtoolsetUploadMetadataJob', $title, 
$params, $id );
        }
 
@@ -126,6 +131,13 @@
                        return $result;
                }
 
+               if ( isset( $this->params['session'] ) ) {
+                       $sessionScope = RequestContext::importScopedSession( 
$this->params['session'] );
+                       $this->addTeardownCallback( function () use ( 
&$sessionScope ) {
+                               ScopedCallback::consume( $sessionScope ); // 
T126450
+                       } );
+               }
+
                $this->User = User::newFromName( $this->params['user-name'] );
                $job_queue_size = JobQueueGroup::singleton()->get( 
'gwtoolsetUploadMediafileJob' )->getSize();
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib5c5ae3ee02dc4201add88b66556b04efd86afe3
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/GWToolset
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff <[email protected]>
Gerrit-Reviewer: Bartosz Dziewoński <[email protected]>
Gerrit-Reviewer: Brian Wolff <[email protected]>
Gerrit-Reviewer: Gergő Tisza <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to