You are here

function backup_migrate_filters_invoke_all in Backup and Migrate 8.2

Same name and namespace in other branches
  1. 8.3 includes/filters.inc \backup_migrate_filters_invoke_all()
  2. 6.3 includes/filters.inc \backup_migrate_filters_invoke_all()
  3. 6.2 includes/filters.inc \backup_migrate_filters_invoke_all()
  4. 7.3 includes/filters.inc \backup_migrate_filters_invoke_all()
  5. 7.2 includes/filters.inc \backup_migrate_filters_invoke_all()

Invoke the given method on all of the available filters.

12 calls to backup_migrate_filters_invoke_all()
backup_migrate_backup_fail in ./backup_migrate.module
Clean up when a backup operation fails.
backup_migrate_backup_migrate_destinations in includes/destinations.inc
Implementation of hook_backup_migrate_destinations().
backup_migrate_backup_succeed in ./backup_migrate.module
Clean up when a backup operation suceeds.
backup_migrate_db_backup in includes/db.inc
Build the database dump file. Takes a list of tables to exclude and some formatting options.
backup_migrate_db_restore in includes/db.inc
Restore from a previously backed up files. File must be a decompressed SQL file.

... See full list

File

includes/filters.inc, line 67
All of the filter handling code needed for Backup and Migrate.

Code

function backup_migrate_filters_invoke_all() {
  $args = func_get_args();
  $op = array_shift($args);
  $out = array();
  $filters = backup_migrate_get_filters($op);
  foreach ($filters as $filter) {
    if (method_exists($filter, $op)) {

      /* call_user_func_array() ignores the function signature, so we cannot
       * use it to pass references. (Call-time pass-by-reference is deprecated
       * in PHP5.3.) Work around it, since we have unknown function signatures.
       */
      switch (count($args)) {
        case 1:
          $ret = $filter
            ->{$op}($args[0]);
          break;
        case 2:
          $ret = $filter
            ->{$op}($args[0], $args[1]);
          break;
        default:

          // This assumes that no functions with more than 2 arguments expect a
          // reference as argument. If so, add another 'case block'.
          $ret = call_user_func_array(array(
            $filter,
            $op,
          ), $args);
      }
      $out = array_merge_recursive($out, (array) $ret);
    }
  }
  return $out;
}