Skip to content

Commit

Permalink
Use underscored titles when querying for live pages
Browse files Browse the repository at this point in the history
Bug: T362457
  • Loading branch information
MusikAnimal committed Apr 14, 2024
1 parent 8f05de2 commit 8344a94
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/Controller/AppController.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,13 +185,13 @@ public function decorateRecords( array $rows, WikiRepository $wikiRepo ): array
// Basic revision info all goes in the $row data.
$row = array_merge( $row, $extraData );
}

$revUserTextUnderscored = str_replace( ' ', '_', $row['rev_user_text'] );
return new Record(
$row,
$editCounts[$row['rev_user_text']] ?? null,
isset( $livePages[$row['page_namespace']][$row['page_title']] ),
isset( $livePages['2'][$row['rev_user_text']] ),
isset( $livePages['3'][$row['rev_user_text']] ),
isset( $livePages['2'][$revUserTextUnderscored] ),
isset( $livePages['3'][$revUserTextUnderscored] ),
$livePages[$row['page_namespace']][$row['page_title']] ?? []
);
}, $newRows );
Expand Down
4 changes: 3 additions & 1 deletion src/Repository/WikiRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,9 @@ public function getLivePagesWithWikiProjects( array $titlesByNs ): array {
}

foreach ( $titlesByNs as $nsId => $titles ) {
$titles = array_unique( $titles );
$titles = array_map( static function ( $title ) {
return str_replace( ' ', '_', $title );
}, array_unique( $titles ) );
$qb->orWhere( "(
page_namespace = :ns_$nsId
AND page_title IN (:titles_$nsId)
Expand Down

0 comments on commit 8344a94

Please sign in to comment.