r52767 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r52766‎ | r52767 | r52768 >
Date:19:57, 4 July 2009
Author:ialex
Status:deferred
Tags:
Comment:
svn:eol-style native
Modified paths:
  • /trunk/extensions/FlaggedRevs/api/ApiQueryReviewedpages.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/api/ApiQueryUnreviewedpages.php (modified) (history)
  • /trunk/extensions/LiquidThreads/schema-changes/lqt-schema-change-thread_summary.sql (modified) (history)
  • /trunk/extensions/Minify/COPYING (modified) (history)
  • /trunk/extensions/ProofreadPage/ProofreadPage.sql (modified) (history)
  • /trunk/extensions/ProofreadPage/SpecialProofreadPages.php (modified) (history)
  • /trunk/extensions/Translate/utils/HTMLJsSelectToInputField.php (modified) (history)
  • /trunk/extensions/Translate/utils/JsSelectToInput.js (modified) (history)
  • /trunk/extensions/Translate/utils/JsSelectToInput.php (modified) (history)
  • /trunk/phase3/cache/.htaccess (modified) (history)
  • /trunk/phase3/maintenance/populateLogUsertext.inc (modified) (history)
  • /trunk/phase3/maintenance/populateLogUsertext.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/populateLogUsertext.inc
@@ -1,54 +1,54 @@
2 -<?php
3 -/**
4 - * Makes the required database updates for the log_user_text column
5 - *
6 - * Run via update.php or directly through populateLogUsertext.php
7 - *
8 - * @file
9 - * @ingroup Maintenance
10 - */
11 -
12 -define( 'LOG_USERTEXT_BATCH_SIZE', 100 );
13 -
14 -function populate_logusertext( $db ) {
15 - $start = $db->selectField( 'logging', 'MIN(log_id)', false, __FUNCTION__ );
16 - if( !$start ) {
17 - echo "Nothing to do.\n";
18 - return true;
19 - }
20 - $end = $db->selectField( 'logging', 'MAX(log_id)', false, __FUNCTION__ );
21 -
22 - # Do remaining chunk
23 - $end += LOG_USERTEXT_BATCH_SIZE - 1;
24 - $blockStart = $start;
25 - $blockEnd = $start + LOG_USERTEXT_BATCH_SIZE - 1;
26 - while( $blockEnd <= $end ) {
27 - echo "...doing log_id from $blockStart to $blockEnd\n";
28 - $cond = "log_id BETWEEN $blockStart AND $blockEnd AND log_user = user_id";
29 - $res = $db->select( array('logging','user'),
30 - array('log_id','user_name'), $cond, __FUNCTION__ );
31 - $batch = array();
32 - $db->begin();
33 - while( $row = $db->fetchObject( $res ) ) {
34 - $db->update( 'logging', array('log_user_text' => $row->user_name),
35 - array('log_id' => $row->log_id), __FUNCTION__ );
36 - }
37 - $db->commit();
38 - $blockStart += LOG_USERTEXT_BATCH_SIZE;
39 - $blockEnd += LOG_USERTEXT_BATCH_SIZE;
40 - wfWaitForSlaves( 5 );
41 - }
42 - if( $db->insert(
43 - 'updatelog',
44 - array( 'ul_key' => 'populate log_usertext' ),
45 - __FUNCTION__,
46 - 'IGNORE'
47 - )
48 - ) {
49 - wfOut( "log_usertext population complete.\n" );
50 - return true;
51 - } else {
52 - wfOut( "Could not insert log_usertext population row.\n" );
53 - return false;
54 - }
55 -}
 2+<?php
 3+/**
 4+ * Makes the required database updates for the log_user_text column
 5+ *
 6+ * Run via update.php or directly through populateLogUsertext.php
 7+ *
 8+ * @file
 9+ * @ingroup Maintenance
 10+ */
 11+
 12+define( 'LOG_USERTEXT_BATCH_SIZE', 100 );
 13+
 14+function populate_logusertext( $db ) {
 15+ $start = $db->selectField( 'logging', 'MIN(log_id)', false, __FUNCTION__ );
 16+ if( !$start ) {
 17+ echo "Nothing to do.\n";
 18+ return true;
 19+ }
 20+ $end = $db->selectField( 'logging', 'MAX(log_id)', false, __FUNCTION__ );
 21+
 22+ # Do remaining chunk
 23+ $end += LOG_USERTEXT_BATCH_SIZE - 1;
 24+ $blockStart = $start;
 25+ $blockEnd = $start + LOG_USERTEXT_BATCH_SIZE - 1;
 26+ while( $blockEnd <= $end ) {
 27+ echo "...doing log_id from $blockStart to $blockEnd\n";
 28+ $cond = "log_id BETWEEN $blockStart AND $blockEnd AND log_user = user_id";
 29+ $res = $db->select( array('logging','user'),
 30+ array('log_id','user_name'), $cond, __FUNCTION__ );
 31+ $batch = array();
 32+ $db->begin();
 33+ while( $row = $db->fetchObject( $res ) ) {
 34+ $db->update( 'logging', array('log_user_text' => $row->user_name),
 35+ array('log_id' => $row->log_id), __FUNCTION__ );
 36+ }
 37+ $db->commit();
 38+ $blockStart += LOG_USERTEXT_BATCH_SIZE;
 39+ $blockEnd += LOG_USERTEXT_BATCH_SIZE;
 40+ wfWaitForSlaves( 5 );
 41+ }
 42+ if( $db->insert(
 43+ 'updatelog',
 44+ array( 'ul_key' => 'populate log_usertext' ),
 45+ __FUNCTION__,
 46+ 'IGNORE'
 47+ )
 48+ ) {
 49+ wfOut( "log_usertext population complete.\n" );
 50+ return true;
 51+ } else {
 52+ wfOut( "Could not insert log_usertext population row.\n" );
 53+ return false;
 54+ }
 55+}
