Follows-up
dbe592df. Used to go in one-way only and silenced by
addObj(). Now that we're iterating directly as well, need a
conditional.
Bug: T146728
Change-Id: Ief9d44cc5cb8f5d687560f59cc696c5671546163
$titleInfo = [];
$batch = new LinkBatch;
foreach ( $pages as $titleText ) {
$titleInfo = [];
$batch = new LinkBatch;
foreach ( $pages as $titleText ) {
- $batch->addObj( Title::newFromText( $titleText ) );
+ $title = Title::newFromText( $titleText );
+ if ( $title ) {
+ // Page name may be invalid if user-provided (e.g. gadgets)
+ $batch->addObj( $title );
+ }
}
if ( !$batch->isEmpty() ) {
$res = $db->select( 'page',
}
if ( !$batch->isEmpty() ) {
$res = $db->select( 'page',
// Before we intersect, map the names to canonical form (T145673).
$intersect = [];
foreach ( $pages as $page => $unused ) {
// Before we intersect, map the names to canonical form (T145673).
$intersect = [];
foreach ( $pages as $page => $unused ) {
- $title = Title::newFromText( $page )->getPrefixedText();
- $intersect[$title] = 1;
+ $title = Title::newFromText( $page );
+ if ( $title ) {
+ $intersect[ $title->getPrefixedText() ] = 1;
+ } else {
+ // Page name may be invalid if user-provided (e.g. gadgets)
+ $rl->getLogger()->info(
+ 'Invalid wiki page title "{title}" in ' . __METHOD__,
+ [ 'title' => $page ]
+ );
+ }
}
$info = array_intersect_key( $allInfo, $intersect );
}
$info = array_intersect_key( $allInfo, $intersect );