MarcusBarnes / mik

The Move to Islandora Kit is an extensible PHP command-line tool for converting source content and metadata into packages suitable for importing into Islandora (or other digital repository and preservations systems).
GNU General Public License v3.0
34 stars 11 forks source link

Put post-write hook settings in .ini file #125

Open mjordan opened 8 years ago

mjordan commented 8 years ago

Currently, config variables for post-write hook scripts are hard-coded in the scripts themselves. Since these scripts have access to the MIK config file, we should allow adding variables used by these scripts in the .ini file. Each script could get its own section in the .ini file. For example, the validate_mods.php script defines these variables internally:

$path_to_schema = 'extras/scripts/mods-3-5.xsd';
$mods_filename = 'MODS.xml';
$item_info_field_for_issues = 'date';

We should allow these variables to be defined in the .ini file, like:

[VALIDATE_MODS]
path_to_schema = 'extras/scripts/mods-3-5.xsd'
mods_filename = 'MODS.xml'
item_info_field_for_issues = date

The validate_mods.php script could then parse the ini file to get its settings:

$config = parse_ini_file($config_path, true); 
$path_to_schema = $config['VALIDATE_MODS']['path_to_schema'];

The benefit of this is that variables like paths to executables, which are OS-specific, don't need to be hard-coded in the script.

mjordan commented 8 years ago

Duh. Just noticed that the two functional post-write hook scripts already parse the .ini file:

$config = parse_ini_file($config_path, true);

but they do so to get the ['WRITER']['output_directory'], not their own settings.

mjordan commented 8 years ago

189 is related to this. For milestone 0.9 we'll hard-code the paths to the log files in the post-write hook scripts but for milestone 1.0 we should combine these two issues.