Property changes on: trunk/phase3/maintenance/populateLogUsertext.inc
___________________________________________________________________
Name: svn:eol-style
5656 + native
Index: trunk/phase3/maintenance/populateLogUsertext.php
@@ -1,17 +1,17 @@
2 -<?php
3 -/**
4 - * Makes the required database updates for Special:ProtectedPages
5 - * to show all protected pages, even ones before the page restrictions
6 - * schema change. All remaining page_restriction column values are moved
7 - * to the new table.
8 - *
9 - * @file
10 - * @ingroup Maintenance
11 - */
12 -
13 -require_once 'commandLine.inc';
14 -require_once 'populateLogUsertext.inc';
15 -
16 -$db =& wfGetDB( DB_MASTER );
17 -
18 -populate_logusertext( $db );
 2+<?php
 3+/**
 4+ * Makes the required database updates for Special:ProtectedPages
 5+ * to show all protected pages, even ones before the page restrictions
 6+ * schema change. All remaining page_restriction column values are moved
 7+ * to the new table.
 8+ *
 9+ * @file
 10+ * @ingroup Maintenance
 11+ */
 12+
 13+require_once 'commandLine.inc';
 14+require_once 'populateLogUsertext.inc';
 15+
 16+$db =& wfGetDB( DB_MASTER );
 17+
 18+populate_logusertext( $db );
Property changes on: trunk/phase3/maintenance/populateLogUsertext.php
___________________________________________________________________
Name: svn:eol-style
1919 + native
Property changes on: trunk/phase3/cache/.htaccess
___________________________________________________________________
Name: svn:eol-style
2020 + native
Property changes on: trunk/extensions/LiquidThreads/schema-changes/lqt-schema-change-thread_summary.sql
___________________________________________________________________
Name: svn:eol-style
2121 + native
Property changes on: trunk/extensions/ProofreadPage/SpecialProofreadPages.php
___________________________________________________________________
Name: svn:eol-style
2222 + native
Property changes on: trunk/extensions/ProofreadPage/ProofreadPage.sql
___________________________________________________________________
Name: svn:eol-style
2323 + native
Index: trunk/extensions/Minify/COPYING
@@ -1,32 +1,32 @@
2 -The Minify extension was written by Robert Rohde. The original code it contains
3 -may be copied and redistributed under the BSD License.
4 -
5 -The CSS compressor is a Java to PHP port of code by Julien Lecomte and Isaac Schlueter
6 -which was released in the BSD license.
7 -
8 -The JSMin module contained in jsmin.php was written by Ryan Grove under the MIT License
9 -and is ported from code by Daniel Crockford, see jsmin.php for details.
10 -
11 -
12 -BSD LICENSE
13 -
14 -Copyright (c) 2009 Robert Rohde
15 -
16 -Redistribution and use of this software in source and binary forms, with or without modification, are permitted
17 -provided that the following conditions are met:
18 -
19 - * Redistributions of source code must retain the above copyright notice, this list of conditions and the
20 - following disclaimer.
21 - * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
22 -following disclaimer in the documentation and/or other materials provided with the distribution.
23 - * Neither the name of the software nor the names of its contributors may be used to endorse or promote products
24 -derived from this software without specific prior written permission of the copyright holder.
25 -
26 -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
27 -INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
28 -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
29 -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30 -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
31 -WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 2+The Minify extension was written by Robert Rohde. The original code it contains
 3+may be copied and redistributed under the BSD License.
 4+
 5+The CSS compressor is a Java to PHP port of code by Julien Lecomte and Isaac Schlueter
 6+which was released in the BSD license.
 7+
 8+The JSMin module contained in jsmin.php was written by Ryan Grove under the MIT License
 9+and is ported from code by Daniel Crockford, see jsmin.php for details.
 10+
 11+-------------------------------------------------------------------------------
 12+
 13+BSD LICENSE
 14+
 15+Copyright (c) 2009 Robert Rohde
 16+
 17+Redistribution and use of this software in source and binary forms, with or without modification, are permitted
 18+provided that the following conditions are met:
 19+
 20+ * Redistributions of source code must retain the above copyright notice, this list of conditions and the
 21+ following disclaimer.
 22+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
 23+following disclaimer in the documentation and/or other materials provided with the distribution.
 24+ * Neither the name of the software nor the names of its contributors may be used to endorse or promote products
 25+derived from this software without specific prior written permission of the copyright holder.
 26+
 27+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
 28+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 29+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 30+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 31+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 32+WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 33+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Property changes on: trunk/extensions/Minify/COPYING
