$sha1Hash = wfBaseConvert( $sha1Hash, 16, 36, 31 );
$contentType = $this->getContentType( $params['dst'], null, $params['src'] );
- $handle = fopen( $params['src'], 'rb+' );
+ $handle = fopen( $params['src'], 'rb' );
if ( $handle === false ) { // source doesn't exist?
$status->fatal( 'backend-fail-store', $params['src'], $params['dst'] );
$auth = $this->getAuthentication();
if ( !$auth ) {
$objHdrs['x-object-meta-sha1base36'] = false;
- return false; // failed
+ return $objHdrs; // failed
}
$status = Status::newGood();
'headers' => $this->authTokenHeaders( $auth ) + $objHdrs
) );
if ( $rcode >= 200 && $rcode <= 299 ) {
- return true; // success
+ return $objHdrs; // success
}
}
}
trigger_error( "Unable to set SHA-1 metadata for $path", E_USER_WARNING );
$objHdrs['x-object-meta-sha1base36'] = false;
- return false; // failed
+ return $objHdrs; // failed
}
protected function doGetFileContentsMulti( array $params ) {
}
// Run all requests for the first stage, then the next, and so on
- for ( $stage = 0; $stage < count( $httpReqsByStage ); ++$stage ) {
+ $reqCount = count( $httpReqsByStage );
+ for ( $stage = 0; $stage < $reqCount; ++$stage ) {
$httpReqs = $this->http->runMulti( $httpReqsByStage[$stage] );
foreach ( $httpReqs as $index => $httpReq ) {
// Run the callback for each request of this operation
* Log an unexpected exception for this backend.
* This also sets the Status object to have a fatal error.
*
- * @param Status $code null
+ * @param Status|null $status
* @param string $func
* @param array $params
* @param string $err Error string
- * @param integer $status HTTP status
+ * @param integer $code HTTP status
* @param string $desc HTTP status description
*/
public function onError( $status, $func, array $params, $err = '', $code = 0, $desc = '' ) {