You are here

function FancyFileDeleteOrphanFileFilter::query in Fancy File Delete 7

Add this filter to the query.

Due to the nature of fapi, the value and the operator have an unintended level of indirection. You will find them in $this->operator and $this->value respectively.

Overrides views_handler_filter::query

File

views/inc/FancyFileDeleteOrphanFileFilter.inc, line 22
Fancy File Delete Orphan Files Views Settings.

Class

FancyFileDeleteOrphanFileFilter
@file Fancy File Delete Orphan Files Views Settings.

Code

function query() {
  $this
    ->ensure_my_table();

  // Check if file is used by any other module/entity.
  $join = new views_join();
  $join
    ->construct('file_usage', 'file_managed', 'fid', 'fid');
  $this->query
    ->add_relationship('fu', $join, 'node');
  $this->query
    ->add_where(0, 'fu.fid', NULL, 'IS NULL');
}