Update index.php
							parent
							
								
									1330eed999
								
							
						
					
					
						commit
						f2bc368dc2
					
				| 
						 | 
					@ -149,7 +149,7 @@ function list_files($path)
 | 
				
			||||||
    if ( isset($files['folder']) || isset($files['file']) || isset($files['error']) ) {
 | 
					    if ( isset($files['folder']) || isset($files['file']) || isset($files['error']) ) {
 | 
				
			||||||
        return $files;
 | 
					        return $files;
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        echo 'Error $files' . json_encode($files, JSON_PRETTY_PRINT);
 | 
					        error_log( $files . ' Network Error<br>' );
 | 
				
			||||||
        $_SERVER['retry']++;
 | 
					        $_SERVER['retry']++;
 | 
				
			||||||
        if ($_SERVER['retry'] < 3) {
 | 
					        if ($_SERVER['retry'] < 3) {
 | 
				
			||||||
            return list_files($path);
 | 
					            return list_files($path);
 | 
				
			||||||
| 
						 | 
					@ -468,7 +468,9 @@ function fetch_files($path = '/')
 | 
				
			||||||
            if (substr($url,-1)=='/') $url=substr($url,0,-1);
 | 
					            if (substr($url,-1)=='/') $url=substr($url,0,-1);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        $url .= '?expand=children(select=name,size,file,folder,parentReference,lastModifiedDateTime)';
 | 
					        $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>';
 | 
					            // echo $path . '<br><pre>' . json_encode($files, JSON_PRETTY_PRINT) . '</pre>';
 | 
				
			||||||
            if (isset($files['folder'])) {
 | 
					            if (isset($files['folder'])) {
 | 
				
			||||||
                if ($files['folder']['childCount']>200) {
 | 
					                if ($files['folder']['childCount']>200) {
 | 
				
			||||||
| 
						 | 
					@ -480,6 +482,9 @@ function fetch_files($path = '/')
 | 
				
			||||||
                    $cache->save('path_' . $path, $files, 60);
 | 
					                    $cache->save('path_' . $path, $files, 60);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            $files = $arr['stat'];
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    return $files;
 | 
					    return $files;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue