export&import config

This commit is contained in:
root
2021-03-01 04:38:15 -05:00
parent c234dd62d1
commit e9ed4dc7f1
12 changed files with 282 additions and 86 deletions
+8 -2
View File
@@ -767,6 +767,12 @@ class Onedrive {
}
protected function get_access_token($refresh_token) {
if (!$refresh_token) {
$tmp['stat'] = 0;
$tmp['body'] = 'No refresh_token';
$this->error = $tmp;
return false;
}
if (!($this->access_token = getcache('access_token', $this->disktag))) {
$p=0;
while ($response['stat']==0&&$p<3) {
@@ -784,8 +790,8 @@ class Onedrive {
//throw new Exception($response['stat'].', failed to get ['.$this->disktag.'] access_token.'.$response['body']);
}
$tmp = $ret;
$tmp['access_token'] = '******';
$tmp['refresh_token'] = '******';
$tmp['access_token'] = substr($tmp['access_token'], 0, 10) . '******';
$tmp['refresh_token'] = substr($tmp['refresh_token'], 0, 10) . '******';
error_log1('[' . $this->disktag . '] Get access token:' . json_encode($tmp, JSON_PRETTY_PRINT));
$this->access_token = $ret['access_token'];
savecache('access_token', $this->access_token, $this->disktag, $ret['expires_in'] - 300);