/** * @param Article $article * @param bool $ignoreEmpty * @param bool $dryRun don't store results in DB (think twice before passing true, used by imageServing.php maintenance script) * @return mixed|bool set of images extracted from given article */ public static function buildAndGetIndex($article, $ignoreEmpty = false, $dryRun = false) { if (!$article instanceof Article) { return false; } wfProfileIn(__METHOD__); $title = $article->getTitle(); $content = $article->getContent(); self::hookSwitch(); $editInfo = $article->prepareTextForEdit($content, $title->getLatestRevID()); self::hookSwitch(false); $out = array(); preg_match_all("/(?<=(image mw=')).*(?=')/U", $editInfo->output->getText(), $out); $imageList = $out[0]; wfRunHooks("ImageServing::buildAndGetIndex", [&$imageList, $title]); $images = self::buildIndex($article->getID(), $imageList, $ignoreEmpty, $dryRun); wfProfileOut(__METHOD__); return $images; }