Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorDaniel Kesselberg <mail@danielkesselberg.de>2022-05-16 23:17:57 +0300
committerDaniel Kesselberg <mail@danielkesselberg.de>2022-05-17 18:25:10 +0300
commit6281c2da51231e510ffbb0c71c893f7ea607e37d (patch)
tree9b95661bb0415a4b5c6a1255cb17452663988a2d /apps
parent07c9bf1adff8a2d10ff774da32c2ddd54fd01923 (diff)
Make chunkperf.php work again
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
Diffstat (limited to 'apps')
-rw-r--r--apps/dav/bin/chunkperf.php24
1 files changed, 15 insertions, 9 deletions
diff --git a/apps/dav/bin/chunkperf.php b/apps/dav/bin/chunkperf.php
index a8652654bca..2ba63b13217 100644
--- a/apps/dav/bin/chunkperf.php
+++ b/apps/dav/bin/chunkperf.php
@@ -20,25 +20,31 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
-require '../../../../3rdparty/autoload.php';
+
+use Sabre\DAV\Client;
+
+require __DIR__ . '/../../../3rdparty/autoload.php';
if ($argc !== 6) {
- echo "Invalid number of arguments" . PHP_EOL;
+ echo "Usage: " . basename(__FILE__) . " {baseUri} {userName} {password} {fileToUpload} {chunkSize}" . PHP_EOL;
exit;
}
/**
- * @param \Sabre\DAV\Client $client
- * @param $uploadUrl
- * @return mixed
+ * @param Client $client
+ * @param string $method
+ * @param string $uploadUrl
+ * @param string|resource|null $data
+ * @param array $headers
+ * @return array
*/
-function request($client, $method, $uploadUrl, $data = null, $headers = []) {
+function request($client, $method, $uploadUrl, $data = null, $headers = []): array {
echo "$method $uploadUrl ... ";
$t0 = microtime(true);
$result = $client->request($method, $uploadUrl, $data, $headers);
$t1 = microtime(true);
echo $result['statusCode'] . " - " . ($t1 - $t0) . ' seconds' . PHP_EOL;
- if (!in_array($result['statusCode'], [200, 201])) {
+ if (!in_array($result['statusCode'], [200, 201])) {
echo $result['body'] . PHP_EOL;
}
return $result;
@@ -48,9 +54,9 @@ $baseUri = $argv[1];
$userName = $argv[2];
$password = $argv[3];
$file = $argv[4];
-$chunkSize = $argv[5] * 1024 * 1024;
+$chunkSize = ((int)$argv[5]) * 1024 * 1024;
-$client = new \Sabre\DAV\Client([
+$client = new Client([
'baseUri' => $baseUri,
'userName' => $userName,
'password' => $password