___________________________________________________________________
Name: svn:eol-style
3334 + native
Index: trunk/extensions/FlaggedRevs/api/ApiQueryReviewedpages.php
@@ -1,205 +1,205 @@
2 -<?php
3 -
4 -/*
5 - * Created on June 29, 2009
6 - *
7 - * API module for MediaWiki's FlaggedRevs extension
8 - *
9 - * This program is free software; you can redistribute it and/or modify
10 - * it under the terms of the GNU General Public License as published by
11 - * the Free Software Foundation; either version 2 of the License, or
12 - * (at your option) any later version.
13 - *
14 - * This program is distributed in the hope that it will be useful,
15 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 - * GNU General Public License for more details.
18 - *
19 - * You should have received a copy of the GNU General Public License along
20 - * with this program; if not, write to the Free Software Foundation, Inc.,
21 - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 - * http://www.gnu.org/copyleft/gpl.html
23 - */
24 -
25 -/**
26 - * Query module to list pages reviewed pages
27 - *
28 - * @ingroup FlaggedRevs
29 - */
30 -class ApiQueryReviewedpages extends ApiQueryGeneratorBase {
31 -
32 - public function __construct( $query, $moduleName ) {
33 - parent::__construct( $query, $moduleName, 'rp' );
34 - }
35 -
36 - public function execute() {
37 - $this->run();
38 - }
39 -
40 - public function executeGenerator( $resultPageSet ) {
41 - $this->run( $resultPageSet );
42 - }
43 -
44 - private function run( $resultPageSet = null ) {
45 - $params = $this->extractRequestParams();
46 -
47 - // Construct SQL Query
48 - $this->addTables( array( 'page', 'flaggedpages' ) );
49 - $this->addWhereFld( 'page_namespace', $params['namespace'] );
50 - if( $params['filterredir'] == 'redirects' )
51 - $this->addWhereFld( 'page_is_redirect', 1 );
52 - if( $params['filterredir'] == 'nonredirects' )
53 - $this->addWhereFld( 'page_is_redirect', 0 );
54 - if( $params['filterlevel'] !== null )
55 - $this->addWhereFld( 'fp_quality', $params['filterlevel'] );
56 - $this->addWhereRange(
57 - 'fp_page_id',
58 - $params['dir'],
59 - $params['start'],
60 - $params['end']
61 - );
62 - $this->addWhere( 'page_id=fp_page_id' );
63 - $this->addOption(
64 - 'USE INDEX',
65 - array( 'flaggedpages' => 'PRIMARY' )
66 - );
67 -
68 - if ( is_null( $resultPageSet ) ) {
69 - $this->addFields( array (
70 - 'page_id',
71 - 'page_namespace',
72 - 'page_title',
73 - 'page_len',
74 - 'page_latest',
75 - 'fp_page_id',
76 - 'fp_quality',
77 - 'fp_stable'
78 - ) );
79 - } else {
80 - $this->addFields( $resultPageSet->getPageTableFields() );
81 - $this->addFields ( 'fp_page_id' );
82 - }
83 -
84 - $limit = $params['limit'];
85 - $this->addOption( 'LIMIT', $limit+1 );
86 - $res = $this->select( __METHOD__ );
87 -
88 - $data = array ();
89 - $count = 0;
90 - $db = $this->getDB();
91 - while ( $row = $db->fetchObject( $res ) ) {
92 - if ( ++$count > $limit ) {
93 - // We've reached the one extra which shows that there are
94 - // additional pages to be had. Stop here...
95 - $this->setContinueEnumParameter( 'start', $row->fp_page_id );
96 - break;
97 - }
98 -
99 - if ( is_null( $resultPageSet ) ) {
100 - $title = Title::newFromRow( $row );
101 - $data[] = array(
102 - 'pageid' => intval( $row->page_id ),
103 - 'ns' => intval( $title->getNamespace() ),
104 - 'title' => $title->getPrefixedText(),
105 - 'revid' => intval( $row->page_latest ),
106 - 'stable_revid' => intval( $row->fp_stable ),
107 - 'flagged_level' => intval( $row->fp_quality ),
108 - 'flagged_level_text' => FlaggedRevs::getQualityLevelText( $row->fp_quality )
109 - );
110 - } else {
111 - $resultPageSet->processDbRow( $row );
112 - }
113 - }
114 - $db->freeResult( $res );
115 -
116 - if ( is_null( $resultPageSet ) ) {
117 - $result = $this->getResult();
118 - $result->setIndexedTagName( $data, 'p' );
119 - $result->addValue( 'query', $this->getModuleName(), $data );
120 - }
121 - }
122 -
123 - public function getAllowedParams() {
124 - global $wgFlaggedRevsNamespaces;
125 - return array (
126 - 'start' => array (
127 - ApiBase::PARAM_TYPE => 'integer'
128 - ),
129 - 'end' => array (
130 - ApiBase::PARAM_TYPE => 'integer'
131 - ),
132 - 'dir' => array (
133 - ApiBase::PARAM_DFLT => 'newer',
134 - ApiBase::PARAM_TYPE => array (
135 - 'newer',
136 - 'older'
137 - )
138 - ),
139 - 'namespace' => array (
140 - ApiBase::PARAM_DFLT =>
141 - !$wgFlaggedRevsNamespaces ?
142 - NS_MAIN :
143 - $wgFlaggedRevsNamespaces[0],
144 - ApiBase::PARAM_TYPE => 'namespace',
145 - ApiBase::PARAM_ISMULTI => true,
146 - ),
147 - 'filterredir' => array (
148 - ApiBase::PARAM_DFLT => 'all',
149 - ApiBase::PARAM_TYPE => array (
150 - 'redirects',
151 - 'nonredirects',
152 - 'all'
153 - )
154 - ),
155 - 'filterlevel' => array (
156 - ApiBase::PARAM_DFLT => null,
157 - ApiBase::PARAM_TYPE => 'integer',
158 - ApiBase::PARAM_MIN => 0,
159 - ApiBase::PARAM_MAX => 2,
160 - ),
161 - 'limit' => array (
162 - ApiBase::PARAM_DFLT => 10,
163 - ApiBase::PARAM_TYPE => 'limit',
164 - ApiBase::PARAM_MIN => 1,
165 - ApiBase::PARAM_MAX => ApiBase::LIMIT_BIG1,
166 - ApiBase::PARAM_MAX2 => ApiBase::LIMIT_BIG2
167 - )
168 - );
169 - }
170 -
171 - public function getParamDescription() {
172 - return array (
173 - 'start' => 'Start listing at this page id.',
174 - 'end' => 'Stop listing at this page id.',
175 - 'namespace' => 'The namespaces to enumerate.',
176 - 'filterredir' => 'How to filter for redirects',
177 - 'filterlevel' => 'How to filter by quality (0=sighted,1=quality)',
178 - 'limit' => 'How many total pages to return.',
179 - 'dir' => array(
180 - 'In which direction to list.',
181 - '*newer: list the newest pages first',
182 - '*older: list the oldest pages first'
183 - )
184 - );
185 - }
186 -
187 - public function getDescription() {
188 - return array(
189 - 'Returns a list of pages, that have been reviewed,',
190 - 'sorted by page id.'
191 - );
192 - }
193 -
194 - protected function getExamples() {
195 - return array (
196 - 'Show a list of reviewed pages',
197 - ' api.php?action=query&list=reviewedpages&rpnamespace=0&rpfilterlevel=0',
198 - 'Show info about some reviewed pages',
199 - ' api.php?action=query&generator=reviewedpages&grplimit=4&prop=info',
200 - );
201 - }
202 -
203 - public function getVersion() {
204 - return __CLASS__.': $Id: ApiQueryReviewedpages.php 52557 aaron $';
205 - }
206 -}
 2+<?php
 3+
 4+/*
 5+ * Created on June 29, 2009
 6+ *
 7+ * API module for MediaWiki's FlaggedRevs extension
 8+ *
 9+ * This program is free software; you can redistribute it and/or modify
 10+ * it under the terms of the GNU General Public License as published by
 11+ * the Free Software Foundation; either version 2 of the License, or
 12+ * (at your option) any later version.
 13+ *
 14+ * This program is distributed in the hope that it will be useful,
 15+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 16+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 17+ * GNU General Public License for more details.
 18+ *
 19+ * You should have received a copy of the GNU General Public License along
 20+ * with this program; if not, write to the Free Software Foundation, Inc.,
 21+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 22+ * http://www.gnu.org/copyleft/gpl.html
 23+ */
 24+
 25+/**
 26+ * Query module to list pages reviewed pages
 27+ *
 28+ * @ingroup FlaggedRevs
 29+ */
 30+class ApiQueryReviewedpages extends ApiQueryGeneratorBase {
 31+
 32+ public function __construct( $query, $moduleName ) {
 33+ parent::__construct( $query, $moduleName, 'rp' );
 34+ }
 35+
 36+ public function execute() {
 37+ $this->run();
 38+ }
 39+
 40+ public function executeGenerator( $resultPageSet ) {
 41+ $this->run( $resultPageSet );
 42+ }
 43+
 44+ private function run( $resultPageSet = null ) {
 45+ $params = $this->extractRequestParams();
 46+
 47+ // Construct SQL Query
 48+ $this->addTables( array( 'page', 'flaggedpages' ) );
 49+ $this->addWhereFld( 'page_namespace', $params['namespace'] );
 50+ if( $params['filterredir'] == 'redirects' )
 51+ $this->addWhereFld( 'page_is_redirect', 1 );
 52+ if( $params['filterredir'] == 'nonredirects' )
 53+ $this->addWhereFld( 'page_is_redirect', 0 );
 54+ if( $params['filterlevel'] !== null )
 55+ $this->addWhereFld( 'fp_quality', $params['filterlevel'] );
 56+ $this->addWhereRange(
 57+ 'fp_page_id',
 58+ $params['dir'],
 59+ $params['start'],
 60+ $params['end']
 61+ );
 62+ $this->addWhere( 'page_id=fp_page_id' );
 63+ $this->addOption(
 64+ 'USE INDEX',
 65+ array( 'flaggedpages' => 'PRIMARY' )
 66+ );
 67+
 68+ if ( is_null( $resultPageSet ) ) {
 69+ $this->addFields( array (
 70+ 'page_id',
 71+ 'page_namespace',
 72+ 'page_title',
 73+ 'page_len',
 74+ 'page_latest',
 75+ 'fp_page_id',
 76+ 'fp_quality',
 77+ 'fp_stable'
 78+ ) );
 79+ } else {
 80+ $this->addFields( $resultPageSet->getPageTableFields() );
 81+ $this->addFields ( 'fp_page_id' );
 82+ }
 83+
 84+ $limit = $params['limit'];
 85+ $this->addOption( 'LIMIT', $limit+1 );
 86+ $res = $this->select( __METHOD__ );
 87+
 88+ $data = array ();
 89+ $count = 0;
 90+ $db = $this->getDB();
 91+ while ( $row = $db->fetchObject( $res ) ) {
 92+ if ( ++$count > $limit ) {
 93+ // We've reached the one extra which shows that there are
 94+ // additional pages to be had. Stop here...
 95+ $this->setContinueEnumParameter( 'start', $row->fp_page_id );
 96+ break;
 97+ }
 98+
 99+ if ( is_null( $resultPageSet ) ) {
 100+ $title = Title::newFromRow( $row );
 101+ $data[] = array(
 102+ 'pageid' => intval( $row->page_id ),
 103+ 'ns' => intval( $title->getNamespace() ),
 104+ 'title' => $title->getPrefixedText(),
 105+ 'revid' => intval( $row->page_latest ),
 106+ 'stable_revid' => intval( $row->fp_stable ),
 107+ 'flagged_level' => intval( $row->fp_quality ),
 108+ 'flagged_level_text' => FlaggedRevs::getQualityLevelText( $row->fp_quality )
 109+ );
 110+ } else {
 111+ $resultPageSet->processDbRow( $row );
 112+ }
 113+ }
 114+ $db->freeResult( $res );
 115+
 116+ if ( is_null( $resultPageSet ) ) {
 117+ $result = $this->getResult();
 118+ $result->setIndexedTagName( $data, 'p' );
 119+ $result->addValue( 'query', $this->getModuleName(), $data );
 120+ }
 121+ }
 122+
 123+ public function getAllowedParams() {
 124+ global $wgFlaggedRevsNamespaces;
 125+ return array (
 126+ 'start' => array (
 127+ ApiBase::PARAM_TYPE => 'integer'
 128+ ),
 129+ 'end' => array (
 130+ ApiBase::PARAM_TYPE => 'integer'
 131+ ),
 132+ 'dir' => array (
 133+ ApiBase::PARAM_DFLT => 'newer',
 134+ ApiBase::PARAM_TYPE => array (
 135+ 'newer',
 136+ 'older'
 137+ )
 138+ ),
 139+ 'namespace' => array (
 140+ ApiBase::PARAM_DFLT =>
 141+ !$wgFlaggedRevsNamespaces ?
 142+ NS_MAIN :
 143+ $wgFlaggedRevsNamespaces[0],
 144+ ApiBase::PARAM_TYPE => 'namespace',
 145+ ApiBase::PARAM_ISMULTI => true,
 146+ ),
 147+ 'filterredir' => array (
 148+ ApiBase::PARAM_DFLT => 'all',
 149+ ApiBase::PARAM_TYPE => array (
 150+ 'redirects',
 151+ 'nonredirects',
 152+ 'all'
 153+ )
 154+ ),
 155+ 'filterlevel' => array (
 156+ ApiBase::PARAM_DFLT => null,
 157+ ApiBase::PARAM_TYPE => 'integer',
 158+ ApiBase::PARAM_MIN => 0,
 159+ ApiBase::PARAM_MAX => 2,
 160+ ),
 161+ 'limit' => array (
 162+ ApiBase::PARAM_DFLT => 10,
 163+ ApiBase::PARAM_TYPE => 'limit',
 164+ ApiBase::PARAM_MIN => 1,
 165+ ApiBase::PARAM_MAX => ApiBase::LIMIT_BIG1,
 166+ ApiBase::PARAM_MAX2 => ApiBase::LIMIT_BIG2
 167+ )
 168+ );
 169+ }
 170+
 171+ public function getParamDescription() {
 172+ return array (
 173+ 'start' => 'Start listing at this page id.',
 174+ 'end' => 'Stop listing at this page id.',
 175+ 'namespace' => 'The namespaces to enumerate.',
 176+ 'filterredir' => 'How to filter for redirects',
 177+ 'filterlevel' => 'How to filter by quality (0=sighted,1=quality)',
 178+ 'limit' => 'How many total pages to return.',
 179+ 'dir' => array(
 180+ 'In which direction to list.',
 181+ '*newer: list the newest pages first',
 182+ '*older: list the oldest pages first'
 183+ )
 184+ );
 185+ }
 186+
 187+ public function getDescription() {
 188+ return array(
 189+ 'Returns a list of pages, that have been reviewed,',
 190+ 'sorted by page id.'
 191+ );
 192+ }
 193+
 194+ protected function getExamples() {
 195+ return array (
 196+ 'Show a list of reviewed pages',
 197+ ' api.php?action=query&list=reviewedpages&rpnamespace=0&rpfilterlevel=0',
 198+ 'Show info about some reviewed pages',
 199+ ' api.php?action=query&generator=reviewedpages&grplimit=4&prop=info',
 200+ );
 201+ }
 202+
 203+ public function getVersion() {
 204+ return __CLASS__.': $Id: ApiQueryReviewedpages.php 52557 aaron $';
 205+ }
 206+}
