I was planning to use drush views-data-export
to write some data to a specific path on my host. To problem is that the output path for the generated file is always relative to the path where drush views-data-export
is called.
Example: drush views-data-export myviewname views_data_export_1 output.csv
If I am currently working in the folder sites/all/themes
then the output file will be generated at sites/all/themes/output.csv
.
I have tried to add an absolute path to the drush command, but this:
drush views-data-export myviewname views_data_export_1 /var/www/vhost/test/drupal/sites/default/files/output.csv
will produce an error
file_put_contents(/var/www/vhost/test/drupal/sites/all/themes//var/www/vhost/test/drupal/sites/all/themes/output.csv):[warning]
failed to open stream: No such file or directory views_data_export.drush.inc:183
The file could not be copied to the selected destination [error]
I guess this is a bug.
Possible solution: views_data_export.drush should check if the argument for the file name starts with a slash. If that is the case then the current path should not be prepended in file_put_contents(). That way you can use both relative and absolute paths as output arguments.
Comment | File | Size | Author |
---|---|---|---|
#2 | can_not_use_absolute-2284975-2.patch | 1014 bytes | Steven Jones |
Comments
Comment #1
BillyTom CreditAttribution: BillyTom commentedComment #2
Steven Jones CreditAttribution: Steven Jones commentedHow about this.
Comment #4
Steven Jones CreditAttribution: Steven Jones commentedCommitted
Comment #6
BillyTom CreditAttribution: BillyTom commentedThank you very much.