Skip to content

Commit

Permalink
NBNP-448 Report actual page URL for ease
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobSanford committed Jun 26, 2024
1 parent dbdb985 commit de242a0
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ public static function reportPagesWithMissingFiles($print_info = FALSE)
'uri' => $page['uri'],
'path' => $page['path'],
'details' => 'File DNE',
'url' => $page['url'],
];
} elseif (filesize($page['path']) == 0) {
$items[] = [
Expand All @@ -329,6 +330,7 @@ public static function reportPagesWithMissingFiles($print_info = FALSE)
'uri' => $page['uri'],
'path' => $page['path'],
'details' => 'Zero length',
'url' => $page['url'],
];
}
}
Expand Down Expand Up @@ -379,13 +381,22 @@ public static function getPageFilesDetail($offset = 0, $limit = 50)
->getStorage('digital_serial_page')
->load($id);
$file = $page_entity->getPageImage();
$issue = $page_entity->getParentIssue();
$title = $issue->getParentTitle();
$url = sprintf(
'https://newspapers.lib.unb.ca/serials/%s/issues/%s/pages/%s',
$title->id(),
$issue->id(),
$page_entity->id()
);
$abs_file_path = DRUPAL_ROOT . str_replace('public://', '/sites/default/files/', $file->getFileUri());
unset($file);
$pages[] = [
'id' => $page_entity->id(),
'fid' => $page_entity->getPageImage()->target_id,
'uri' => $page_entity->getPageImage()->getFileUri(),
'path' => $abs_file_path
'path' => $abs_file_path,
'url' => $url,
];
unset($page_entity);
}
Expand Down

0 comments on commit de242a0

Please sign in to comment.