No errors if install_node_export_import_from_file() fails
DamienMcKenna - March 15, 2009 - 16:53
| Project: | Install Profile API |
| Version: | 6.x-2.0 |
| Component: | CRUD functions and includes |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs work |
Description
There are no messages displayed if install_node_export_import_from_file() fails, e.g. because the file either did not exist or could not be loaded.

#1
The attached file adds a dsm() to indicate the file could not be found or opened.
#2
Seems sensible to me. Committed.
#3
where does the value of $file come from? %file or @file would be safer than !file.
#4
dww: $file is one of the arguments.
#5
That I understand. My point is where is $file coming from when this function is called? I know we're talking about an install profile, and therefore, user-supplied data isn't really a concern, but in general, it's better to be in the habit of writing secure code by default. Maybe this function is going to be reused in some context we don't anticipate. Better safe than sorry.
#6
dww: the command would be executed like this:
<?php// load the about_us page
install_node_export_import_from_file('about_us.inc', array('status'=>1), $user, FALSE);
?>
So the $file would be manually loaded by the admin.
#7
Sorry, I keep phrasing my comments in the form of a question. I don't have a question at all. ;) I'm making a statement. Let me be more clear:
API functions shouldn't assume they know exactly how they're going to be called at all times in the future, so they should be written to be as safe as possible for any possible use-case. API functions that generate HTML sent to a browser should always sanitize potentially user-specified data using core's existing text filtering functions.
#8
dww, I follow and agree.
I propose we consider a standard format for exported content that works with the install_profile_api project. Maybe the format is just a wrapper around the original export (eg: from views, content_copy, etc..). A standard format would have the following advantages, and disadvantages:
Advantages
install_get_exports($type, $path)could be createdDisadvantages
Thoughts?
#9
I noticed this commit while doing the latest release notes... so I was under the impression this bug was fixed... could you try again with the latest release?
#10
Nevermind me, i got confused by the date. I'll remove this bug from the relnotes, there clearly seems to be issues remaining to discuss.