public $repo;
// array of initialized repo objects
- protected $files = array();
+ protected $files = [];
// cache of the file metadata that's stored in the database
- protected $fileMetadata = array();
+ protected $fileMetadata = [];
// fileprops cache
- protected $fileProps = array();
+ protected $fileProps = [];
// current user
protected $user, $userId, $isLoggedIn;
$error = $storeStatus->getWarningsArray();
$error = reset( $error );
if ( !count( $error ) ) {
- $error = array( 'unknown', 'no error recorded' );
+ $error = [ 'unknown', 'no error recorded' ];
}
}
// At this point, $error should contain the single "most important"
$serializedFileProps = serialize( $fileProps );
}
- $this->fileMetadata[$key] = array(
+ $this->fileMetadata[$key] = [
'us_id' => $dbw->nextSequenceValue( 'uploadstash_us_id_seq' ),
'us_user' => $this->userId,
'us_key' => $key,
'us_source_type' => $sourceType,
'us_timestamp' => $dbw->timestamp(),
'us_status' => 'finished'
- );
+ ];
$dbw->insert(
'uploadstash',
$dbw = $this->repo->getMasterDb();
$dbw->delete(
'uploadstash',
- array( 'us_user' => $this->userId ),
+ [ 'us_user' => $this->userId ],
__METHOD__
);
# destroy objects.
- $this->files = array();
- $this->fileMetadata = array();
+ $this->files = [];
+ $this->fileMetadata = [];
return true;
}
$row = $dbw->selectRow(
'uploadstash',
'us_user',
- array( 'us_key' => $key ),
+ [ 'us_key' => $key ],
__METHOD__
);
$dbw->delete(
'uploadstash',
- array( 'us_key' => $key ),
+ [ 'us_key' => $key ],
__METHOD__
);
$res = $dbr->select(
'uploadstash',
'us_key',
- array( 'us_user' => $this->userId ),
+ [ 'us_user' => $this->userId ],
__METHOD__
);
}
// finish the read before starting writes.
- $keys = array();
+ $keys = [];
foreach ( $res as $row ) {
array_push( $keys, $row->us_key );
}
$row = $dbr->selectRow(
'uploadstash',
'*',
- array( 'us_key' => $key ),
+ [ 'us_key' => $key ],
__METHOD__
);