protected function FileImport::sourceExists in Migrate Files (extended) 8
Same name and namespace in other branches
- 2.0.x src/Plugin/migrate/process/FileImport.php \Drupal\migrate_file\Plugin\migrate\process\FileImport::sourceExists()
Check if a source exists.
1 call to FileImport::sourceExists()
- FileImport::transform in src/Plugin/ migrate/ process/ FileImport.php 
- Performs the associated process.
File
- src/Plugin/ migrate/ process/ FileImport.php, line 339 
Class
- FileImport
- Imports a file from an local or external source.
Namespace
Drupal\migrate_file\Plugin\migrate\processCode
protected function sourceExists($path) {
  if ($this
    ->isLocalUri($path)) {
    return is_file($path);
  }
  else {
    try {
      \Drupal::httpClient()
        ->head($path);
      return TRUE;
    } catch (ServerException $e) {
      return FALSE;
    } catch (ClientException $e) {
      return FALSE;
    } catch (ConnectException $e) {
      return FALSE;
    }
  }
}