Skip to content

Instantly share code, notes, and snippets.

@scor
Last active July 31, 2017 20:21
Show Gist options
  • Save scor/de1058e2d80f81205c04 to your computer and use it in GitHub Desktop.
Save scor/de1058e2d80f81205c04 to your computer and use it in GitHub Desktop.
<?php
/**
* Lists bundles that have a field of type image or file for D7.29 regression
* https://www.drupal.org/node/2305017
*
* Download this script on your server/localhost and run
* drush php-script 2305017_file_lost.php
*/
$instances = field_info_instances();
// Not interested in nodes.
unset($instances['node']);
foreach ($instances as $entity_type => $type_bundles) {
foreach ($type_bundles as $bundle => $bundle_instances) {
foreach ($bundle_instances as $field_name => $instance) {
$field = field_info_field($field_name);
$field_type = $field['type'];
if ($field_type == 'image' || $field_type == 'file') {
echo "$entity_type : $bundle : $field_name : $field_type\n";
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment