function _backup_migrate_test_file_readable_remotely in Backup and Migrate 5
Same name and namespace in other branches
- 5.2 includes/destinations.file.inc \_backup_migrate_test_file_readable_remotely()
 - 6 backup_migrate.module \_backup_migrate_test_file_readable_remotely()
 
Check if a file can be read remotely via http.
2 calls to _backup_migrate_test_file_readable_remotely()
- BackupMigrateUnitTest::testFileReadableRemotely in tests/
BackupMigrateUnitTest.test  - _backup_migrate_check_destination_dir in ./
backup_migrate.module  - Prepare the destination directory for the backups.
 
File
- ./
backup_migrate.module, line 1129  - Create (manually or scheduled) and restore backups of your Drupal MySQL database with an option to exclude table data (f.e. cache_*)
 
Code
function _backup_migrate_test_file_readable_remotely($path, $contents) {
  $url = $GLOBALS['base_url'] . '/' . file_directory_path() . '/' . str_replace('\\', '/', $path);
  $result = drupal_http_request($url);
  if (strpos($result->data, $contents) !== FALSE) {
    return TRUE;
  }
  return FALSE;
}