Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php |
— | — | @@ -1132,26 +1132,31 @@ |
1133 | 1133 | |
1134 | 1134 | if( !$wgFlaggedRevsAutopromote ) |
1135 | 1135 | return true; |
1136 | | - // Grab current groups |
| 1136 | + # Grab current groups |
1137 | 1137 | $groups = $user->getGroups(); |
1138 | 1138 | $now = time(); |
1139 | 1139 | $usercreation = wfTimestamp(TS_UNIX,$user->mRegistration); |
1140 | 1140 | $userage = floor(($now-$usercreation) / 86400); |
1141 | | - // Do not give this to current holders or bots |
| 1141 | + # Do not give this to current holders or bots |
1142 | 1142 | if( in_array( array('bot','editor'), $groups ) ) |
1143 | 1143 | return true; |
1144 | | - // Check if we need to promote... |
| 1144 | + # Check if we need to promote... |
1145 | 1145 | if( $userage < $wgFlaggedRevsAutopromote['days'] ) |
1146 | 1146 | return true; |
1147 | 1147 | if( $user->getEditCount() < $wgFlaggedRevsAutopromote['edits'] ) |
1148 | 1148 | return true; |
1149 | 1149 | if( $wgFlaggedRevsAutopromote['email'] && !$wgUser->isAllowed('emailconfirmed') ) |
1150 | 1150 | return true; |
| 1151 | + # User must have a user page and talk page |
| 1152 | + $up = $user->getUserPage(); |
| 1153 | + $utp = $user->getTalkPage(); |
| 1154 | + if( !$up->exists() || !$utp->exists() ) |
| 1155 | + return true; |
1151 | 1156 | # Do not re-add status if it was previously removed... |
1152 | 1157 | $db = wfGetDB( DB_MASTER ); |
1153 | 1158 | $removed = $dbw->selectField( 'logging', '1', |
1154 | 1159 | array( 'log_namespace' => NS_USER, |
1155 | | - 'log_title' => $wgUser->getName(), |
| 1160 | + 'log_title' => $wgUser->getUserPage()->getDBkey(), |
1156 | 1161 | 'log_type' => 'rights', |
1157 | 1162 | 'log_action' => 'erevoke' ), |
1158 | 1163 | __METHOD__, |
Index: trunk/extensions/FlaggedRevs/FlaggedRevsPage_body.php |
— | — | @@ -754,7 +754,7 @@ |
755 | 755 | class UnreviewedPagesPage extends PageQueryPage { |
756 | 756 | |
757 | 757 | function __construct( $namespace, $showOutdated=false, $category=NULL ) { |
758 | | - $this->namespace = intval($namespace); |
| 758 | + $this->namespace = $namespace; |
759 | 759 | $this->category = $category; |
760 | 760 | $this->showOutdated = $showOutdated; |
761 | 761 | } |
— | — | @@ -775,13 +775,14 @@ |
776 | 776 | |
777 | 777 | list($page,$flaggedrevs,$categorylinks) = $dbr->tableNamesN('page','flaggedrevs','categorylinks'); |
778 | 778 | # Must be a content page... |
| 779 | + if( !is_null($namespace) ) |
| 780 | + $namespace = intval($namespace); |
| 781 | + |
779 | 782 | if( is_null($namespace) || !in_array($namespace,$wgFlaggedRevsNamespaces) ) { |
780 | | - $where = 'page_namespace IN(' . implode(',',$wgFlaggedRevsNamespaces) . ') '; |
781 | | - } else { |
782 | | - $where = "page_namespace={$namespace} "; |
| 783 | + $namespace = empty($wgFlaggedRevsNamespaces) ? -1 : $wgFlaggedRevsNamespaces[0]; |
783 | 784 | } |
784 | 785 | # No redirects |
785 | | - $where .= "AND page_is_redirect=0 "; |
| 786 | + $where = "page_namespace={$namespace} AND page_is_redirect=0 "; |
786 | 787 | # We don't like filesorts, so the query methods here will be very different |
787 | 788 | if( !$showOutdated ) { |
788 | 789 | $where .= "AND page_ext_reviewed IS NULL"; |
— | — | @@ -794,7 +795,6 @@ |
795 | 796 | $sql = "SELECT page_namespace AS ns,page_title AS title,page_len,page_ext_stable |
796 | 797 | FROM $page FORCE INDEX(ext_namespace_reviewed) |
797 | 798 | RIGHT JOIN $categorylinks ON(cl_from = page_id AND cl_to = '{$category}')"; |
798 | | - #$where .= " AND cl_from IS NOT NULL "; |
799 | 799 | } else { |
800 | 800 | $sql = "SELECT page_namespace AS ns,page_title AS title,page_len,page_ext_stable |
801 | 801 | FROM $page FORCE INDEX(ext_namespace_reviewed)"; |