Skip to content

Instantly share code, notes, and snippets.

Revisions

  1. greggles renamed this gist Mar 5, 2016. 1 changed file with 0 additions and 0 deletions.
  2. greggles revised this gist Oct 19, 2015. 2 changed files with 15 additions and 12 deletions.
    12 changes: 0 additions & 12 deletions -
    Original file line number Diff line number Diff line change
    @@ -1,12 +0,0 @@
    <?php

    $fid = db_query("SELECT fid FROM {file_managed} WHERE filename = 'card-1.xls'")->fetchField();

    if ($fid) {
    $file = file_load($fid);
    var_dump(file_usage_list($file));

    }
    else {
    echo "no file found";
    }
    15 changes: 15 additions & 0 deletions find Drupal files by name and where they are used
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    <?php
    // Save this, edit it and then...
    // Run this with something like drush -v @sitename scr filename.php
    // If a file is found and known to be in use, the use will be listed as an array of data.

    // Edit the "card-1.xls" part.
    $fid = db_query("SELECT fid FROM {file_managed} WHERE filename = 'card-1.xls'")->fetchField();

    if ($fid) {
    $file = file_load($fid);
    var_dump(file_usage_list($file));
    }
    else {
    echo "file not found";
    }
  3. greggles created this gist Oct 19, 2015.
    12 changes: 12 additions & 0 deletions -
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    <?php

    $fid = db_query("SELECT fid FROM {file_managed} WHERE filename = 'card-1.xls'")->fetchField();

    if ($fid) {
    $file = file_load($fid);
    var_dump(file_usage_list($file));

    }
    else {
    echo "no file found";
    }