Skip to content

Commit

Permalink
Merge pull request #119 from GetDKAN/3024-too-few-arguments
Browse files Browse the repository at this point in the history
3024 too few arguments
  • Loading branch information
dharizza authored Feb 20, 2020
2 parents c73e771 + 795a09c commit 8b68480
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 17 deletions.
40 changes: 24 additions & 16 deletions open_data_schema_map.file_cache.inc
Original file line number Diff line number Diff line change
Expand Up @@ -79,24 +79,32 @@ function open_data_schema_map_file_cache_exits($api, $arguments = array()) {
/**
* File caches a specific odsm endpoint.
*/
function open_data_schema_map_file_cache_endpoint($machine_name) {
$api = open_data_schema_map_api_load($machine_name);
if (isset($api)) {
watchdog('open_data_schema_map', 'api present and loaded', [], WATCHDOG_INFO);
$filename = open_data_schema_map_file_cache_name_helper($api);
// This will only work for data.json v1.1 right now.
watchdog('open_data_schema_map', 'Beginning processing for endpoint (this could take a while)', [], WATCHDOG_INFO);
$render = open_data_schema_map_render_api($api);
$result = $render['result'];

// Load the correct output format, render results, and write to a file.
if ($output_format = open_data_schema_map_output_format_load($api->outputformat)) {
$response = $output_format['callback']($api, $result);
watchdog('open_data_schema_map', "Saving $filename", [], WATCHDOG_INFO);
file_save_data($response, $filename, FILE_EXISTS_REPLACE);
watchdog('open_data_schema_map', "$filename saved", [], WATCHDOG_INFO);
function open_data_schema_map_file_cache_endpoint($machine_name = FALSE) {
if ($machine_name) {
$api = open_data_schema_map_api_load($machine_name);
if (isset($api)) {
watchdog('open_data_schema_map', 'api present and loaded', [], WATCHDOG_INFO);
$filename = open_data_schema_map_file_cache_name_helper($api);
// This will only work for data.json v1.1 right now.
watchdog('open_data_schema_map', 'Beginning processing for endpoint (this could take a while)', [], WATCHDOG_INFO);
$render = open_data_schema_map_render_api($api);
$result = $render['result'];

// Load the correct output format, render results, and write to a file.
if ($output_format = open_data_schema_map_output_format_load($api->outputformat)) {
$response = $output_format['callback']($api, $result);
watchdog('open_data_schema_map', "Saving $filename", [], WATCHDOG_INFO);
file_save_data($response, $filename, FILE_EXISTS_REPLACE);
watchdog('open_data_schema_map', "$filename saved", [], WATCHDOG_INFO);
}
}
else {
drush_print(dt('@value is not a valid argument', array('@value' => $machine_name)));
}
}
else {
drush_print(t('odsm-filecache requires an argument. (e.g. data_json_1_1)'));
}
}

/**
Expand Down
2 changes: 1 addition & 1 deletion open_data_schema_map.module
Original file line number Diff line number Diff line change
Expand Up @@ -1290,7 +1290,7 @@ function open_data_schema_map_render_api($api, $query = NULL, $queries = NULL) {
$current_page = $queries['page'];
}
$datasets_limit = variable_get('datasets_per_page', '');
if (!empty($datasets_limit && isset($queries['page']))) {
if (!empty($datasets_limit) && isset($queries['page'])) {
if ($total > $datasets_limit) {
$pages = floor($total / $datasets_limit);
if ($current_page > $pages) {
Expand Down

0 comments on commit 8b68480

Please sign in to comment.