* @ingroup Parser
*/
+use MediaWiki\BadFileLookup;
use MediaWiki\Config\ServiceOptions;
use MediaWiki\Linker\LinkRendererFactory;
use MediaWiki\MediaWikiServices;
use MediaWiki\Special\SpecialPageFactory;
+use Psr\Log\LoggerInterface;
+use Psr\Log\NullLogger;
/**
* @since 1.32
/** @var NamespaceInfo */
private $nsInfo;
+ /** @var LoggerInterface */
+ private $logger;
+
+ /** @var BadFileLookup */
+ private $badFileLookup;
+
/**
* Old parameter list, which we support for backwards compatibility, were:
* array $parserConf See $wgParserConf documentation
* @param SpecialPageFactory $spFactory
* @param LinkRendererFactory $linkRendererFactory
* @param NamespaceInfo|LinkRendererFactory|null $nsInfo
+ * @param LoggerInterface|null $logger
+ * @param BadFileLookup|null $badFileLookup
* @since 1.32
*/
public function __construct(
- $svcOptions, MagicWordFactory $magicWordFactory, Language $contLang,
- $urlProtocols, SpecialPageFactory $spFactory, $linkRendererFactory,
- $nsInfo = null
+ $svcOptions,
+ MagicWordFactory $magicWordFactory,
+ Language $contLang,
+ $urlProtocols,
+ SpecialPageFactory $spFactory,
+ $linkRendererFactory,
+ $nsInfo = null,
+ $logger = null,
+ BadFileLookup $badFileLookup = null
) {
// @todo Do we need to retain compat for constructing this class directly?
if ( !$nsInfo ) {
$this->specialPageFactory = $spFactory;
$this->linkRendererFactory = $linkRendererFactory;
$this->nsInfo = $nsInfo;
+ $this->logger = $logger ?: new NullLogger();
+ $this->badFileLookup = $badFileLookup ??
+ MediaWikiServices::getInstance()->getBadFileLookup();
}
/**
* @since 1.32
*/
public function create() : Parser {
- return new Parser( $this->svcOptions, $this->magicWordFactory, $this->contLang, $this,
- $this->urlProtocols, $this->specialPageFactory, $this->linkRendererFactory,
- $this->nsInfo );
+ return new Parser(
+ $this->svcOptions,
+ $this->magicWordFactory,
+ $this->contLang,
+ $this,
+ $this->urlProtocols,
+ $this->specialPageFactory,
+ $this->linkRendererFactory,
+ $this->nsInfo,
+ $this->logger,
+ $this->badFileLookup
+ );
}
}