@@ -79,24 +79,32 @@ function open_data_schema_map_file_cache_exits($api, $arguments = array()) {
79
79
/**
80
80
* File caches a specific odsm endpoint.
81
81
*/
82
- function open_data_schema_map_file_cache_endpoint ($ machine_name ) {
83
- $ api = open_data_schema_map_api_load ($ machine_name );
84
- if (isset ($ api )) {
85
- watchdog ('open_data_schema_map ' , 'api present and loaded ' , [], WATCHDOG_INFO );
86
- $ filename = open_data_schema_map_file_cache_name_helper ($ api );
87
- // This will only work for data.json v1.1 right now.
88
- watchdog ('open_data_schema_map ' , 'Beginning processing for endpoint (this could take a while) ' , [], WATCHDOG_INFO );
89
- $ render = open_data_schema_map_render_api ($ api );
90
- $ result = $ render ['result ' ];
91
-
92
- // Load the correct output format, render results, and write to a file.
93
- if ($ output_format = open_data_schema_map_output_format_load ($ api ->outputformat )) {
94
- $ response = $ output_format ['callback ' ]($ api , $ result );
95
- watchdog ('open_data_schema_map ' , "Saving $ filename " , [], WATCHDOG_INFO );
96
- file_save_data ($ response , $ filename , FILE_EXISTS_REPLACE );
97
- watchdog ('open_data_schema_map ' , "$ filename saved " , [], WATCHDOG_INFO );
82
+ function open_data_schema_map_file_cache_endpoint ($ machine_name = FALSE ) {
83
+ if ($ machine_name ) {
84
+ $ api = open_data_schema_map_api_load ($ machine_name );
85
+ if (isset ($ api )) {
86
+ watchdog ('open_data_schema_map ' , 'api present and loaded ' , [], WATCHDOG_INFO );
87
+ $ filename = open_data_schema_map_file_cache_name_helper ($ api );
88
+ // This will only work for data.json v1.1 right now.
89
+ watchdog ('open_data_schema_map ' , 'Beginning processing for endpoint (this could take a while) ' , [], WATCHDOG_INFO );
90
+ $ render = open_data_schema_map_render_api ($ api );
91
+ $ result = $ render ['result ' ];
92
+
93
+ // Load the correct output format, render results, and write to a file.
94
+ if ($ output_format = open_data_schema_map_output_format_load ($ api ->outputformat )) {
95
+ $ response = $ output_format ['callback ' ]($ api , $ result );
96
+ watchdog ('open_data_schema_map ' , "Saving $ filename " , [], WATCHDOG_INFO );
97
+ file_save_data ($ response , $ filename , FILE_EXISTS_REPLACE );
98
+ watchdog ('open_data_schema_map ' , "$ filename saved " , [], WATCHDOG_INFO );
99
+ }
100
+ }
101
+ else {
102
+ drush_print (dt ('@value is not a valid argument ' , array ('@value ' => $ machine_name )));
98
103
}
99
104
}
105
+ else {
106
+ drush_print (t ('odsm-filecache requires an argument. (e.g. data_json_1_1) ' ));
107
+ }
100
108
}
101
109
102
110
/**
0 commit comments