function backup_migrate_item::all_items

cis7 crud.inc backup_migrate_item::all_items()
cle7 crud.inc backup_migrate_item::all_items()
elmsmedia7 crud.inc backup_migrate_item::all_items()
icor7 crud.inc backup_migrate_item::all_items()
meedjum_blog7 crud.inc backup_migrate_item::all_items()
mooc7 crud.inc backup_migrate_item::all_items()

Get all of the given items.

2 calls to backup_migrate_item::all_items()
backup_migrate_item::get_list in sites/all/modules/ulmus/backup_migrate/includes/crud.inc
Get a table of all items of this type.
backup_migrate_item::item in sites/all/modules/ulmus/backup_migrate/includes/crud.inc
A particular item.

File

sites/all/modules/ulmus/backup_migrate/includes/crud.inc, line 617
CRUD functions for backup and migrate types (schedules, profiles etc.).

Class

backup_migrate_item
A base class for items which can be stored in the database, listed, edited, deleted etc.

Code

function all_items() {
  static $cache = array();

  // Allow other modules to declare destinations programatically.
  $items = array();
  foreach (module_implements($this->db_table) as $module) {
    $fn = $module . '_' . $this->db_table;
    $items += $fn();
  }

  // Get any items stored as a variable. This allows destinations to be defined in settings.php
  $defaults = (array) variable_get($this->db_table . '_defaults', array());
  foreach ($defaults as $info) {
    if (is_array($info) && $item = $this->create($info)) {
      $items[$item->get_id()] = $item;
    }
  }

  // Get the items from the db.
  $result = db_query("SELECT * FROM {{$this->db_table}}", array(), array('fetch' => PDO::FETCH_ASSOC));
  foreach ($result as $info) {
    $info = $this->decode_db_row($info);
    if ($item = $this->create($info)) {
      $item->storage = empty($items[$item->get_id()]) ? BACKUP_MIGRATE_STORAGE_DB : BACKUP_MIGRATE_STORAGE_OVERRIDEN;
      $items[$item->get_id()] = $item;
    }
  }

  // Allow other modules to alter the items. This should maybe be before the db override code above
  // but then the filters are not able to set defaults for missing values. Other modules should just
  // be careful not to overwrite the user's UI changes in an unexpected way.
  drupal_alter($this->db_table, $items);

  return $items;
}