Author Topic: TCPDF huge cache  (Read 5173 times)

EIF

  • Jr. Member
  • **
  • Posts: 77
TCPDF huge cache
« on: June 24, 2013, 15:13:11 pm »
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

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10000
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: TCPDF huge cache
« Reply #1 on: June 24, 2013, 22:14:49 pm »
Interesting, in fact a question for the tcpdf guys, we just use their library, we do not write it.
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

EIF

  • Jr. Member
  • **
  • Posts: 77
Re: TCPDF huge cache
« Reply #2 on: June 25, 2013, 11:49:35 am »
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

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10000
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: TCPDF huge cache
« Reply #3 on: June 26, 2013, 01:25:00 am »
sounds good.
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

hardwared

  • Beginner
  • *
  • Posts: 3
  • Computer Systems Architect - James Cook University
    • Dynamic Access
  • Skype Name: hardwared
  • VirtueMart Version: 2.0.22c
Re: TCPDF huge cache
« Reply #4 on: October 05, 2013, 08:05:51 am »
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:
Code: [Select]
                if ($format == 'pdf') {
                        $viewName = 'Pdf';
                } else {
                        $viewName = 'Productdetails';
                }

After: 
Code: [Select]
                /* 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

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3025
  • VirtueMart Version: 3.6.3
Re: TCPDF huge cache
« Reply #5 on: October 05, 2013, 10:05:54 am »
What do you have for the view lnk in your default.php product template, is pdf still an option?
regards
A

Joomla 3.9.12
php 7.2

hardwared

  • Beginner
  • *
  • Posts: 3
  • Computer Systems Architect - James Cook University
    • Dynamic Access
  • Skype Name: hardwared
  • VirtueMart Version: 2.0.22c
Re: TCPDF huge cache
« Reply #6 on: October 05, 2013, 11:08:55 am »
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

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3552
  • using Matomo instead of Google Analytics
Re: TCPDF huge cache
« Reply #7 on: October 05, 2013, 12:31:33 pm »
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

  • Beginner
  • *
  • Posts: 3
  • Computer Systems Architect - James Cook University
    • Dynamic Access
  • Skype Name: hardwared
  • VirtueMart Version: 2.0.22c
Re: TCPDF huge cache
« Reply #8 on: October 07, 2013, 05:02:28 am »
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

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




hotrod

  • Jr. Member
  • **
  • Posts: 104
  • Silver Supporting Member
Re: TCPDF huge cache
« Reply #9 on: February 14, 2014, 03:00:51 am »
Sorry but I just found this after posting a question about it.. can I delete all the files in this cache folder?
VirtueMart 2.6.8 (Patched 9/18)
Joomla 2.5.22
PHP Version    5.4.32 
Dedicated Server.
Proud Virtuemart Supporter http://forum.virtuemart.net/index.php?topic=124355.0

aagios

  • Beginner
  • *
  • Posts: 5
Re: TCPDF huge cache
« Reply #10 on: January 22, 2015, 10:55:00 am »
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.