Index: trunk/extensions/Configure/Configure.api.php |
— | — | @@ -19,104 +19,112 @@ |
20 | 20 | $prop = array_flip( $params['prop'] ); |
21 | 21 | // Version list |
22 | 22 | if ( isset( $prop['versionlist'] ) ) { |
23 | | - if ( !$wgUser->isAllowed( 'viewconfig' ) ) |
24 | | - $this->dieUsage( 'viewconfig right required', 'noright' ); |
25 | | - $versions = $wgConf->listArchiveVersions(); |
26 | | - if ( $wgUser->isAllowed( 'viewconfig-interwiki' ) ) { |
27 | | - $oldVersions = $versions; |
28 | | - $versions = array(); |
29 | | - foreach ( $oldVersions as $version ) { |
30 | | - $settings = $wgConf->getOldSettings( $version ); |
31 | | - $wikis = array_keys( $settings ); |
32 | | - $wikis['id'] = $version; |
33 | | - $result->setIndexedTagName( $wikis, 'wiki' ); |
34 | | - $versions[] = $wikis; |
| 23 | + if ( $wgUser->isAllowed( 'viewconfig' ) ) { |
| 24 | + $versions = $wgConf->listArchiveVersions(); |
| 25 | + if ( $wgUser->isAllowed( 'viewconfig-interwiki' ) ) { |
| 26 | + $oldVersions = $versions; |
| 27 | + $versions = array(); |
| 28 | + foreach ( $oldVersions as $version ) { |
| 29 | + $settings = $wgConf->getOldSettings( $version ); |
| 30 | + $wikis = array_keys( $settings ); |
| 31 | + $wikis['id'] = $version; |
| 32 | + $result->setIndexedTagName( $wikis, 'wiki' ); |
| 33 | + $versions[] = $wikis; |
| 34 | + } |
35 | 35 | } |
| 36 | + $result->setIndexedTagName( $versions, 'version' ); |
| 37 | + $result->addValue( $this->getModuleName(), 'versions', $versions ); |
| 38 | + } else { |
| 39 | + $this->setWarning( '`viewconfig\' right is required to use `versionlist\'' ); |
36 | 40 | } |
37 | | - $result->setIndexedTagName( $versions, 'version' ); |
38 | | - $result->addValue( $this->getModuleName(), 'versions', $versions ); |
39 | 41 | } |
40 | 42 | |
41 | 43 | // Wiki list |
42 | 44 | if ( isset( $prop['wikilist'] ) ) { |
43 | | - if ( !$wgUser->isAllowed( 'viewconfig-interwiki' ) ) |
44 | | - $this->dieUsage( 'viewconfig-interwiki right required', 'noright' ); |
45 | | - if ( $wgConfigureWikis === false ) |
46 | | - $result->addValue( 'configure', 'wikis', array( 'denied' => '' ) ); |
47 | | - if ( $wgConfigureWikis === true ) |
48 | | - $result->addValue( 'configure', 'wikis', array( 'any' => '' ) ); |
49 | | - if ( is_array( $wgConfigureWikis ) ) { |
50 | | - $wikis = $wgConfigureWikis; |
51 | | - $result->setIndexedTagName( $wikis, 'wiki' ); |
52 | | - $result->addValue( $this->getModuleName(), 'wikis', $wikis ); |
| 45 | + if ( $wgUser->isAllowed( 'viewconfig-interwiki' ) ) { |
| 46 | + if ( $wgConfigureWikis === false ) |
| 47 | + $result->addValue( 'configure', 'wikis', array( 'denied' => '' ) ); |
| 48 | + if ( $wgConfigureWikis === true ) |
| 49 | + $result->addValue( 'configure', 'wikis', array( 'any' => '' ) ); |
| 50 | + if ( is_array( $wgConfigureWikis ) ) { |
| 51 | + $wikis = $wgConfigureWikis; |
| 52 | + $result->setIndexedTagName( $wikis, 'wiki' ); |
| 53 | + $result->addValue( $this->getModuleName(), 'wikis', $wikis ); |
| 54 | + } |
| 55 | + } else { |
| 56 | + $this->setWarning( '`viewconfig-interwiki\' right is required to use `wikilist\'' ); |
53 | 57 | } |
54 | 58 | } |
55 | 59 | |
56 | 60 | // Settings |
57 | 61 | if ( isset( $prop['settings'] ) ) { |
58 | | - if ( !$wgUser->isAllowed( 'viewconfig' ) ) |
59 | | - $this->dieUsage( 'viewconfig right required', 'noright' ); |
60 | | - $version = $params['version']; |
61 | | - $wiki = $params['wiki'] ? $params['wiki'] : $wgConf->getWiki(); |
62 | | - $settingsValues = $wgConf->getOldSettings( $version ); |
63 | | - if ( !is_array( $settingsValues ) ) |
64 | | - $this->dieUsage( 'version not found', 'noversion' ); |
65 | | - if ( !isset( $settingsValues[$wiki] ) || !is_array( $settingsValues[$wiki] ) ) |
66 | | - $this->dieUsage( 'wiki not found in version', 'nowiki' ); |
67 | | - $settingsValues = $settingsValues[$wiki]; |
68 | | - $conf = ConfigurationSettings::singleton( CONF_SETTINGS_BOTH ); |
69 | | - $notEditable = $conf->getUneditableSettings(); |
70 | | - $ret = array(); |
71 | | - if ( $params['group'] ) { |
72 | | - $sections = $conf->getSettings(); |
73 | | - foreach ( $sections as $sectionName => $section ) { |
74 | | - $groupRet = array( 'name' => $sectionName ); |
75 | | - foreach ( $section as $groupName => $group ) { |
76 | | - $settingsRet = array( 'name' => $groupName ); |
77 | | - foreach ( $group as $setting => $type ) { |
78 | | - if ( !$conf->isSettingAvailable( $setting ) || in_array( $setting, $notEditable ) ) |
79 | | - continue; |
80 | | - $settingsRet[] = $this->getSettingResult( $setting, $type, $settingsValues, $conf, $result ); |
| 62 | + if ( $wgUser->isAllowed( 'viewconfig' ) ) { |
| 63 | + $version = $params['version']; |
| 64 | + $wiki = $params['wiki'] ? $params['wiki'] : $wgConf->getWiki(); |
| 65 | + $settingsValues = $wgConf->getOldSettings( $version ); |
| 66 | + if ( !is_array( $settingsValues ) ) |
| 67 | + $this->dieUsage( 'version not found', 'noversion' ); |
| 68 | + if ( !isset( $settingsValues[$wiki] ) || !is_array( $settingsValues[$wiki] ) ) |
| 69 | + $this->dieUsage( 'wiki not found in version', 'nowiki' ); |
| 70 | + $settingsValues = $settingsValues[$wiki]; |
| 71 | + $conf = ConfigurationSettings::singleton( CONF_SETTINGS_BOTH ); |
| 72 | + $notEditable = $conf->getUneditableSettings(); |
| 73 | + $ret = array(); |
| 74 | + if ( $params['group'] ) { |
| 75 | + $sections = $conf->getSettings(); |
| 76 | + foreach ( $sections as $sectionName => $section ) { |
| 77 | + $groupRet = array( 'name' => $sectionName ); |
| 78 | + foreach ( $section as $groupName => $group ) { |
| 79 | + $settingsRet = array( 'name' => $groupName ); |
| 80 | + foreach ( $group as $setting => $type ) { |
| 81 | + if ( !$conf->isSettingAvailable( $setting ) || in_array( $setting, $notEditable ) ) |
| 82 | + continue; |
| 83 | + $settingsRet[] = $this->getSettingResult( $setting, $type, $settingsValues, $conf, $result ); |
| 84 | + } |
| 85 | + $result->setIndexedTagName( $settingsRet, 'setting' ); |
| 86 | + $groupRet[] = $settingsRet; |
81 | 87 | } |
82 | | - $result->setIndexedTagName( $settingsRet, 'setting' ); |
83 | | - $groupRet[] = $settingsRet; |
| 88 | + $result->setIndexedTagName( $groupRet, 'group' ); |
| 89 | + $ret[] = $groupRet; |
84 | 90 | } |
85 | | - $result->setIndexedTagName( $groupRet, 'group' ); |
86 | | - $ret[] = $groupRet; |
| 91 | + $result->setIndexedTagName( $ret, 'section' ); |
| 92 | + } else { |
| 93 | + $settings = $conf->getAllSettings(); |
| 94 | + foreach ( $settings as $setting => $type ) { |
| 95 | + if ( !$conf->isSettingAvailable( $setting ) || in_array( $setting, $notEditable ) ) |
| 96 | + continue; |
| 97 | + $ret[] = $this->getSettingResult( $setting, $type, $settingsValues, $conf, $result ); |
| 98 | + } |
| 99 | + $result->setIndexedTagName( $ret, 'setting' ); |
87 | 100 | } |
88 | | - $result->setIndexedTagName( $ret, 'section' ); |
| 101 | + $result->addValue( $this->getModuleName(), 'settings', $ret ); |
89 | 102 | } else { |
90 | | - $settings = $conf->getAllSettings(); |
91 | | - foreach ( $settings as $setting => $type ) { |
92 | | - if ( !$conf->isSettingAvailable( $setting ) || in_array( $setting, $notEditable ) ) |
93 | | - continue; |
94 | | - $ret[] = $this->getSettingResult( $setting, $type, $settingsValues, $conf, $result ); |
95 | | - } |
96 | | - $result->setIndexedTagName( $ret, 'setting' ); |
| 103 | + $this->setWarning( '`viewconfig\' right is required to use `settings\'' ); |
97 | 104 | } |
98 | | - $result->addValue( $this->getModuleName(), 'settings', $ret ); |
99 | 105 | } |
100 | 106 | |
101 | 107 | // Extensions |
102 | 108 | if ( isset( $prop['extensions'] ) ) { |
103 | | - if ( !$wgUser->isAllowed( 'extensions' ) ) |
104 | | - $this->dieUsage( 'extensions right required', 'noright' ); |
105 | | - $conf = ConfigurationSettings::singleton( CONF_SETTINGS_EXT ); |
106 | | - $ret = array(); |
107 | | - foreach ( $conf->getAllExtensionsObjects() as $ext ) { |
108 | | - if( !$ext->isInstalled() ) continue; // must exist |
109 | | - $extArr = array(); |
110 | | - $extArr['name'] = $ext->getName(); |
111 | | - if ( $ext->isActivated() ) |
112 | | - $extArr['activated'] = ''; |
113 | | - if ( $ext->hasSchemaChange() ) |
114 | | - $extArr['schema'] = ''; |
115 | | - if ( ( $url = $ext->getUrl() ) !== null ) |
116 | | - $extArr['url'] = $url; |
117 | | - $ret[] = $extArr; |
| 109 | + if ( $wgUser->isAllowed( 'extensions' ) ) { |
| 110 | + $conf = ConfigurationSettings::singleton( CONF_SETTINGS_EXT ); |
| 111 | + $ret = array(); |
| 112 | + foreach ( $conf->getAllExtensionsObjects() as $ext ) { |
| 113 | + if( !$ext->isInstalled() ) continue; // must exist |
| 114 | + $extArr = array(); |
| 115 | + $extArr['name'] = $ext->getName(); |
| 116 | + if ( $ext->isActivated() ) |
| 117 | + $extArr['activated'] = ''; |
| 118 | + if ( $ext->hasSchemaChange() ) |
| 119 | + $extArr['schema'] = ''; |
| 120 | + if ( ( $url = $ext->getUrl() ) !== null ) |
| 121 | + $extArr['url'] = $url; |
| 122 | + $ret[] = $extArr; |
| 123 | + } |
| 124 | + $result->setIndexedTagName( $ret, 'extension' ); |
| 125 | + $result->addValue( $this->getModuleName(), 'extension', $ret ); |
| 126 | + } else { |
| 127 | + $this->setWarning( '`extensions\' right is required to use `extensions\'' ); |
118 | 128 | } |
119 | | - $result->setIndexedTagName( $ret, 'extension' ); |
120 | | - $result->addValue( $this->getModuleName(), 'extension', $ret ); |
121 | 129 | } |
122 | 130 | } |
123 | 131 | |
Index: trunk/extensions/Configure/CHANGELOG |
— | — | @@ -1,6 +1,10 @@ |
2 | 2 | This file lists changes on this extension. |
3 | 3 | Localisation updates are done on betawiki and aren't listed here. |
4 | 4 | |
| 5 | +0.11.3 - 22 December 2008 |
| 6 | + Missing rights while executing API module now result in warnings rather than |
| 7 | + errors. |
| 8 | + |
5 | 9 | 0.11.2 - 18 December 2008 |
6 | 10 | Added support for APCOND_ISIP and APCOND_IPINRANGE conditions of |
7 | 11 | $wgAutopromote. |
Index: trunk/extensions/Configure/Configure.php |
— | — | @@ -17,7 +17,7 @@ |
18 | 18 | 'url' => 'http://www.mediawiki.org/wiki/Extension:Configure', |
19 | 19 | 'description' => 'Allow authorised users to configure the wiki via a web-based interface', |
20 | 20 | 'descriptionmsg' => 'configure-desc', |
21 | | - 'version' => '0.11.2', |
| 21 | + 'version' => '0.11.3', |
22 | 22 | ); |
23 | 23 | |
24 | 24 | # Configuration part |