$config = MediaWikiServices::getInstance()->getConfigFactory()->makeConfig( 'CirrusSearch' ); $conn = new Connection( $config ); $searcher = new Searcher( $conn, 0, 0, $config, [], $wgUser ); $db = wfGetDB( DB_REPLICA ); $titles = $db->selectFieldValues( 'page', 'page_title' ); foreach ( $titles as $text ) { $title = Title::newFromDBkey( $text ); $docId = $config->makeId( $title->getArticleID() ); $esSources = $searcher->get( [ $docId ], true ); if ( !$esSources->isOK() ) { echo $title->getText() . " is unindexed. Null editing\n"; $page = new WikiPage( $title ); $status = $page->doEditContent( $page->getContent(), 'This changes nothing', EDIT_UPDATE, false, $wgUser ); } }