Index: trunk/extensions/FlaggedRevs/FlaggedRevs.class.php |
— | — | @@ -1131,9 +1131,11 @@ |
1132 | 1132 | /** |
1133 | 1133 | * Get params for a user |
1134 | 1134 | * @param int $uid |
| 1135 | + * @param string $DBName, optional wiki name |
| 1136 | + * @returns Array $params |
1135 | 1137 | */ |
1136 | | - public static function getUserParams( $uid ) { |
1137 | | - $dbw = wfGetDB( DB_MASTER ); |
| 1138 | + public static function getUserParams( $uid, $DBName = false ) { |
| 1139 | + $dbw = wfGetDB( DB_MASTER, array(), $DBName ); |
1138 | 1140 | $row = $dbw->selectRow( 'flaggedrevs_promote', |
1139 | 1141 | 'frp_user_params', |
1140 | 1142 | array( 'frp_user_id' => $uid ), |
— | — | @@ -1161,14 +1163,16 @@ |
1162 | 1164 | /** |
1163 | 1165 | * Save params for a user |
1164 | 1166 | * @param int $uid |
| 1167 | + * @param string $DBName, optional wiki name |
1165 | 1168 | * @param Array $params |
| 1169 | + * @returns bool success |
1166 | 1170 | */ |
1167 | | - public static function saveUserParams( $uid, $params ) { |
| 1171 | + public static function saveUserParams( $uid, $params, $DBName = false ) { |
1168 | 1172 | $flatParams = ''; |
1169 | 1173 | foreach( $params as $key => $value ) { |
1170 | 1174 | $flatParams .= "{$key}={$value}\n"; |
1171 | 1175 | } |
1172 | | - $dbw = wfGetDB( DB_MASTER ); |
| 1176 | + $dbw = wfGetDB( DB_MASTER, array(), $DBName ); |
1173 | 1177 | $row = $dbw->replace( 'flaggedrevs_promote', |
1174 | 1178 | array( 'frp_user_id' ), |
1175 | 1179 | array( 'frp_user_id' => $uid, 'frp_user_params' => trim($flatParams) ), |
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php |
— | — | @@ -1308,9 +1308,17 @@ |
1309 | 1309 | */ |
1310 | 1310 | public static function recordDemote( $u, $addgroup, $removegroup ) { |
1311 | 1311 | if( $removegroup && in_array('editor',$removegroup) ) { |
1312 | | - $params = FlaggedRevs::getUserParams( $u->getId() ); |
1313 | | - $params['demoted'] = 1; |
1314 | | - FlaggedRevs::saveUserParams( $u->getId(), $params ); |
| 1312 | + // Cross-wiki rights change |
| 1313 | + if( $u instanceof UserRightsProxy ) { |
| 1314 | + $params = FlaggedRevs::getUserParams( $u->getId(), $u->getDBName() ); |
| 1315 | + $params['demoted'] = 1; |
| 1316 | + FlaggedRevs::saveUserParams( $u->getId(), $params, $dbname ); |
| 1317 | + // On-wiki rights change |
| 1318 | + } else { |
| 1319 | + $params = FlaggedRevs::getUserParams( $u->getId() ); |
| 1320 | + $params['demoted'] = 1; |
| 1321 | + FlaggedRevs::saveUserParams( $u->getId(), $params ); |
| 1322 | + } |
1315 | 1323 | } |
1316 | 1324 | return true; |
1317 | 1325 | } |