Example #1
0
 /**
  *	Удаление файла или папки
  *
  *	@return	mixed
  */
 public function delete($not_use_var = null)
 {
     try {
         $response = $this->request->delete($this->parent_disk->getRequestUrl('trash/resources'), array('path' => $this->getPath()));
         if (!empty($response['operation'])) {
             return $response['operation'];
         }
         $this->setContents(array());
         return $this->request->http_status_code == 204;
     } catch (\Exception $exc) {
         return false;
     }
 }
Example #2
0
 /**
  *	Удаление файла или папки
  *
  *	@param	boolean	$permanently	TRUE Признак безвозвратного удаления
  *	@return	mixed
  */
 public function delete($permanently = false)
 {
     $result = $this->request->delete($this->parent_disk->getRequestUrl('resources'), array('path' => $this->resource_path, 'permanently' => (bool) $permanently));
     if (!empty($result['operation'])) {
         return $result['operation'];
     }
     $this->setContents(array());
     $status = $this->request->http_status_code;
     try {
         $trash = $this->parent_disk->trash(null, 1)->sorting('deleted', true)->get(0, false);
         if ($trash && $trash->get('origin_path') == $this->getPath()) {
             $this->resource_path_trash = $trash->get('path');
             return $trash;
         }
     } catch (\Exception $exc) {
     }
     return $status == 204;
 }