mirror of
https://github.com/standardebooks/web.git
synced 2025-07-12 17:42:29 -04:00
Fix permissions on OPDS feeds
This commit is contained in:
parent
6252cff1e5
commit
ffa3ab8a74
3 changed files with 20 additions and 11 deletions
|
@ -20,6 +20,7 @@ class OpdsFeed{
|
|||
}
|
||||
|
||||
private function Sha1Entries(string $xmlString): string{
|
||||
try{
|
||||
$xml = new SimpleXMLElement(str_replace('xmlns=', 'ns=', $xmlString));
|
||||
$xml->registerXPathNamespace('dc', 'http://purl.org/dc/elements/1.1/');
|
||||
$xml->registerXPathNamespace('schema', 'http://schema.org/');
|
||||
|
@ -32,6 +33,11 @@ class OpdsFeed{
|
|||
|
||||
return sha1(preg_replace('/\s/ius', '', $output));
|
||||
}
|
||||
catch(Exception $ex){
|
||||
// Invalid XML
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
public function Save(string $filename): void{
|
||||
$updatedTimestamp = gmdate('Y-m-d\TH:i:s\Z');
|
||||
|
|
|
@ -227,7 +227,10 @@ if [ "${verbose}" = "true" ]; then
|
|||
printf "Rebuilding OPDS catalog ... "
|
||||
fi
|
||||
|
||||
bash -c "php \"${scriptsDir}\"/generate-opds.php --webroot \"${webRoot}\" --weburl \"${webUrl}\""
|
||||
php "${scriptsDir}/generate-opds.php" --webroot "${webRoot}" --weburl "${webUrl}"
|
||||
|
||||
sudo chown se:committers /standardebooks.org/web/www/opds/*.xml
|
||||
sudo chmod 664 /standardebooks.org/web/www/opds/*.xml
|
||||
|
||||
if [ "${verbose}" = "true" ]; then
|
||||
printf "Done.\n"
|
||||
|
|
|
@ -14,7 +14,7 @@ if(!isset($isCrawlable)){
|
|||
|
||||
print("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
|
||||
?>
|
||||
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:schema="http://schema.org/" xmlns:fh="http://purl.org/syndication/history/1.0">
|
||||
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:schema="http://schema.org/"<? if($isCrawlable){ ?> xmlns:fh="http://purl.org/syndication/history/1.0"<? } ?>>
|
||||
<id><?= $id ?></id>
|
||||
<link href="<?= $url ?>" rel="self" type="application/atom+xml;profile=opds-catalog;kind=acquisition"/>
|
||||
<link href="<?= SITE_URL ?>/opds" rel="start" type="application/atom+xml;profile=opds-catalog;kind=navigation"/>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue