Skip to content

Commit 8b68480

Browse files
authored
Merge pull request #119 from GetDKAN/3024-too-few-arguments
3024 too few arguments
2 parents c73e771 + 795a09c commit 8b68480

File tree

2 files changed

+25
-17
lines changed

2 files changed

+25
-17
lines changed

open_data_schema_map.file_cache.inc

+24-16
Original file line numberDiff line numberDiff line change
@@ -79,24 +79,32 @@ function open_data_schema_map_file_cache_exits($api, $arguments = array()) {
7979
/**
8080
* File caches a specific odsm endpoint.
8181
*/
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)));
98103
}
99104
}
105+
else {
106+
drush_print(t('odsm-filecache requires an argument. (e.g. data_json_1_1)'));
107+
}
100108
}
101109

102110
/**

open_data_schema_map.module

+1-1
Original file line numberDiff line numberDiff line change
@@ -1290,7 +1290,7 @@ function open_data_schema_map_render_api($api, $query = NULL, $queries = NULL) {
12901290
$current_page = $queries['page'];
12911291
}
12921292
$datasets_limit = variable_get('datasets_per_page', '');
1293-
if (!empty($datasets_limit && isset($queries['page']))) {
1293+
if (!empty($datasets_limit) && isset($queries['page'])) {
12941294
if ($total > $datasets_limit) {
12951295
$pages = floor($total / $datasets_limit);
12961296
if ($current_page > $pages) {

0 commit comments

Comments
 (0)