38 protected function checkC( $expected,
$params, $expectedCount, $id, $continue =
true ) {
39 $result = $this->
query(
$params, $expectedCount, $id, $continue );
52 protected function query(
$params, $expectedCount, $id, $useContinue =
true ) {
65 $a =
strpos( $a,
'continue' ) !==
false ?
'zzz ' .
$a :
$a;
66 $b =
strpos( $b,
'continue' ) !==
false ?
'zzz ' .
$b :
$b;
72 $this->
assertLessThan( $expectedCount, $count,
"$id more data: $reqStr" );
73 if ( $this->mVerbose ) {
74 print "$id (#$count): $reqStr\n";
78 }
catch ( Exception
$e ) {
79 throw new Exception(
"$id on $count", 0,
$e );
84 $this->fail(
"$id Warnings on #$count in $reqStr\n$warnings" );
88 $continue =
$data[
'continue'];
93 if ( $this->mVerbose ) {
98 if ( empty( $continue ) ) {
99 $this->
assertEquals( $expectedCount, $count,
"$id finished early" );
102 }
elseif ( !$useContinue ) {
103 $this->
assertFalse(
'Non-smart query must be requested all at once' );
114 if (
isset( $q[
'pages'] ) ) {
115 foreach ( $q[
'pages'] as $p ) {
117 if (
isset( $p[
'links'] ) ) {
122 $p[
'links'] ) ) .
']';
124 if (
isset( $p[
'categories'] ) ) {
127 return str_replace(
'Category:',
'', $v[
'title'] );
129 $p[
'categories'] ) ) .
')';
134 if (
isset( $q[
'allcategories'] ) ) {
135 $print[] =
'*Cats/(' . implode(
',',
array_map(
139 $q[
'allcategories'] ) ) .
')';
144 print ' ' . implode(
' ', $print ) .
"\n";
147 private static function GetItems( $q, $moduleName, $name, &$print ) {
148 if (
isset( $q[$moduleName] ) ) {
149 $print[] =
"*$name/[" . implode(
',',
164 protected function mergeResult( &$results, $newResult, $numericIds =
false ) {
168 'Type of result and data do not match'
171 $this->
assertEquals( $results, $newResult,
'Repeated result must be the same as before' );
174 foreach ( $newResult as $key =>
$value ) {
175 if ( !$numericIds &&
$sort ===
null ) {
180 return strcmp( $a[
'title'], $b[
'title'] );
197 }
elseif ( !$keyExists ) {
204 ksort( $results, SORT_NUMERIC );
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
query( $params, $expectedCount, $id, $useContinue=true)
Run query in a loop until no more values are available.
static GetItems( $q, $moduleName, $name, &$print)
mergeResult(&$results, $newResult, $numericIds=false)
Recursively merge the new result returned from the query to the previous results.
$mVerbose
Enable to print in-depth debugging info during the test run.
checkC( $expected, $params, $expectedCount, $id, $continue=true)
Run query() and compare against expected values.
This class has some common functionality for testing query module.
assertResult( $exp, $result, $message='')
doApiRequest(array $params, array $session=null, $appendModule=false, User $user=null, $tokenType=null)
Does the API request and returns the result.
namespace being checked & $result
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction you ll probably need to make sure the header is varied on $request
returning false will NOT prevent logging $e
while(( $__line=Maintenance::readconsole()) !==false) print
$data
Utility to generate mapping file used in mw.Title (phpCharToUpper.json)