Update index.php

pull/13/head
qkqpttgf 2020-01-02 10:05:48 +08:00 committed by GitHub
parent 1330eed999
commit f2bc368dc2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 9 deletions

View File

@ -149,7 +149,7 @@ function list_files($path)
if ( isset($files['folder']) || isset($files['file']) || isset($files['error']) ) {
return $files;
} else {
echo 'Error $files' . json_encode($files, JSON_PRETTY_PRINT);
error_log( $files . ' Network Error<br>' );
$_SERVER['retry']++;
if ($_SERVER['retry'] < 3) {
return list_files($path);
@ -468,7 +468,9 @@ function fetch_files($path = '/')
if (substr($url,-1)=='/') $url=substr($url,0,-1);
}
$url .= '?expand=children(select=name,size,file,folder,parentReference,lastModifiedDateTime)';
$files = json_decode(curl_request($url, false, ['Authorization' => 'Bearer ' . $_SERVER['access_token']])['body'], true);
$arr = curl_request($url, false, ['Authorization' => 'Bearer ' . $_SERVER['access_token']]);
if ($arr['stat']==200) {
$files = json_decode($arr['body'], true);
// echo $path . '<br><pre>' . json_encode($files, JSON_PRETTY_PRINT) . '</pre>';
if (isset($files['folder'])) {
if ($files['folder']['childCount']>200) {
@ -480,6 +482,9 @@ function fetch_files($path = '/')
$cache->save('path_' . $path, $files, 60);
}
}
} else {
$files = $arr['stat'];
}
}
return $files;
}