Skip to content

Commit

Permalink
Work on #14.
Browse files Browse the repository at this point in the history
  • Loading branch information
mjordan committed Dec 29, 2018
1 parent cc2d0f6 commit 5bdd669
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ parameters:
app.plugins.fetchresourcelist.from.drupal.gemini_endpoint: 'http://localhost:8000/gemini'
# Will need to be replaced pending outcome of https://github.com/mjordan/riprap/issues/21.
app.plugins.fetchresourcelist.from.drupal.gemini_auth_header: 'Bearer islandora'
# For now, we store paging data in a local file instead of a db table.
app.plugins.fetchresourcelist.from.drupal.page_size: 5
# Drupal's JSON:API allows a maximum page size of 50.
app.plugins.fetchresourcelist.from.drupal.page_size: 5
app.plugins.fetchresourcelist.from.drupal.pager_data: '%kernel.project_dir%/var/fetchresourcelist.from.drupal.pager.txt'

# To not register any fetchdigest plugins, use app.plugins.fetchdigest [].
Expand Down
26 changes: 13 additions & 13 deletions src/Command/PluginFetchResourceListFromDrupal.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,20 +220,20 @@ private function setPageOffset($page_offset, $links)
// We are on the last page, so reset the offset value to start the
// verification cycle from the beginning.
else {
$first_url = $links['first'];
$query_string = parse_url(urldecode($first_url), PHP_URL_QUERY);
parse_str($query_string, $query_array);
$first_offset = $query_array['page']['offset'];
file_put_contents($this->page_data_file, trim($first_offset));

if (array_key_exists('first', $links)) {
$first_url = $links['first'];
$query_string = parse_url(urldecode($first_url), PHP_URL_QUERY);
parse_str($query_string, $query_array);
$first_offset = $query_array['page']['offset'];
file_put_contents($this->page_data_file, trim($first_offset));

// file_put_contents($this->page_data_file, '0');
if ($this->logger) {
$this->logger->info("PluginFetchResourceListFromDrupal has reset its page offset to 0",
array(
'Last page offset value' => $page_offset
)
);
if ($this->logger) {
$this->logger->info("PluginFetchResourceListFromDrupal has reset Drupal's JSON:API page offset to the first page.",
array(
'Pager self URL' => $links['self']
)
);
}
}
}
}
Expand Down

0 comments on commit 5bdd669

Please sign in to comment.