Fix change in magic words API

Fix for mediawiki 1.35

Manually running the CLI script caused this error:
Error from line 152 of extensions/LinkTitles/includes/Source.php: Call to undefined method MagicWord::get()

It seems like an API change so I found this in another extension with
the same error

https://gerrit.wikimedia.org/r/c/mediawiki/extensions/MagicNoCache/+/574232/2/MagicNoCache.hooks.php
This commit is contained in:
Adrian Cornish
2020-11-29 08:13:32 -07:00
parent c1bc8f872e
commit 5a6e69daf6
2 changed files with 2 additions and 2 deletions

View File

@ -149,7 +149,7 @@ class Source {
* @return boolean True if the page contains the __NOAUTOLINKS__ magic word. * @return boolean True if the page contains the __NOAUTOLINKS__ magic word.
*/ */
public function hasNoAutolinksMagicWord() { public function hasNoAutolinksMagicWord() {
return \MagicWord::get( 'MAG_LINKTITLES_NOAUTOLINKS' )->match( $this->getText() ); return \MediaWiki\MediaWikiServices::getInstance()->getMagicWordFactory()->get( 'MAG_LINKTITLES_NOAUTOLINKS' )->match( $this->getText() );
} }
/** /**

View File

@ -210,7 +210,7 @@ class Target {
// page does indeed contain this magic word, return the page title // page does indeed contain this magic word, return the page title
// as-is (unlinked). // as-is (unlinked).
if ( $this->config->enableNoTargetMagicWord ) { if ( $this->config->enableNoTargetMagicWord ) {
if ( $this->getContent()->matchMagicWord( \MagicWord::get('MAG_LINKTITLES_NOTARGET') ) ) { if ( $this->getContent()->matchMagicWord( \MediaWiki\MediaWikiServices::getInstance()->getMagicWordFactory()->get('MAG_LINKTITLES_NOTARGET') ) ) {
return false; return false;
} }
}; };