original_string: public function delete($condition, $check = true)
      {
          $result = null;
          $this->hook->attach('file.delete.before', $condition, $check, $result, $this);
  
          if (isset($result)) {
              return (bool) $result;
          }
  
          if (!is_array($condition)) {
              $condition = array('file_id' => $condition);
          }
  
          if ($check && isset($condition['file_id']) && !$this->canDelete($condition['file_id'])) {
              return false;
          }
  
          $result = (bool) $this->db->delete('file', $condition);
  
          if ($result && isset($condition['file_id'])) {
              $this->deleteLinked($condition['file_id']);
          }
  
          $this->hook->attach('file.delete.after', $condition, $check, $result, $this);
          return (bool) $result;
      }
code: public function delete($condition, $check = true)
      {
          $result = null;
          $this->hook->attach('file.delete.before', $condition, $check, $result, $this);
  
          if (isset($result)) {
              return (bool) $result;
          }
  
          if (!is_array($condition)) {
              $condition = array('file_id' => $condition);
          }
  
          if ($check && isset($condition['file_id']) && !$this->canDelete($condition['file_id'])) {
              return false;
          }
  
          $result = (bool) $this->db->delete('file', $condition);
  
          if ($result && isset($condition['file_id'])) {
              $this->deleteLinked($condition['file_id']);
          }
  
          $this->hook->attach('file.delete.after', $condition, $check, $result, $this);
          return (bool) $result;
      }
code_tokens: public function delete ( $ condition , $ check = true ) { $ result = null ; $ this -> hook -> attach ( 'file.delete.before' , $ condition , $ check , $ result , $ this ) ; if ( isset ( $ result ) ) { return ( bool ) $ result ; } if ( ! is_array ( $ condition ) ) { $ condition = array ( 'file_id' => $ condition ) ; } if ( $ check && isset ( $ condition [ 'file_id' ] ) && ! $ this -> canDelete ( $ condition [ 'file_id' ] ) ) { return false ; } $ result = ( bool ) $ this -> db -> delete ( 'file' , $ condition ) ; if ( $ result && isset ( $ condition [ 'file_id' ] ) ) { $ this -> deleteLinked ( $ condition [ 'file_id' ] ) ; } $ this -> hook -> attach ( 'file.delete.after' , $ condition , $ check , $ result , $ this ) ; return ( bool ) $ result ; }
docstring: Deletes a file from the database
  @param int|array $condition
  @param bool $check
  @return boolean
docstring_tokens: Deletes a file from the database