Merge "Show a warning in edit preview when a template loop is detected"
[lhc/web/wiklou.git] / includes / interwiki / InterwikiLookupAdapter.php
index 60d6f43..076c37f 100644 (file)
@@ -60,7 +60,6 @@ class InterwikiLookupAdapter implements InterwikiLookup {
         * @return bool Whether it exists
         */
        public function isValidInterwiki( $prefix ) {
-
                return array_key_exists( $prefix, $this->getInterwikiMap() );
        }
 
@@ -87,16 +86,20 @@ class InterwikiLookupAdapter implements InterwikiLookup {
         * 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;