function backup_migrate_item::all_items in Backup and Migrate 6.2
Same name and namespace in other branches
- 8.2 includes/crud.inc \backup_migrate_item::all_items()
- 8.3 includes/crud.inc \backup_migrate_item::all_items()
- 6.3 includes/crud.inc \backup_migrate_item::all_items()
- 7.3 includes/crud.inc \backup_migrate_item::all_items()
- 7.2 includes/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 includes/
crud.inc - Get a table of all items of this type.
- backup_migrate_item::item in includes/
crud.inc - A particular item.
File
- includes/
crud.inc, line 636 - 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}}");
while ($info = db_fetch_array($result)) {
$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;
}