2declare( strict_types = 1 );
4namespace MediaWiki\Extension\Translate\MessageProcessing;
9use TitleArrayFromResult;
28 $namespace = $sourceMessageHandle->
getTitle()->getNamespace();
30 $titles = self::getMatchingTitles( $sourceMessageHandle );
32 foreach ( $titles as $title ) {
37 if ( $handle->getKey() !== $sourceMessageHandle->
getKey() ) {
40 $targetTitle = Title::makeTitle(
42 Utilities::title( $replacement, $handle->getCode(), $namespace )
44 $titlesForMove[] = [ $title, $targetTitle ];
47 return $titlesForMove;
50 private static function getMatchingTitles(
MessageHandle $handle ): TitleArrayFromResult {
51 $dbr = wfGetDB( DB_PRIMARY );
52 $result = $dbr->newSelectQueryBuilder()
53 ->select( [
'page_title',
'page_namespace',
'page_id' ] )
56 'page_namespace' => $handle->
getTitle()->getNamespace(),
57 'page_title ' . $dbr->buildLike(
61 ->caller( __METHOD__ )
64 return new TitleArrayFromResult( $result );
Class for pointing to messages, like Title class is for titles.
getTitle()
Get the original title.
getTitleForBase()
Get the title for the page base.
getKey()
Returns the identified or guessed message key.