Index: trunk/phase3/includes/api/ApiBase.php |
— | — | @@ -329,7 +329,7 @@ |
330 | 330 | switch ( $type ) { |
331 | 331 | case 'namespace': |
332 | 332 | // Special handling because namespaces are type-limited, yet they are not given |
333 | | - $desc .= $paramPrefix . $prompt . implode( ', ', ApiBase::getValidNamespaces() ); |
| 333 | + $desc .= $paramPrefix . $prompt . implode( ', ', MWNamespace::getValidNamespaces() ); |
334 | 334 | break; |
335 | 335 | case 'limit': |
336 | 336 | $desc .= $paramPrefix . "No more than {$paramSettings[self :: PARAM_MAX]} ({$paramSettings[self::PARAM_MAX2]} for bots) allowed"; |
— | — | @@ -524,24 +524,10 @@ |
525 | 525 | } |
526 | 526 | |
527 | 527 | /** |
528 | | - * Returns an array of the namespaces (by integer id) that exist on the |
529 | | - * wiki. Used primarily in help documentation. |
530 | | - * @return array |
| 528 | + * @deprecated use MWNamespace::getValidNamespaces() |
531 | 529 | */ |
532 | 530 | public static function getValidNamespaces() { |
533 | | - static $mValidNamespaces = null; |
534 | | - |
535 | | - if ( is_null( $mValidNamespaces ) ) { |
536 | | - global $wgCanonicalNamespaceNames; |
537 | | - $mValidNamespaces = array( NS_MAIN ); // Doesn't appear in $wgCanonicalNamespaceNames for some reason |
538 | | - foreach ( array_keys( $wgCanonicalNamespaceNames ) as $ns ) { |
539 | | - if ( $ns > 0 ) { |
540 | | - $mValidNamespaces[] = $ns; |
541 | | - } |
542 | | - } |
543 | | - } |
544 | | - |
545 | | - return $mValidNamespaces; |
| 531 | + return MWNamespace::getValidNamespaces(); |
546 | 532 | } |
547 | 533 | |
548 | 534 | /** |
— | — | @@ -649,7 +635,7 @@ |
650 | 636 | $value = $this->getMain()->getRequest()->getVal( $encParamName, $default ); |
651 | 637 | |
652 | 638 | if ( isset( $value ) && $type == 'namespace' ) { |
653 | | - $type = ApiBase::getValidNamespaces(); |
| 639 | + $type = MWNamespace::getValidNamespaces(); |
654 | 640 | } |
655 | 641 | } |
656 | 642 | |
Index: trunk/phase3/includes/Namespace.php |
— | — | @@ -156,6 +156,27 @@ |
157 | 157 | } |
158 | 158 | |
159 | 159 | /** |
| 160 | + * Returns an array of the namespaces (by integer id) that exist on the |
| 161 | + * wiki. Used primarily by the api in help documentation. |
| 162 | + * @return array |
| 163 | + */ |
| 164 | + public static function getValidNamespaces() { |
| 165 | + static $mValidNamespaces = null; |
| 166 | + |
| 167 | + if ( is_null( $mValidNamespaces ) ) { |
| 168 | + global $wgCanonicalNamespaceNames; |
| 169 | + $mValidNamespaces = array( NS_MAIN ); // Doesn't appear in $wgCanonicalNamespaceNames for some reason |
| 170 | + foreach ( array_keys( $wgCanonicalNamespaceNames ) as $ns ) { |
| 171 | + if ( $ns > 0 ) { |
| 172 | + $mValidNamespaces[] = $ns; |
| 173 | + } |
| 174 | + } |
| 175 | + } |
| 176 | + |
| 177 | + return $mValidNamespaces; |
| 178 | + } |
| 179 | + |
| 180 | + /** |
160 | 181 | * Can this namespace ever have a talk namespace? |
161 | 182 | * |
162 | 183 | * @param $index Int: namespace index |