示例#1
0
文件: FS.php 项目: techart/tao
 public function delete($var)
 {
     if (is_string($var)) {
         $var = $this->load($var);
     }
     $path = $this->path($var->name());
     if ($var->is_dir()) {
         CMS::rmdir($path);
     } else {
         IO_FS::rm($path);
     }
 }
示例#2
0
文件: Stockroom.php 项目: techart/tao
 protected function action_install()
 {
     $item = $this->load_item($this->id);
     if (!$item) {
         return $this->page_not_found();
     }
     $error = false;
     foreach ($item->not_install_if_exists as $entry) {
         $entry = $this->validate_path($entry);
         if ($entry) {
             if (IO_FS::exists($entry)) {
                 $error = "<b>Файл (каталог) {$entry}</b> уже существует. Установка невозможна!";
             }
         }
     }
     if ($item['download'] == '-') {
         $error = 'Невозможно получить инсталляционный пакет!';
     }
     if ($this->env->request->method == 'post') {
         $files = $this->get_install_pack($item);
         if (is_string($files)) {
             $error = $files;
         } else {
             foreach ($files as $file => $data) {
                 $from = $data['path'];
                 $to = "../{$file}";
                 if ($m = Core_Regexps::match_with_results('{^(.+)/[^/]+$}', $to)) {
                     $dir = $m[1];
                     if (!IO_FS::exists($dir)) {
                         @CMS::mkdirs($dir);
                         if (!IO_FS::exists($dir)) {
                             $error = "Невозможно создать каталог {$dir}";
                             break;
                         }
                     }
                     copy($from, $to);
                     CMS::chmod_file($to);
                     $item->set_installed_hash($file, $data['hash']);
                 }
             }
             $item->save_info_file();
             CMS::rmdir($item->install_temp_dir());
             return $this->redirect_to($this->action_url('instok', $item));
         }
     }
     Events::call('cms.stockroom.after_install', $item, $error);
     return $this->render('install', array('item' => $item, 'error' => $error, 'list_url' => $this->action_url('list', $this->page), 'list_button_caption' => $this->button_list()));
 }
示例#3
0
文件: Vars1.php 项目: techart/tao
 public function del($id)
 {
     $rows = DB_SQL::db()->vars->select_childs($id);
     foreach ($rows as $row) {
         $row->del($row->id);
     }
     DB_SQL::db()->vars->delete($id);
     CMS::rmdir(CMS_Vars1::$files_dir . "/{$id}");
 }
示例#4
0
文件: CMS.php 项目: techart/tao
 static function check_assets_symlink($path)
 {
     if (is_link($path)) {
         return;
     }
     if (!function_exists('symlink')) {
         throw new CMS_Exception("Error creating symlink {$path} (function not exists)");
     }
     if (is_dir($path)) {
         CMS::rmdir($path);
     }
     $dir = IO_FS::File($path)->dir_name;
     CMS::mkdirs($dir);
     symlink(self::$stdfiles_path, $path);
 }
示例#5
0
文件: ORM.php 项目: techart/tao
 public function before_delete()
 {
     $this->multilink_delete_all();
     if ($dir = $this->homedir()) {
         CMS::rmdir($dir);
     }
     if ($dir = $this->homedir(true)) {
         CMS::rmdir($dir);
     }
     return true && parent::before_delete();
 }