62 lines
1.6 KiB
PHP
Raw Permalink Normal View History

2023-05-10 13:39:12 +08:00
<?php
// @codingStandardsIgnoreFile
require_once __DIR__ . '/../autoload.php';
use Qiniu\Auth;
$accessKey = getenv('QINIU_ACCESS_KEY');
$secretKey = getenv('QINIU_SECRET_KEY');
$testAuth = new Auth($accessKey, $secretKey);
2023-11-02 14:13:04 +08:00
$bucketName = getenv('QINIU_TEST_BUCKET');
2023-05-10 13:39:12 +08:00
$key = 'php-logo.png';
$key2 = 'niu.jpg';
2023-11-02 14:13:04 +08:00
$testStartDate = '2020-08-18';
$testEndDate = '2020-08-19';
$testGranularity = 'day';
$testLogDate = date('Y-m-d',strtotime("-1 days"));
2023-05-10 13:39:12 +08:00
$bucketNameBC = 'phpsdk-bc';
$bucketNameNA = 'phpsdk-na';
2023-11-02 14:13:04 +08:00
$bucketNameFS = 'phpsdk-fs';
$bucketNameAS = 'phpsdk-as';
2023-05-10 13:39:12 +08:00
$dummyAccessKey = 'abcdefghklmnopq';
$dummySecretKey = '1234567890';
$dummyAuth = new Auth($dummyAccessKey, $dummySecretKey);
//cdn
$timestampAntiLeechEncryptKey = getenv('QINIU_TIMESTAMP_ENCRPTKEY');
$customDomain = "http://sdk.peterpy.cn";
2023-11-02 14:13:04 +08:00
$customDomain2 = "sdk.peterpy.cn";
$customCallbackURL = "https://qiniu.timhbw.com/notify/callback";
2023-05-10 13:39:12 +08:00
$tid = getenv('TRAVIS_JOB_NUMBER');
if (!empty($tid)) {
$pid = getmypid();
$tid = strstr($tid, '.');
$tid .= '.' . $pid;
}
2023-11-02 14:13:04 +08:00
function qiniuTempFile($size, $randomized = true)
2023-05-10 13:39:12 +08:00
{
$fileName = tempnam(sys_get_temp_dir(), 'qiniu_');
$file = fopen($fileName, 'wb');
2023-11-02 14:13:04 +08:00
if ($randomized) {
$rest_size = $size;
while ($rest_size > 0) {
$length = min($rest_size, 4 * 1024);
if (fwrite($file, random_bytes($length)) == false) {
return false;
}
$rest_size -= $length;
}
} else if ($size > 0) {
2023-05-10 13:39:12 +08:00
fseek($file, $size - 1);
fwrite($file, ' ');
}
fclose($file);
return $fileName;
}