Ejemplo n.º 1
0
 /**
  * 将zipFile抽取到路径$to,如果$to不存在将自动创建
  * 
  * @param unknown_type $zipFile
  * @param unknown_type $to
  */
 public function extract($zipFile, $to)
 {
     Hi_Tool_Dir::check($to);
     $to = Hi_Tool_Dir::standard($to);
     $zip = new ZipArchive();
     $res = $zip->open($zipFile);
     if ($res !== true) {
         return false;
     }
     $zip->extractTo($to);
 }
Ejemplo n.º 2
0
 /**
  * 检查应用的部署路径是不是合法
  * 
  * @param string $path
  */
 private function _checkPath($path)
 {
     if (!is_dir($path) || !is_readable($path)) {
         throw new Hi_Exception('应用路径必须是一个可读的路径');
     }
     $path = Hi_Tool_Dir::standard($path);
     if (substr($path, -1) != DS) {
         $path .= DS;
     }
     if (!is_file($path . 'config.xml')) {
         throw new Hi_Exception('在应用的部署路径下没有找到配置文件 "config.xml"');
     }
     if (!is_dir($path . 'class') || !is_readable($path . 'class')) {
         throw new Hi_Exception('没有找到class路径');
     }
     $classPath = $path . 'class';
     $ad = $classPath . DS . 'Action';
     if (!is_dir($ad)) {
         throw new Hi_Exception('没有找到Action路径');
     }
 }
Ejemplo n.º 3
0
 public static function getUrlFile($url)
 {
     if (preg_match('/^http:\\/\\/.+?\\/([^\\?]+)/i', $url, $regs)) {
         $url = $regs[1];
     }
     $file = DOC_ROOT . $url;
     $file = Hi_Tool_Dir::standard($file);
     return $file;
 }