71 $file = $this->repoGroup->findFile( $name );
75 $name =
$file->getTitle()->getDBkey();
80 if ( !$this->hookRunner->onBadImage( $name, $bad ) ) {
84 if ( $this->badFiles ===
null ) {
86 $list = ( $this->listCallback )();
87 $key = $this->cache->makeKey(
'bad-image-list', sha1( $list ) );
88 $this->badFiles = $this->cache->get( $key ) ?:
null;
91 if ( $this->badFiles ===
null ) {
94 $lines = explode(
"\n", $list );
97 if ( substr(
$line, 0, 1 ) !==
'*' ) {
104 if ( !preg_match_all(
'/\[\[:?(.*?)\]\]/',
$line, $m ) ) {
110 foreach ( $m[1] as $i => $titleText ) {
112 $title = $this->titleParser->parseTitle( $titleText );
117 $fileDBkey =
$title->getDBkey();
119 $exceptions[
$title->getNamespace()][
$title->getDBkey()] =
true;
123 if ( $fileDBkey !==
null ) {
124 $this->badFiles[$fileDBkey] = $exceptions;
127 $this->cache->set( $key, $this->badFiles, 24 * 60 * 60 );
130 return isset( $this->badFiles[$name] ) && ( !$contextTitle ||
131 !isset( $this->badFiles[$name][$contextTitle->getNamespace()]
132 [$contextTitle->getDBkey()] ) );