$this->mResult = new ApiResult( $this );
$this->mEnableWrite = $enableWrite;
- $this->mSquidMaxage = - 1; // flag for executeActionWithErrorHandling()
+ $this->mSquidMaxage = -1; // flag for executeActionWithErrorHandling()
$this->mCommit = false;
}
public function setCacheMode( $mode ) {
if ( !in_array( $mode, array( 'private', 'public', 'anon-public-user-private' ) ) ) {
wfDebug( __METHOD__ . ": unrecognised cache mode \"$mode\"\n" );
+
// Ignore for forwards-compatibility
return;
}
// Private wiki, only private headers
if ( $mode !== 'private' ) {
wfDebug( __METHOD__ . ": ignoring request for $mode cache mode, private wiki\n" );
+
return;
}
}
if ( $printer === null ) {
$this->dieUsage( "Unrecognized format: {$format}", 'unknown_format' );
}
+
return $printer;
}
$response->header( "HTTP/1.1 403 $message", true, 403 );
$response->header( 'Cache-Control: no-cache' );
echo "'origin' parameter does not match Origin header\n";
+
return false;
}
if ( self::matchOrigin( $originParam, $wgCrossSiteAJAXdomains, $wgCrossSiteAJAXdomainExceptions ) ) {
$response->header( 'Access-Control-Allow-Credentials: true' );
$this->getOutput()->addVaryHeader( 'Origin' );
}
+
return true;
}
return false;
}
}
+
return true;
}
}
+
return false;
}
array( '.*?', '.' ),
$wildcard
);
+
return "/https?:\/\/$wildcard/";
}
if ( $this->mCacheMode == 'private' ) {
$response->header( 'Cache-Control: private' );
+
return;
}
if ( $out->haveCacheVaryCookies() ) {
// Logged in, mark this request private
$response->header( 'Cache-Control: private' );
+
return;
}
// Logged out, send normal public headers below
// Logged in or otherwise has session (e.g. anonymous users who have edited)
// Mark request private
$response->header( 'Cache-Control: private' );
+
return;
} // else no XVO and anonymous, send public headers below
}
// Sending a Vary header in this case is harmless, and protects us
// against conditional calls of setCacheMaxAge().
$response->header( 'Cache-Control: private' );
+
return;
}
}
}
}
+
return $module;
}
} else {
$this->dieUsage( "Waiting for a database server: $lag seconds lagged", 'maxlag' );
}
+
return false;
}
}
+
return true;
}
protected function checkExecutePermissions( $module ) {
$user = $this->getUser();
if ( $module->isReadMode() && !User::isEveryoneAllowed( 'read' ) &&
- !$user->isAllowed( 'read' ) )
- {
+ !$user->isAllowed( 'read' )
+ ) {
$this->dieUsageMsg( 'readrequired' );
}
if ( $module->isWriteMode() ) {
/**
* Log the preceding request
- * @param $time Time in seconds
+ * @param int $time Time in seconds
*/
protected function logRequest( $time ) {
$request = $this->getRequest();
$table[rawurlencode( $chars[$i] )] = $chars[$i];
}
}
+
return strtr( rawurlencode( $s ), $table );
}
*/
public function getVal( $name, $default = null ) {
$this->mParamsUsed[$name] = true;
+
return $this->getRequest()->getVal( $name, $default );
}
*/
public function getCheck( $name ) {
$this->mParamsUsed[$name] = true;
+
return $this->getRequest()->getCheck( $name );
}
*/
public function getUpload( $name ) {
$this->mParamsUsed[$name] = true;
+
return $this->getRequest()->getUpload( $name );
}
if ( $wgAPICacheHelpTimeout > 0 ) {
$wgMemc->set( $key, $retval, $wgAPICacheHelpTimeout );
}
+
return $retval;
}
foreach ( self::$mRights as $right => $rightMsg ) {
$groups = User::getGroupsWithPermission( $right );
$msg .= "* " . $right . " *\n " . wfMsgReplaceArgs( $rightMsg['msg'], $rightMsg['params'] ) .
- "\nGranted to:\n " . str_replace( '*', 'all', implode( ', ', $groups ) ) . "\n\n";
+ "\nGranted to:\n " . str_replace( '*', 'all', implode( ', ', $groups ) ) . "\n\n";
}
$msg .= "\n$astriks Formats $astriks\n\n";
*/
public function getShowVersions() {
wfDeprecated( __METHOD__, '1.21' );
+
return false;
}
if ( is_array( $this->mExtraData ) ) {
$result = array_merge( $result, $this->mExtraData );
}
+
return $result;
}