}
}
+ /**
+ * Returns an array of the namespaces (by integer id) that exist on the
+ * wiki. Used primarily by the api in help documentation.
+ * @return array
+ */
+ public static function getValidNamespaces() {
+ static $mValidNamespaces = null;
+
+ if ( is_null( $mValidNamespaces ) ) {
+ global $wgCanonicalNamespaceNames;
+ $mValidNamespaces = array( NS_MAIN ); // Doesn't appear in $wgCanonicalNamespaceNames for some reason
+ foreach ( array_keys( $wgCanonicalNamespaceNames ) as $ns ) {
+ if ( $ns > 0 ) {
+ $mValidNamespaces[] = $ns;
+ }
+ }
+ }
+
+ return $mValidNamespaces;
+ }
+
/**
* Can this namespace ever have a talk namespace?
*
switch ( $type ) {
case 'namespace':
// Special handling because namespaces are type-limited, yet they are not given
- $desc .= $paramPrefix . $prompt . implode( ', ', ApiBase::getValidNamespaces() );
+ $desc .= $paramPrefix . $prompt . implode( ', ', MWNamespace::getValidNamespaces() );
break;
case 'limit':
$desc .= $paramPrefix . "No more than {$paramSettings[self :: PARAM_MAX]} ({$paramSettings[self::PARAM_MAX2]} for bots) allowed";
}
/**
- * Returns an array of the namespaces (by integer id) that exist on the
- * wiki. Used primarily in help documentation.
- * @return array
+ * @deprecated use MWNamespace::getValidNamespaces()
*/
public static function getValidNamespaces() {
- static $mValidNamespaces = null;
-
- if ( is_null( $mValidNamespaces ) ) {
- global $wgCanonicalNamespaceNames;
- $mValidNamespaces = array( NS_MAIN ); // Doesn't appear in $wgCanonicalNamespaceNames for some reason
- foreach ( array_keys( $wgCanonicalNamespaceNames ) as $ns ) {
- if ( $ns > 0 ) {
- $mValidNamespaces[] = $ns;
- }
- }
- }
-
- return $mValidNamespaces;
+ return MWNamespace::getValidNamespaces();
}
/**
$value = $this->getMain()->getRequest()->getVal( $encParamName, $default );
if ( isset( $value ) && $type == 'namespace' ) {
- $type = ApiBase::getValidNamespaces();
+ $type = MWNamespace::getValidNamespaces();
}
}