Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php |
— | — | @@ -1696,6 +1696,7 @@ |
1697 | 1697 | # Assume $action may still not be set, in which case, treat it as 'view'... |
1698 | 1698 | if( $action != 'read' ) |
1699 | 1699 | return true; |
| 1700 | + $p = self::getUserParams( $user ); |
1700 | 1701 | # Admin may set this to false, rather than array()... |
1701 | 1702 | $groups = $user->getGroups(); |
1702 | 1703 | $groups[] = '*'; |
— | — | @@ -1814,7 +1815,7 @@ |
1815 | 1816 | # Don't let this get bloated for no reason |
1816 | 1817 | if( count($pages) < $wgFlaggedRevsAutopromote['uniqueContentPages'] && !in_array($article->getId(),$pages) ) { |
1817 | 1818 | $pages[] = $article->getId(); |
1818 | | - $p['uniqueContentPages'] = implode(',',$pages); |
| 1819 | + $p['uniqueContentPages'] = preg_replace('/^,/','',implode(',',$pages)); // clear any garbage |
1819 | 1820 | } |
1820 | 1821 | $p['totalContentEdits'] += 1; |
1821 | 1822 | $changed = true; |
— | — | @@ -2013,10 +2014,10 @@ |
2014 | 2015 | $row = $dbw->selectRow( 'flaggedrevs_promote', 'frp_user_params', |
2015 | 2016 | array( 'frp_user_id' => $user->getId() ), |
2016 | 2017 | __METHOD__ ); |
2017 | | - |
| 2018 | + # Parse params |
2018 | 2019 | $params = array(); |
2019 | 2020 | if( $row ) { |
2020 | | - $flatPars = explode( '\n', trim($row->frp_user_params) ); |
| 2021 | + $flatPars = explode( "\n", trim($row->frp_user_params) ); |
2021 | 2022 | foreach( $flatPars as $pair ) { |
2022 | 2023 | $m = explode( '=', trim($pair), 2 ); |
2023 | 2024 | $key = $m[0]; |
— | — | @@ -2037,13 +2038,11 @@ |
2038 | 2039 | foreach( $params as $key => $value ) { |
2039 | 2040 | $flatParams .= "{$key}={$value}\n"; |
2040 | 2041 | } |
2041 | | - $flatParams = trim($flatParams); |
2042 | | - |
2043 | 2042 | $dbw = wfGetDB( DB_MASTER ); |
2044 | 2043 | $row = $dbw->replace( 'flaggedrevs_promote', |
2045 | 2044 | array( 'frp_user_id' ), |
2046 | 2045 | array( 'frp_user_id' => $user->getId(), |
2047 | | - 'frp_user_params' => $flatParams ), |
| 2046 | + 'frp_user_params' => trim($flatParams) ), |
2048 | 2047 | __METHOD__ ); |
2049 | 2048 | |
2050 | 2049 | return ( $dbw->affectedRows() > 0 ); |