No bug cannot find any pdf file

More
1 month 1 week ago #2800 by Derek Sharp
cannot find any pdf file was created by Derek Sharp
My host provider identied a resource usage spike on our website which was unusual and unexplained.  They asked me to update the site with some additions to .htacces file to implement "enable leverage browser cache and enable compression also to optimise the database tables".  I also added a robot.txt file they provided.  After doing this site is working with the exception that all access to pdf files via pdfembed gives a 404 file not found error.  For example: Cannot find  " www.cheamandcuddingtonhortsoc.org.uk/med...ews%2F2024-01-NK.pdf (port 443).  I looked on FileZilla and cannot see a directory below plg_system_ochfoundation5 entitled "libraries".  The pdf file 2024-NL-01.pdf is present and can be displayed on a browser using a direct link to that file on the server.  I reinstalled ochfoundation5 and ochelements  but no change in problem.

Please Log in to join the conversation.

More
1 month 1 week ago #2801 by Ruud van Lent
Replied by Ruud van Lent on topic cannot find any pdf file
Hi Derk,
what I see is that the following file is not available: [you site]/media/plg_system_ochfoundation5/libraries/vendor/pdfjs/web/viewer.html

This can have two reasons:
1. it is not there (you can check that via your filemanager in your hostingprovider)
2. that file is unreachable (probably due to .htaccess restricting access to html files)

Can you check 1. and if you could emal me the contents of your .htaccess then I can have a quick loook if i can see something in there

Please Log in to join the conversation.

More
1 month 1 week ago #2802 by Derek Sharp
Replied by Derek Sharp on topic cannot find any pdf file
Hello Ruud
I have just listed below thee xtra code that I was asked to add to the htaccess file. Best regards Derek Sharp
</IfModule>
## Leverage browser caching at HostPapa ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType application/x-javascript "access 1 month"
ExpiresByType application/javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 2 days"
</IfModule>
## End leverage browser caching ##
## Enable gzip compression at HostPapa ##
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
</IfModule>
## End gzip compression ##

Please Log in to join the conversation.

More
1 month 1 week ago #2803 by Ruud van Lent
Replied by Ruud van Lent on topic cannot find any pdf file
wait... found it.

I think that you did a template override for pdfembed.php, correct?

if so you need to change the location of the $scr like this:
Code:
$src        = $base . 'plugins/system/ochfoundation5/vendor/pdfjs/web/viewer.html';

I normally add these template changes to the changelog, but see that for this version I missed that.

 

Please Log in to join the conversation.

More
1 month 1 week ago #2804 by Derek Sharp
Replied by Derek Sharp on topic cannot find any pdf file
I forgot to mention that there is no "libraries" directory visible below .....ochfoundation5

Please Log in to join the conversation.

More
1 month 1 week ago #2805 by Derek Sharp
Replied by Derek Sharp on topic cannot find any pdf file
Where exactly does this code go?

Please Log in to join the conversation.

More
1 month 1 week ago #2806 by Ruud van Lent
Replied by Ruud van Lent on topic cannot find any pdf file
that directory (the contents of it) moved to ./plugins/system/ochfoundation5/vendor directory

In the pdfembed.php you point to the new directory, your pdfembed points to the old location so there must be a template overide for that file (which is not updated when you update the plugin)

Please Log in to join the conversation.

More
1 month 1 week ago #2807 by Ruud van Lent
Replied by Ruud van Lent on topic cannot find any pdf file

Where exactly does this code go?
 

it updates automatically except when you did a template override for the plugin: then te template makes a copy and that update is not 'updated'

So question is: did you do a template override?

Please Log in to join the conversation.

More
1 month 1 week ago #2808 by Derek Sharp
Replied by Derek Sharp on topic cannot find any pdf file
We did experiment with changing the way pdfemded works but came to the conclusion it would not work out as hoped so went back to the standard installation I think. The pdfembed was working fine before the updates I did to htaccess and the database optimise.

Please Log in to join the conversation.

More
1 month 1 week ago #2809 by Derek Sharp
Replied by Derek Sharp on topic cannot find any pdf file
Below "plg_system_ochfoundations5" there are two directories "images" and "js""

Please Log in to join the conversation.