2declare( strict_types = 1 );
4namespace MediaWiki\Extension\Translate\MessageGroupProcessing;
7use MediaWiki\Context\RequestContext;
10use MediaWiki\MediaWikiServices;
11use MediaWiki\Title\Title;
12use MediaWiki\User\User;
13use Wikimedia\ScopedCallback;
44 'source' => $source->getPrefixedText(),
45 'target' => $target->getPrefixedText(),
47 'redirects' => $redirects,
49 'performer' => $performer->getName(),
53 return new self( $target, $params );
56 public function __construct( Title $title, array $params = [] ) {
57 parent::__construct(
'MoveTranslatableBundleJob', $title, $params );
58 $this->bundleMover = Services::getInstance()->getTranslatableBundleMover();
62 public function run() {
63 $sourceTitle = Title::newFromText( $this->params[
'source'] );
64 $targetTitle = Title::newFromText( $this->params[
'target'] );
66 $userFactory = MediaWikiServices::getInstance()->getUserFactory();
67 $performer = $userFactory->newFromName( $this->params[
'performer'] );
70 if ( isset( $this->params[
'session' ] ) ) {
71 $scope = RequestContext::importScopedSession( $this->params[
'session'] );
72 $this->addTeardownCallback(
static function () use ( &$scope ) {
73 ScopedCallback::consume( $scope );
77 $this->bundleMover->moveSynchronously(
80 $this->params[
'moves'],
81 $this->params[
'redirects'] ?? [],
83 $this->params[
'summary']
Contains the core logic to validate and move translatable bundles.