UpYun::getFolderUsage PHP Method

getFolderUsage() public method

Deprecation:
public getFolderUsage ( string $path = '/' ) : mixed
$path string 目录路径
return mixed
    public function getFolderUsage($path = '/')
    {
        /*{{{*/
        $rsp = $this->_do_request('GET', '/?usage');
        return floatval($rsp);
    }

Usage Example

Example #1
0
 /**
  * 验证Upyun签名
  * 
  * @access public
  * 
  * @return boolean
  */
 public static function validate()
 {
     $host = Typecho_Request::getInstance()->upyunhost;
     $user = Typecho_Request::getInstance()->upyunuser;
     $pwd = Typecho_Request::getInstance()->upyunpwd;
     $hostUsage = 0;
     try {
         require_once 'SDK/upyun.class.php';
         $upyun = new UpYun($host, $user, $pwd);
         $hostUsage = (int) $upyun->getFolderUsage('/');
     } catch (Exception $e) {
         $hostUsage = -1;
     }
     return $hostUsage >= 0;
 }