Index: trunk/phase3/includes/api/ApiMain.php |
— | — | @@ -154,7 +154,7 @@ |
155 | 155 | |
156 | 156 | $this->mRequest = & $request; |
157 | 157 | |
158 | | - $this->mSquidMaxage = 0; |
| 158 | + $this->mSquidMaxage = -1; // flag for executeActionWithErrorHandling() |
159 | 159 | $this->mCommit = false; |
160 | 160 | } |
161 | 161 | |
— | — | @@ -260,6 +260,11 @@ |
261 | 261 | $this->printResult(true); |
262 | 262 | } |
263 | 263 | |
| 264 | + $params = $this->extractRequestParams(); |
| 265 | + if($this->mSquidMaxage == -1) |
| 266 | + # Nobody called setCacheMaxAge(), use the smaxage parameter |
| 267 | + $this->mSquidMaxage = $params['smaxage']; |
| 268 | + |
264 | 269 | // Set the cache expiration at the last moment, as any errors may change the expiration. |
265 | 270 | // if $this->mSquidMaxage == 0, the expiry time is set to the first second of unix epoch |
266 | 271 | $expires = $this->mSquidMaxage == 0 ? 1 : time() + $this->mSquidMaxage; |
— | — | @@ -411,6 +416,10 @@ |
412 | 417 | 'maxlag' => array ( |
413 | 418 | ApiBase :: PARAM_TYPE => 'integer' |
414 | 419 | ), |
| 420 | + 'smaxage' => array ( |
| 421 | + ApiBase :: PARAM_TYPE => 'integer', |
| 422 | + ApiBase :: PARAM_DFLT => 0 |
| 423 | + ), |
415 | 424 | ); |
416 | 425 | } |
417 | 426 | |
— | — | @@ -422,7 +431,8 @@ |
423 | 432 | 'format' => 'The format of the output', |
424 | 433 | 'action' => 'What action you would like to perform', |
425 | 434 | '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', |
427 | 437 | ); |
428 | 438 | } |
429 | 439 | |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -450,6 +450,7 @@ |
451 | 451 | * (bug 14526) Unescaped SQL in list=backlinks |
452 | 452 | * Added 'hidden' flag to list=allcategories and prop=categoryinfo output |
453 | 453 | * Added nocreate parameter to action=edit |
| 454 | +* (bug 14402) Added smaxage parameter to api.php |
454 | 455 | |
455 | 456 | === Languages updated in 1.13 === |
456 | 457 | |