Property changes on: trunk/extensions/FlaggedRevs/api/ApiQueryReviewedpages.php
___________________________________________________________________
Name: svn:eol-style
207207 + native
Index: trunk/extensions/FlaggedRevs/api/ApiQueryUnreviewedpages.php
@@ -1,188 +1,188 @@
2 -<?php
3 -
4 -/*
5 - * Created on June 29, 2009
6 - *
7 - * API module for MediaWiki's FlaggedRevs extension
8 - *
9 - * This program is free software; you can redistribute it and/or modify
10 - * it under the terms of the GNU General Public License as published by
11 - * the Free Software Foundation; either version 2 of the License, or
12 - * (at your option) any later version.
13 - *
14 - * This program is distributed in the hope that it will be useful,
15 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 - * GNU General Public License for more details.
18 - *
19 - * You should have received a copy of the GNU General Public License along
20 - * with this program; if not, write to the Free Software Foundation, Inc.,
21 - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 - * http://www.gnu.org/copyleft/gpl.html
23 - */
24 -
25 -/**
26 - * Query module to list pages unreviewed pages
27 - *
28 - * @ingroup FlaggedRevs
29 - */
30 -class ApiQueryUnreviewedpages extends ApiQueryGeneratorBase {
31 -
32 - public function __construct( $query, $moduleName ) {
33 - parent::__construct( $query, $moduleName, 'ur' );
34 - }
35 -
36 - public function execute() {
37 - $this->run();
38 - }
39 -
40 - public function executeGenerator( $resultPageSet ) {
41 - $this->run( $resultPageSet );
42 - }
43 -
44 - private function run( $resultPageSet = null ) {
45 - $params = $this->extractRequestParams();
46 -
47 - // Construct SQL Query
48 - $this->addTables( array( 'page', 'flaggedpages' ) );
49 - $this->addWhereFld( 'page_namespace', $params['namespace'] );
50 - if( $params['filterredir'] == 'redirects' )
51 - $this->addWhereFld( 'page_is_redirect', 1 );
52 - if( $params['filterredir'] == 'nonredirects' )
53 - $this->addWhereFld( 'page_is_redirect', 0 );
54 - $this->addWhereRange(
55 - 'page_title',
56 - 'newer',
57 - $params['start'],
58 - $params['end']
59 - );
60 - $this->addJoinConds(
61 - array('flaggedpages' => array ('LEFT JOIN','fp_page_id=page_id') )
62 - );
63 - $this->addWhere( 'fp_page_id IS NULL OR
64 - fp_quality < '.intval($params['filterlevel']) );
65 - $this->addOption(
66 - 'USE INDEX',
67 - array( 'page' => 'name_title', 'flaggedpages' => 'PRIMARY' )
68 - );
69 -
70 - if ( is_null( $resultPageSet ) ) {
71 - $this->addFields( array (
72 - 'page_id',
73 - 'page_namespace',
74 - 'page_title',
75 - 'page_len',
76 - 'page_latest',
77 - ) );
78 - } else {
79 - $this->addFields( $resultPageSet->getPageTableFields() );
80 - }
81 -
82 - $limit = $params['limit'];
83 - $this->addOption( 'LIMIT', $limit+1 );
84 - $res = $this->select( __METHOD__ );
85 -
86 - $data = array ();
87 - $count = 0;
88 - $db = $this->getDB();
89 - while ( $row = $db->fetchObject( $res ) ) {
90 - if ( ++$count > $limit ) {
91 - // We've reached the one extra which shows that there are
92 - // additional pages to be had. Stop here...
93 - $this->setContinueEnumParameter( 'start', $row->page_title );
94 - break;
95 - }
96 -
97 - if ( is_null( $resultPageSet ) ) {
98 - $title = Title::newFromRow( $row );
99 - $data[] = array(
100 - 'pageid' => intval( $row->page_id ),
101 - 'ns' => intval( $title->getNamespace() ),
102 - 'title' => $title->getPrefixedText(),
103 - 'revid' => intval( $row->page_latest ),
104 - );
105 - } else {
106 - $resultPageSet->processDbRow( $row );
107 - }
108 - }
109 - $db->freeResult( $res );
110 -
111 - if ( is_null( $resultPageSet ) ) {
112 - $result = $this->getResult();
113 - $result->setIndexedTagName( $data, 'p' );
114 - $result->addValue( 'query', $this->getModuleName(), $data );
115 - }
116 - }
117 -
118 - public function getAllowedParams() {
119 - global $wgFlaggedRevsNamespaces;
120 - return array (
121 - 'start' => array (
122 - ApiBase::PARAM_TYPE => 'sring'
123 - ),
124 - 'end' => array (
125 - ApiBase::PARAM_TYPE => 'string'
126 - ),
127 - 'namespace' => array (
128 - ApiBase::PARAM_DFLT =>
129 - !$wgFlaggedRevsNamespaces ?
130 - NS_MAIN :
131 - $wgFlaggedRevsNamespaces[0],
132 - ApiBase::PARAM_TYPE => 'namespace',
133 - ApiBase::PARAM_ISMULTI => true,
134 - ),
135 - 'filterredir' => array (
136 - ApiBase::PARAM_DFLT => 'all',
137 - ApiBase::PARAM_TYPE => array (
138 - 'redirects',
139 - 'nonredirects',
140 - 'all'
141 - )
142 - ),
143 - 'filterlevel' => array (
144 - ApiBase::PARAM_DFLT => 0,
145 - ApiBase::PARAM_TYPE => 'integer',
146 - ApiBase::PARAM_MIN => 0,
147 - ApiBase::PARAM_MAX => 2,
148 - ),
149 - 'limit' => array (
150 - ApiBase::PARAM_DFLT => 10,
151 - ApiBase::PARAM_TYPE => 'limit',
152 - ApiBase::PARAM_MIN => 1,
153 - ApiBase::PARAM_MAX => ApiBase::LIMIT_BIG1,
154 - ApiBase::PARAM_MAX2 => ApiBase::LIMIT_BIG2
155 - )
156 - );
157 - }
158 -
159 - public function getParamDescription() {
160 - return array (
161 - 'start' => 'Start listing at this page title.',
162 - 'end' => 'Stop listing at this page title.',
163 - 'namespace' => 'The namespaces to enumerate.',
164 - 'filterredir' => 'How to filter for redirects',
165 - 'filterlevel' => 'How to filter by quality (0=sighted,1=quality)',
166 - 'limit' => 'How many total pages to return.',
167 - );
168 - }
169 -
170 - public function getDescription() {
171 - return array(
172 - 'Returns a list of pages, that have not been reviewed (to "filterlevel"),',
173 - 'sorted by page title.'
174 - );
175 - }
176 -
177 - protected function getExamples() {
178 - return array (
179 - 'Show a list of unreviewed pages',
180 - ' api.php?action=query&list=unreviewedpages&urnamespace=0&urfilterlevel=0',
181 - 'Show info about some unreviewed pages',
182 - ' api.php?action=query&generator=unreviewedpages&urnamespace=0&gurlimit=4&prop=info',
183 - );
184 - }
185 -
186 - public function getVersion() {
187 - return __CLASS__.': $Id: ApiQueryUnreviewedpages.php 52567 aaron $';
188 - }
189 -}
 2+<?php
 3+
 4+/*
 5+ * Created on June 29, 2009
 6+ *
 7+ * API module for MediaWiki's FlaggedRevs extension
 8+ *
 9+ * This program is free software; you can redistribute it and/or modify
 10+ * it under the terms of the GNU General Public License as published by
 11+ * the Free Software Foundation; either version 2 of the License, or
 12+ * (at your option) any later version.
 13+ *
 14+ * This program is distributed in the hope that it will be useful,
 15+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 16+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 17+ * GNU General Public License for more details.
 18+ *
 19+ * You should have received a copy of the GNU General Public License along
 20+ * with this program; if not, write to the Free Software Foundation, Inc.,
 21+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 22+ * http://www.gnu.org/copyleft/gpl.html
 23+ */
 24+
 25+/**
 26+ * Query module to list pages unreviewed pages
 27+ *
 28+ * @ingroup FlaggedRevs
 29+ */
 30+class ApiQueryUnreviewedpages extends ApiQueryGeneratorBase {
 31+
 32+ public function __construct( $query, $moduleName ) {
 33+ parent::__construct( $query, $moduleName, 'ur' );
 34+ }
 35+
 36+ public function execute() {
 37+ $this->run();
 38+ }
 39+
 40+ public function executeGenerator( $resultPageSet ) {
 41+ $this->run( $resultPageSet );
 42+ }
 43+
 44+ private function run( $resultPageSet = null ) {
 45+ $params = $this->extractRequestParams();
 46+
 47+ // Construct SQL Query
 48+ $this->addTables( array( 'page', 'flaggedpages' ) );
 49+ $this->addWhereFld( 'page_namespace', $params['namespace'] );
 50+ if( $params['filterredir'] == 'redirects' )
 51+ $this->addWhereFld( 'page_is_redirect', 1 );
 52+ if( $params['filterredir'] == 'nonredirects' )
 53+ $this->addWhereFld( 'page_is_redirect', 0 );
 54+ $this->addWhereRange(
 55+ 'page_title',
 56+ 'newer',
 57+ $params['start'],
 58+ $params['end']
 59+ );
 60+ $this->addJoinConds(
 61+ array('flaggedpages' => array ('LEFT JOIN','fp_page_id=page_id') )
 62+ );
 63+ $this->addWhere( 'fp_page_id IS NULL OR
 64+ fp_quality < '.intval($params['filterlevel']) );
 65+ $this->addOption(
 66+ 'USE INDEX',
 67+ array( 'page' => 'name_title', 'flaggedpages' => 'PRIMARY' )
 68+ );
 69+
 70+ if ( is_null( $resultPageSet ) ) {
 71+ $this->addFields( array (
 72+ 'page_id',
 73+ 'page_namespace',
 74+ 'page_title',
 75+ 'page_len',
 76+ 'page_latest',
 77+ ) );
 78+ } else {
 79+ $this->addFields( $resultPageSet->getPageTableFields() );
 80+ }
 81+
 82+ $limit = $params['limit'];
 83+ $this->addOption( 'LIMIT', $limit+1 );
 84+ $res = $this->select( __METHOD__ );
 85+
 86+ $data = array ();
 87+ $count = 0;
 88+ $db = $this->getDB();
 89+ while ( $row = $db->fetchObject( $res ) ) {
 90+ if ( ++$count > $limit ) {
 91+ // We've reached the one extra which shows that there are
 92+ // additional pages to be had. Stop here...
 93+ $this->setContinueEnumParameter( 'start', $row->page_title );
 94+ break;
 95+ }
 96+
 97+ if ( is_null( $resultPageSet ) ) {
 98+ $title = Title::newFromRow( $row );
 99+ $data[] = array(
 100+ 'pageid' => intval( $row->page_id ),
 101+ 'ns' => intval( $title->getNamespace() ),
 102+ 'title' => $title->getPrefixedText(),
 103+ 'revid' => intval( $row->page_latest ),
 104+ );
 105+ } else {
 106+ $resultPageSet->processDbRow( $row );
 107+ }
 108+ }
 109+ $db->freeResult( $res );
 110+
 111+ if ( is_null( $resultPageSet ) ) {
 112+ $result = $this->getResult();
 113+ $result->setIndexedTagName( $data, 'p' );
 114+ $result->addValue( 'query', $this->getModuleName(), $data );
 115+ }
 116+ }
 117+
 118+ public function getAllowedParams() {
 119+ global $wgFlaggedRevsNamespaces;
 120+ return array (
 121+ 'start' => array (
 122+ ApiBase::PARAM_TYPE => 'sring'
 123+ ),
 124+ 'end' => array (
 125+ ApiBase::PARAM_TYPE => 'string'
 126+ ),
 127+ 'namespace' => array (
 128+ ApiBase::PARAM_DFLT =>
 129+ !$wgFlaggedRevsNamespaces ?
 130+ NS_MAIN :
 131+ $wgFlaggedRevsNamespaces[0],
 132+ ApiBase::PARAM_TYPE => 'namespace',
 133+ ApiBase::PARAM_ISMULTI => true,
 134+ ),
 135+ 'filterredir' => array (
 136+ ApiBase::PARAM_DFLT => 'all',
 137+ ApiBase::PARAM_TYPE => array (
 138+ 'redirects',
 139+ 'nonredirects',
 140+ 'all'
 141+ )
 142+ ),
 143+ 'filterlevel' => array (
 144+ ApiBase::PARAM_DFLT => 0,
 145+ ApiBase::PARAM_TYPE => 'integer',
 146+ ApiBase::PARAM_MIN => 0,
 147+ ApiBase::PARAM_MAX => 2,
 148+ ),
 149+ 'limit' => array (
 150+ ApiBase::PARAM_DFLT => 10,
 151+ ApiBase::PARAM_TYPE => 'limit',
 152+ ApiBase::PARAM_MIN => 1,
 153+ ApiBase::PARAM_MAX => ApiBase::LIMIT_BIG1,
 154+ ApiBase::PARAM_MAX2 => ApiBase::LIMIT_BIG2
 155+ )
 156+ );
 157+ }
 158+
 159+ public function getParamDescription() {
 160+ return array (
 161+ 'start' => 'Start listing at this page title.',
 162+ 'end' => 'Stop listing at this page title.',
 163+ 'namespace' => 'The namespaces to enumerate.',
 164+ 'filterredir' => 'How to filter for redirects',
 165+ 'filterlevel' => 'How to filter by quality (0=sighted,1=quality)',
 166+ 'limit' => 'How many total pages to return.',
 167+ );
 168+ }
 169+
 170+ public function getDescription() {
 171+ return array(
 172+ 'Returns a list of pages, that have not been reviewed (to "filterlevel"),',
 173+ 'sorted by page title.'
 174+ );
 175+ }
 176+
 177+ protected function getExamples() {
 178+ return array (
 179+ 'Show a list of unreviewed pages',
 180+ ' api.php?action=query&list=unreviewedpages&urnamespace=0&urfilterlevel=0',
 181+ 'Show info about some unreviewed pages',
 182+ ' api.php?action=query&generator=unreviewedpages&urnamespace=0&gurlimit=4&prop=info',
 183+ );
 184+ }
 185+
 186+ public function getVersion() {
 187+ return __CLASS__.': $Id: ApiQueryUnreviewedpages.php 52567 aaron $';
 188+ }
 189+}
Property changes on: trunk/extensions/FlaggedRevs/api/ApiQueryUnreviewedpages.php
___________________________________________________________________
Name: svn:eol-style
190190 + native
Property changes on: trunk/extensions/Translate/utils/JsSelectToInput.php
___________________________________________________________________
Name: svn:eol-style
191191 + native
Property changes on: trunk/extensions/Translate/utils/JsSelectToInput.js
___________________________________________________________________
Name: svn:eol-style
192192 + native
Property changes on: trunk/extensions/Translate/utils/HTMLJsSelectToInputField.php
___________________________________________________________________
Name: svn:eol-style
193193 + native

Status & tagging log