News:

Looking for documentation? Take a look on our wiki

Main Menu

TCPDF huge cache

Started by EIF, June 24, 2013, 15:13:11 PM

Previous topic - Next topic

EIF

Some how the last days the TCPDF cache folder (libraries) is increased a lot. A lot of cache files (about 45000) with names like mska_2cd8302fc91247ca0cad5f00c44b86c3 are stored.
What is this and how can I delete this cache files automatically?

Using Joomla 2.5.11 and Virtuemart 2.0.20b


Milbo

Interesting, in fact a question for the tcpdf guys, we just use their library, we do not write it.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

EIF

I just check the cache again, but the folder is still empty now.
I will ask those tcpdf guys. If it happens again or/and I have a solutions or cause, then I will report it here.

Milbo

Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

hardwared

#4
I am also getting similar issues, have tracked it down to the likes of Googlebot somehow requesting the product details pdf view instead of html as it crawls your site.

As to where google gets its information from about the availability of the pdf view I am unsure as I have the "show PDF icon" disabled

to help prevent my site from getting shut down for now i have made the following change to virtuemart (2.0.22c):

Edit:  components/com_virtuemart/controllers/productdetails.php  (starting at line 43)

Before:

                if ($format == 'pdf') {
                        $viewName = 'Pdf';
                } else {
                        $viewName = 'Productdetails';
                }


After: 

                /* if ($format == 'pdf') {
                        $viewName = 'Pdf';
                } else { */
                        $viewName = 'Productdetails';
                // }

This does break links for product detail pdf views which is not the nicest option.

Should be a way that I can redefine $format or $viewName and have the html view displayed regardless. 

(even better check for presence of vmconfig "show pdf icon" and toggle based on that)

P.S.  This looks to be something going back for a while now ...  https://forum.virtuemart.net/index.php?topic=109442.0

Topic: TCPDF overloading the server

Can only hope this info helps others :)


AH

What do you have for the view lnk in your default.php product template, is pdf still an option?
Regards
A

Joomla 3.10.11
php 8.0

hardwared

#6
Joomla! 2.5.14
Virtuemart: 2.0.22c
PHP Version: 5.3.27

I don't believe so just checked views/productdetails/tmpl/default.php

(i am currently using the stock virtuemart templates for nearly most of the shop)

Hutson: when you say "view link", what exactly are you referring to ?

I dont have any "View Links" as such unless you are referring to "Product Details" which i believe i only have within a Category view.

Within the Product Details Page, i don't really have any view links either. Have also inspected the output to the web browser and cant find anything that would cause googlebot to want to follow products somewhere within my shop in PDF view which i dont believe virtuemart/joomla provided it any hints on how to get there ...


jjk

Eventuall you could add the following line to your robots.txt file:
Disallow: /*.pdf$

This should keep Google away from crawling anything that ends with .pdf
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations

hardwared

#8
Thanks jjk, 

but this seems to only affect googlebot itself and not all of google's bot types and also the likes of msnbot and others.

Here is what I have done in the end so far with no-side affects assuming i have any real pdf files available for download / linking to via [ /pdf ] ( a directory i have created in the joomla html root )

This gives the behavior of redirecting all pdf views back to html view without having to modify components/com_virtuemart/controllers/productdetails.php as in my earlier post.   

Modified  .htaccess to include the following starting after:  ## Begin - Custom redirects


RewriteCond %{THE_REQUEST} ^[GET]+\s([^\s]+)\.pdf(\?|\s)
RewriteCond %{REQUEST_URI} !^/pdf/(.*)$
RewriteRule .* %1.html [R=301,L]





hotrod

Sorry but I just found this after posting a question about it.. can I delete all the files in this cache folder?
Bronze Member
VirtueMart 4.2.4 10922
Joomla!  ‎4.3.4
PHP 8.0

aagios

In the following path:

public_htm/libraries/tcpdf/tcpdf.php

In this file (tcpdf.php) make a change.

For me it was the 8724 line that says:

$imga->setImageFormat('png');
   $imga->writeImage($tempfile_plain);
   } elseif (function_exists('imagecreatefrompng')) { // GD extension
   // generate images

Change it and put it instead of png -> jpg

$imga->setImageFormat('jpg');
   $imga->writeImage($tempfile_plain);
   } elseif (function_exists('imagecreatefrompng')) { // GD extension
   // generate images

Thats it. After this
No longer being produced brazenly files in cache of TCPDF.