* @return bool Whether it exists
*/
public function isValidInterwiki( $prefix ) {
-
return array_key_exists( $prefix, $this->getInterwikiMap() );
}
* See InterwikiLookup::getAllPrefixes
*
* @param string|null $local If set, limits output to local/non-local interwikis
- * @return string[] List of prefixes
+ * @return array[] interwiki rows
*/
public function getAllPrefixes( $local = null ) {
- if ( $local === null ) {
- return array_keys( $this->getInterwikiMap() );
- }
$res = [];
foreach ( $this->getInterwikiMap() as $interwikiId => $interwiki ) {
- if ( $interwiki->isLocal() === $local ) {
- $res[] = $interwikiId;
+ if ( $local === null || $interwiki->isLocal() === $local ) {
+ $res[] = [
+ 'iw_prefix' => $interwikiId,
+ 'iw_url' => $interwiki->getURL(),
+ 'iw_api' => $interwiki->getAPI(),
+ 'iw_wikiid' => $interwiki->getWikiID(),
+ 'iw_local' => $interwiki->isLocal(),
+ 'iw_trans' => $interwiki->isTranscludable(),
+ ];
}
}
return $res;