You are here

function _backup_migrate_check_timeout in Backup and Migrate 7.3

Same name and namespace in other branches
  1. 8.2 backup_migrate.module \_backup_migrate_check_timeout()
  2. 8.3 backup_migrate.module \_backup_migrate_check_timeout()
  3. 6.3 backup_migrate.module \_backup_migrate_check_timeout()
  4. 6.2 backup_migrate.module \_backup_migrate_check_timeout()
  5. 7.2 backup_migrate.module \_backup_migrate_check_timeout()

Determines if time for a page execution has run out.

7 calls to _backup_migrate_check_timeout()
backup_migrate_destination_db_mysql::_backup_db_to_file in includes/destinations.db.mysql.inc
Backup the databases to a file.
backup_migrate_destination_db_mysql::_restore_db_from_file in includes/destinations.db.mysql.inc
Backup the databases to a file.
backup_migrate_perform_backup in ./backup_migrate.module
Perform a backup with the given settings.
backup_migrate_perform_restore in ./backup_migrate.module
Restore from a file in the given destination.
backup_migrate_shutdown in ./backup_migrate.module
Shutdown callback.

... See full list

File

./backup_migrate.module, line 2008
Backup and restore databases for Drupal.

Code

function _backup_migrate_check_timeout() {
  static $timeout;

  // Max execution of 0 means unlimited.
  if (ini_get('max_execution_time') == 0) {
    return FALSE;
  }

  // Figure out when we should stop execution.
  if (!$timeout) {
    $backup_max_time = max(ini_get('max_execution_time'), variable_get('backup_migrate_backup_max_time', BACKUP_MIGRATE_BACKUP_MAX_TIME));
    $timeout = (!empty($_SERVER['REQUEST_TIME']) ? $_SERVER['REQUEST_TIME'] : time()) + $backup_max_time - variable_get('backup_migrate_timeout_buffer', 5);
  }
  return time() > $timeout;
}