Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Follow-up to #2623012: Implement interfaces and base classes for URL-based sources
The only fetcher currently implemented is for HTTP - we need one for processing local files.
I needed a File Data Fetcher as my XML files are local.
Comment | File | Size | Author |
---|---|---|---|
#6 | interdiff.txt | 1.62 KB | mikeryan |
#6 | implement_file_based-2781883-6.patch | 1.46 KB | mikeryan |
#2 | filed_data_fetcher-2781883-2.patch | 1.77 KB | pguillard |
Comments
Comment #2
pguillard CreditAttribution: pguillard commentedComment #3
kriboogh CreditAttribution: kriboogh at Calibrate commentedThanks for making this into a patch (https://www.drupal.org/node/2779083)...
Comment #4
rodrigoaguileraComment #5
mikeryanAs I contemplate #2802447: Fetcher plugin for sftp, given there are stream wrappers for sftp and related protocols, I look here and see file_get_contents, which of course can read from any stream wrapper. I think with just a little tweaking, this plugin can work generally with simple stream wrappers, and then we only need to use specialized fetchers like http when we need to pass options beyond a simple URL. And assuming this does work for local files/HTTP/etc., it should be worth making this the default fetcher for the url source plugin, so it won't need to be specified.
Since I need this for my current project, I'll pick it up from here today/tomorrow.
Comment #6
mikeryanHere we go - I've tested this version of the fetcher plugin with a local absolute path, a path relative to the Drupal root, an http URL, and (my main motivation) a ssh2.sftp URL. Seems to work fine...
Comment #7
mikeryanComment #9
mikeryanCommitted with a bit more tweaking, thanks!
Comment #10
mchelen#6 works for me, thanks!
Comment #11
heddnAt this point, maybe it doesn't matter, but why are we requiring no-op methods like these in the data fetcher interface? Maybe that's for a follow-up.
Nit: the doxygen doesn't mention that it can throw an exception. Is that something we want to include in its docs?
Comment #12
mikeryanYep, going to follow-up by finally dealing with #2640512: Make custom headers an HTTP-specific feature.
Good point for a quickfix.
Everything needs tests:P.
Comment #14
mikeryanComment #15
kriboogh CreditAttribution: kriboogh at Calibrate commented