Index: trunk/phase3/maintenance/archives/patch-recentchanges-utindex.sql |
— | — | @@ -0,0 +1,4 @@ |
| 2 | +--- July 2006 |
| 3 | +--- Index on recentchanges.( rc_namespace, rc_user_text ) |
| 4 | +--- Helps the username filtering in Special:Newpages |
| 5 | +ALTER TABLE /*$wgDBprefix*/recentchanges ADD INDEX `rc_ns_usertext` ( `rc_namespace` , `rc_user_text` ); |
\ No newline at end of file |
Property changes on: trunk/phase3/maintenance/archives/patch-recentchanges-utindex.sql |
___________________________________________________________________ |
Name: svn:eol-style |
1 | 6 | + native |
Index: trunk/phase3/maintenance/updaters.inc |
— | — | @@ -762,6 +762,23 @@ |
763 | 763 | echo "Done. Please run maintenance/refreshLinks.php for a more thorough templatelinks update.\n"; |
764 | 764 | } |
765 | 765 | |
| 766 | +# July 2006 |
| 767 | +# Add ( rc_namespace, rc_user_text ) index [R. Church] |
| 768 | +function do_rc_indices_update() { |
| 769 | + global $wgDatabase; |
| 770 | + echo( "Checking for additional recent changes indices...\n" ); |
| 771 | + # See if we can find the index we want |
| 772 | + $info = $wgDatabase->indexInfo( 'recentchanges', 'rc_ns_usertext', __METHOD__ ); |
| 773 | + if( !$info ) { |
| 774 | + # None, so create |
| 775 | + echo( "...index on ( rc_namespace, rc_user_text ) not found; creating\n" ); |
| 776 | + dbsource( archive( 'patch-recentchanges-utindex.sql' ) ); |
| 777 | + } else { |
| 778 | + # Index seems to exist |
| 779 | + echo( "...seems to be ok\n" ); |
| 780 | + } |
| 781 | +} |
| 782 | + |
766 | 783 | function do_all_updates( $doShared = false ) { |
767 | 784 | global $wgNewTables, $wgNewFields, $wgRenamedTables, $wgSharedDB, $wgDatabase; |
768 | 785 | |
— | — | @@ -820,6 +837,8 @@ |
821 | 838 | do_logging_timestamp_index(); flush(); |
822 | 839 | |
823 | 840 | do_page_random_update(); flush(); |
| 841 | + |
| 842 | + do_rc_indices_update(); flush(); |
824 | 843 | |
825 | 844 | initialiseMessages(); flush(); |
826 | 845 | } |
Index: trunk/phase3/maintenance/mysql5/tables.sql |
— | — | @@ -809,7 +809,8 @@ |
810 | 810 | INDEX rc_namespace_title (rc_namespace, rc_title), |
811 | 811 | INDEX rc_cur_id (rc_cur_id), |
812 | 812 | INDEX new_name_timestamp(rc_new,rc_namespace,rc_timestamp), |
813 | | - INDEX rc_ip (rc_ip) |
| 813 | + INDEX rc_ip (rc_ip), |
| 814 | + INDEX rc_ns_usertext ( rc_namespace, rc_user_text ) |
814 | 815 | |
815 | 816 | ) TYPE=InnoDB, DEFAULT CHARSET=utf8; |
816 | 817 | |
Index: trunk/phase3/maintenance/tables.sql |
— | — | @@ -795,7 +795,8 @@ |
796 | 796 | INDEX rc_namespace_title (rc_namespace, rc_title), |
797 | 797 | INDEX rc_cur_id (rc_cur_id), |
798 | 798 | INDEX new_name_timestamp(rc_new,rc_namespace,rc_timestamp), |
799 | | - INDEX rc_ip (rc_ip) |
| 799 | + INDEX rc_ip (rc_ip), |
| 800 | + INDEX rc_ns_usertext ( rc_namespace, rc_user_text ) |
800 | 801 | |
801 | 802 | ) TYPE=InnoDB; |
802 | 803 | |
Index: trunk/phase3/includes/SpecialNewpages.php |
— | — | @@ -11,10 +11,13 @@ |
12 | 12 | * @subpackage SpecialPage |
13 | 13 | */ |
14 | 14 | class NewPagesPage extends QueryPage { |
| 15 | + |
15 | 16 | var $namespace; |
| 17 | + var $username = ''; |
16 | 18 | |
17 | | - function NewPagesPage( $namespace = NS_MAIN ) { |
| 19 | + function NewPagesPage( $namespace = NS_MAIN, $username = '' ) { |
18 | 20 | $this->namespace = $namespace; |
| 21 | + $this->username = $username; |
19 | 22 | } |
20 | 23 | |
21 | 24 | function getName() { |
— | — | @@ -26,12 +29,18 @@ |
27 | 30 | return false; |
28 | 31 | } |
29 | 32 | |
| 33 | + function makeUserWhere( &$dbo ) { |
| 34 | + return $this->username ? ' AND rc_user_text = ' . $dbo->addQuotes( $this->username ) : ''; |
| 35 | + } |
| 36 | + |
30 | 37 | function getSQL() { |
31 | 38 | global $wgUser, $wgUseRCPatrol; |
32 | 39 | $usepatrol = ( $wgUseRCPatrol && $wgUser->isAllowed( 'patrol' ) ) ? 1 : 0; |
33 | 40 | $dbr =& wfGetDB( DB_SLAVE ); |
34 | 41 | extract( $dbr->tableNames( 'recentchanges', 'page', 'text' ) ); |
35 | 42 | |
| 43 | + $uwhere = $this->makeUserWhere( $dbr ); |
| 44 | + |
36 | 45 | # FIXME: text will break with compression |
37 | 46 | return |
38 | 47 | "SELECT 'Newpages' as type, |
— | — | @@ -50,7 +59,8 @@ |
51 | 60 | page_latest as rev_id |
52 | 61 | FROM $recentchanges,$page |
53 | 62 | WHERE rc_cur_id=page_id AND rc_new=1 |
54 | | - AND rc_namespace=" . $this->namespace . " AND page_is_redirect=0"; |
| 63 | + AND rc_namespace=" . $this->namespace . " AND page_is_redirect=0 |
| 64 | + {$uwhere}"; |
55 | 65 | } |
56 | 66 | |
57 | 67 | function preprocessResults( &$dbo, &$res ) { |
— | — | @@ -112,34 +122,20 @@ |
113 | 123 | } |
114 | 124 | |
115 | 125 | /** |
116 | | - * Show a namespace selection form for filtering |
| 126 | + * Show a form for filtering namespace and username |
117 | 127 | * |
118 | 128 | * @return string |
119 | 129 | */ |
120 | 130 | function getPageHeader() { |
121 | | - $thisTitle = Title::makeTitle( NS_SPECIAL, $this->getName() ); |
122 | | - $form = wfOpenElement( 'form', array( |
123 | | - 'method' => 'post', |
124 | | - 'action' => $thisTitle->getLocalUrl() ) ); |
125 | | - $form .= wfElement( 'label', array( 'for' => 'namespace' ), |
126 | | - wfMsg( 'namespace' ) ) . ' '; |
127 | | - $form .= HtmlNamespaceSelector( $this->namespace ); |
128 | | - # Preserve the offset and limit |
129 | | - $form .= wfElement( 'input', array( |
130 | | - 'type' => 'hidden', |
131 | | - 'name' => 'offset', |
132 | | - 'value' => $this->offset ) ); |
133 | | - $form .= wfElement( 'input', array( |
134 | | - 'type' => 'hidden', |
135 | | - 'name' => 'limit', |
136 | | - 'value' => $this->limit ) ); |
137 | | - $form .= wfElement( 'input', array( |
138 | | - 'type' => 'submit', |
139 | | - 'name' => 'submit', |
140 | | - 'id' => 'submit', |
141 | | - 'value' => wfMsg( 'allpagessubmit' ) ) ); |
142 | | - $form .= wfCloseElement( 'form' ); |
143 | | - return( $form ); |
| 131 | + $self = Title::makeTitle( NS_SPECIAL, $this->getName() ); |
| 132 | + $form = wfOpenElement( 'form', array( 'method' => 'post', 'action' => $self->getLocalUrl() ) ); |
| 133 | + $form .= '<table><tr><td align="right">' . wfMsgHtml( 'namespace' ) . '</td>'; |
| 134 | + $form .= '<td>' . HtmlNamespaceSelector( $this->namespace ) . '</td><tr>'; |
| 135 | + $form .= '<tr><td align="right">' . wfMsgHtml( 'newpages-username' ) . '</td>'; |
| 136 | + $form .= '<td>' . wfInput( 'username', 30, $this->username ) . '</td></tr>'; |
| 137 | + $form .= '<tr><td></td><td>' . wfSubmitButton( wfMsg( 'allpagessubmit' ) ) . '</td></tr></table>'; |
| 138 | + $form .= wfHidden( 'offset', $this->offset ) . wfHidden( 'limit', $this->limit ) . '</form>'; |
| 139 | + return $form; |
144 | 140 | } |
145 | 141 | |
146 | 142 | /** |
— | — | @@ -148,7 +144,7 @@ |
149 | 145 | * @return array |
150 | 146 | */ |
151 | 147 | function linkParameters() { |
152 | | - return( array( 'namespace' => $this->namespace ) ); |
| 148 | + return( array( 'namespace' => $this->namespace, 'username' => $this->username ) ); |
153 | 149 | } |
154 | 150 | |
155 | 151 | } |
— | — | @@ -161,6 +157,7 @@ |
162 | 158 | |
163 | 159 | list( $limit, $offset ) = wfCheckLimits(); |
164 | 160 | $namespace = NS_MAIN; |
| 161 | + $username = ''; |
165 | 162 | |
166 | 163 | if ( $par ) { |
167 | 164 | $bits = preg_split( '/\s*,\s*/', trim( $par ) ); |
— | — | @@ -184,12 +181,14 @@ |
185 | 182 | } else { |
186 | 183 | if( $ns = $wgRequest->getInt( 'namespace', 0 ) ) |
187 | 184 | $namespace = $ns; |
| 185 | + if( $un = $wgRequest->getText( 'username' ) ) |
| 186 | + $username = $un; |
188 | 187 | } |
189 | 188 | |
190 | 189 | if ( ! isset( $shownavigation ) ) |
191 | 190 | $shownavigation = ! $specialPage->including(); |
192 | 191 | |
193 | | - $npp = new NewPagesPage( $namespace ); |
| 192 | + $npp = new NewPagesPage( $namespace, $username ); |
194 | 193 | |
195 | 194 | if ( ! $npp->doFeed( $wgRequest->getVal( 'feed' ), $limit ) ) |
196 | 195 | $npp->doQuery( $offset, $limit, $shownavigation ); |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -41,6 +41,7 @@ |
42 | 42 | attempts to create an account. Fixed inefficiency of Special:Ipblocklist in |
43 | 43 | the presence of large numbers of blocks; added indexes and implemented an |
44 | 44 | indexed pager. |
| 45 | +* (bug 6448) Allow filtering of Special:Newpages according to username |
45 | 46 | |
46 | 47 | == Languages updated == |
47 | 48 | |
Index: trunk/phase3/languages/Messages.php |
— | — | @@ -981,6 +981,7 @@ |
982 | 982 | 'recentchangeslinked' => 'Related changes', |
983 | 983 | 'rclsub' => "(to pages linked from \"$1\")", |
984 | 984 | 'newpages' => 'New pages', |
| 985 | +'newpages-username' => 'Username:', |
985 | 986 | 'ancientpages' => 'Oldest pages', |
986 | 987 | 'intl' => 'Interlanguage links', |
987 | 988 | 'move' => 'Move', |