r36347 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r36346‎ | r36347 | r36348 >
Date:19:49, 16 June 2008
Author:catrope
Status:old
Tags:
Comment:
(bug 14402) Added smaxage parameter to api.php
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/api/ApiMain.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiMain.php
@@ -154,7 +154,7 @@
155155
156156 $this->mRequest = & $request;
157157
158 - $this->mSquidMaxage = 0;
 158+ $this->mSquidMaxage = -1; // flag for executeActionWithErrorHandling()
159159 $this->mCommit = false;
160160 }
161161
@@ -260,6 +260,11 @@
261261 $this->printResult(true);
262262 }
263263
 264+ $params = $this->extractRequestParams();
 265+ if($this->mSquidMaxage == -1)
 266+ # Nobody called setCacheMaxAge(), use the smaxage parameter
 267+ $this->mSquidMaxage = $params['smaxage'];
 268+
264269 // Set the cache expiration at the last moment, as any errors may change the expiration.
265270 // if $this->mSquidMaxage == 0, the expiry time is set to the first second of unix epoch
266271 $expires = $this->mSquidMaxage == 0 ? 1 : time() + $this->mSquidMaxage;
@@ -411,6 +416,10 @@
412417 'maxlag' => array (
413418 ApiBase :: PARAM_TYPE => 'integer'
414419 ),
 420+ 'smaxage' => array (
 421+ ApiBase :: PARAM_TYPE => 'integer',
 422+ ApiBase :: PARAM_DFLT => 0
 423+ ),
415424 );
416425 }
417426
@@ -422,7 +431,8 @@
423432 'format' => 'The format of the output',
424433 'action' => 'What action you would like to perform',
425434 'version' => 'When showing help, include version for each module',
426 - 'maxlag' => 'Maximum lag'
 435+ 'maxlag' => 'Maximum lag',
 436+ 'smaxage' => 'Cache the result for this many seconds. Errors are never cached',
427437 );
428438 }
429439
Index: trunk/phase3/RELEASE-NOTES
@@ -450,6 +450,7 @@
451451 * (bug 14526) Unescaped SQL in list=backlinks
452452 * Added 'hidden' flag to list=allcategories and prop=categoryinfo output
453453 * Added nocreate parameter to action=edit
 454+* (bug 14402) Added smaxage parameter to api.php
454455
455456 === Languages updated in 1.13 ===
456457

Status & tagging log