Index: trunk/phase3/includes/Defines.php
===================================================================
--- trunk/phase3/includes/Defines.php (revision 34356)
+++ trunk/phase3/includes/Defines.php (revision 34357)
@@ -84,30 +84,6 @@
define( 'MW_MATH_MATHML', 5 );
/**#@-*/
-/**
- * User rights list
- * @deprecated
- */
-$wgAvailableRights = array(
- 'block',
- 'bot',
- 'createaccount',
- 'delete',
- 'edit',
- 'editinterface',
- 'import',
- 'importupload',
- 'move',
- 'patrol',
- 'protect',
- 'read',
- 'rollback',
- 'siteadmin',
- 'unwatchedpages',
- 'upload',
- 'userrights',
-);
-
/**#@+
* Cache type
*/
Index: trunk/phase3/includes/User.php
===================================================================
--- trunk/phase3/includes/User.php (revision 34356)
+++ trunk/phase3/includes/User.php (revision 34357)
@@ -106,6 +106,52 @@
);
/**
+ * Core rights
+ * Each of these should have a corresponding message of the form "right-$right"
+ */
+ static $mCoreRights = array(
+ 'apihighlimits',
+ 'autoconfirmed',
+ 'autopatrol',
+ 'bigdelete',
+ 'block',
+ 'blockemail',
+ 'bot',
+ 'browsearchive',
+ 'createaccount',
+ 'createpage',
+ 'createtalk',
+ 'delete',
+ 'deletedhistory',
+ 'edit',
+ 'editinterface',
+ 'editusercssjs',
+ 'import',
+ 'importupload',
+ 'ipblock-exempt',
+ 'markbotedits',
+ 'minoredit',
+ 'move',
+ 'nominornewtalk',
+ 'patrol',
+ 'protect',
+ 'proxyunbannable',
+ 'purge',
+ 'read',
+ 'reupload',
+ 'reupload-shared',
+ 'rollback',
+ 'suppressredirect',
+ 'trackback',
+ 'undelete',
+ 'unwatchedpages',
+ 'upload',
+ 'upload_by_url',
+ 'userrights',
+ );
+ static $mAllRights = false;
+
+ /**
* The cache variable declarations
*/
var $mId, $mName, $mRealName, $mPassword, $mNewpassword, $mNewpassTime,
@@ -2717,6 +2763,22 @@
}
/**
+ * Get a list of all available permissions
+ */
+ static function getAllRights() {
+ if ( self::$mAllRights === false ) {
+ global $wgAvailableRights;
+ if ( count( $wgAvailableRights ) ) {
+ self::$mAllRights = array_unique( array_merge( self::$mCoreRights, $wgAvailableRights ) );
+ } else {
+ self::$mAllRights = self::$mCoreRights;
+ }
+ wfRunHooks( 'UserGetAllRights', array( &self::$mAllRights ) );
+ }
+ return self::$mAllRights;
+ }
+
+ /**
* Get a list of implicit groups
*
* @return array
Index: trunk/phase3/includes/GlobalFunctions.php
===================================================================
--- trunk/phase3/includes/GlobalFunctions.php (revision 34356)
+++ trunk/phase3/includes/GlobalFunctions.php (revision 34357)
@@ -2608,23 +2608,3 @@
return md5( mt_rand( 0, 0x7fffffff ) . $salt );
}
-
-/**
- * Generate a list of all available rights.
- * @todo Doesn't list any rights which aren't assigned to a group.
- */
-function wfGetAvailableRights() {
- global $wgGroupPermissions;
-
- $rights = array();
-
- foreach( $wgGroupPermissions as $permissions ) {
- $rights = array_merge( array_keys($permissions),$rights );
- }
-
- $rights = array_unique($rights);
-
- wfRunHooks( 'GetAvailableRights', array( &$rights ) );
-
- return $rights;
-}
Index: trunk/phase3/includes/DefaultSettings.php
===================================================================
--- trunk/phase3/includes/DefaultSettings.php (revision 34356)
+++ trunk/phase3/includes/DefaultSettings.php (revision 34357)
@@ -1282,7 +1282,14 @@
*/
$wgAddGroups = $wgRemoveGroups = array();
+
/**
+ * A list of available rights, in addition to the ones defined by the core.
+ * For extensions only.
+ */
+$wgAvailableRights = array();
+
+/**
* Optional to restrict deletion of pages with higher revision counts
* to users with the 'bigdelete' permission. (Default given to sysops.)
*/