Created
August 24, 2017 14:15
-
-
Save McFateM/9f81334d8d13b74ed2c20a1961ff910a to your computer and use it in GitHub Desktop.
Custom logic for islandora_multi_importer_remote_file_get in lines 4-16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// If the file is not from a .zip... | |
function islandora_multi_importer_remote_file_get($url) { | |
$parsed_url = parse_url($url); | |
/* MAM 2-August-2017 New logic, assumes the file is somewhere in the public://imi_files path */ | |
$basename = drupal_basename($parsed_url['path']); | |
$pattern = "/$basename/"; | |
$options['key'] = 'filename'; | |
$file = file_scan_directory( "public://", $pattern, $options ); | |
$url = $file[$basename]->uri; | |
return drupal_realpath($url); | |
/* MAM 2-August-2017 Replacing below logic with code above. | |
$remote_schemes = array('http', 'https', 'ftp', 'ftps', 'smb', 'nfs'); | |
if (!in_array($parsed_url['scheme'], $remote_schemes)) { | |
// if local file, return the path. | |
return drupal_realpath($url); | |
} | |
// Check if the temp directory exists if there is no other file named equally | |
// Create if needed. | |
//$tmp_directory = islandora_multi_importer_temp_directory(); | |
$local = "public://" . drupal_basename($parsed_url['path']); | |
if (!file_exists($local)) { | |
return system_retrieve_file($url, $local, FALSE, FILE_EXISTS_REPLACE); | |
} | |
else { | |
return $local; | |
} */ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment