• Resolved piccart

    (@piccart)


    Hello!

    We’re getting quite a few php warnings every day and they all seem to relate to the function generate_cookie_policy_snapshot which is fired by a cron.

    most of the warnings refer to Mpdf Cache and fonts.

    /plugins/complianz-gdpr/assets/vendor/mpdf/mpdf/src/Cache.php in Mpdf\Cache::write
    Warning: rename(): Cannot rename a file across wrapper types

    /plugins/complianz-gdpr/assets/vendor/mpdf/mpdf/src/Mpdf.php in Mpdf\Mpdf::AddFont
    Warning: Trying to access array offset on value of type null

    We use a S3 bucket as CDN for the WP Uploads, and some of the errors are related to the fact that this file is missing:

    /uploads/complianz/tmp/1678190064/mpdf/ttfontdata/dejavuserifcondensed.cw.dat resulted in a 404 Not Found

    the subfolder /tmp is missing entirely in the CDN, we have only the complianz/css and complianz/placeholders

    I’ve also just realised that the site crashes (throwing a bunch of those same errors), when I go to “Proof of consent” in admin and I click to generate one. I suppose it is the same process that is fired by the cron, isn’t it?

    Do you have any suggestions?

    thanks!

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Rogier Lankhorst

    (@rogierlankhorst)

    Yes, the cron generates a proof of consent using the same function as when you click “generated proof of consent”.

    The first error also seems to be related to a path issue, so the main issue seems to be caused by the S3 bucket configuration.

    Does it help if you manually create the tmp/1678190064/ folders?

    It’s strange the placeholders directory is working, but this one isn’t. Is it possible the s3 bucket doesn’t allow the creation of these temp files? Possibly there’s a file type restriction on it or something like that.

    Thread Starter piccart

    (@piccart)

    Hello Rogier, and thanks for your prompt reply!

    I am not aware of any file type restriction on the bucket, but it does feel like the problem is that Mpdf is not able to write its cached/temp stuff into the bucket.

    Though it seems quite odd that the rest of the plugin’s folders are being created/accessed without problems… any idea about what could be different?

    by the way, is the number in the tmp sub-folder a timestamp? or is it always the same? If it’s always the same I could try to manually upload that font, but I have a feeling that the tmp sub-folder will be different for every run…

    Plugin Contributor Aert Hulsebos

    (@aahulsebos)

    Hi @piccart,

    We didn’t forget, we’re looking at the why’s..

    regards Aert

    Plugin Author Rogier Lankhorst

    (@rogierlankhorst)

    @piccart sorry about my late response!

    To answer your question: the number is a random string which doesn’t change after first creation, so you can manually create it.

    What I’d like to test is to disable the tmp directory in the MPDF library entirely. I’ve always felt that generated files like these should not be stored in the MPDF library directory, but if that causes errors I could add a filter to disable this for setups like yours.

    I have disabled it here:
    https://github.com/Really-Simple-Plugins/complianz-gdpr/tree/no-temp-dir-in-MPDF

    Can you check if installing this branch resolves the issue? If that works, I will add a filter here, and provide you with a small snippet to disable it.

    Plugin Author Rogier Lankhorst

    (@rogierlankhorst)

    @piccart did the above help in your case? Let me know and I can formalise it into a filter which you can add in a mu-plugin.

    Thread Starter piccart

    (@piccart)

    Hello Rogier! sorry for the belated reply but I’ve been off work.

    I’ve just tested that branch on my local environment (connected to the same bucket) and I managed to generate the pdf file by clicking from the “Proof of consent” page.

    I assume it will work when triggered by the cron job too.

    For reference, it placed the file under

    /uploads/complianz/snapshots/

    actually, I am now wondering, if it will generate one pdf per day with the cron, will it keep them all or is it going to delete the oldest and keep only a few?

    Plugin Contributor Aert Hulsebos

    (@aahulsebos)

    Hi @piccart,

    It will only generate a snapshot on cron if a significant change in your cookie policy, by adding a service for example, is detected.

    It will not delete any snapshots, but we’re thinking of deleting snapshots if one is older than expiration date of consent itself. The latter is found under settings is defaulted to 365 days.

    regards Aert

    Thread Starter piccart

    (@piccart)

    ok great!

    could you ping me here when you merge the fix into the main plugin?

    many thanks for your help!

    Plugin Contributor jarnovos

    (@jarnovos)

    Hi @piccart,

    This addition is included in our testing routines, although I can’t say exactly in which version it will be included.

    Please keep an eye on the plugin change log, so that you’re sure that the desired change has been included in that release of the plugin; so you can update when that’s the case.

    Kind regards, Jarno

    Plugin Author Rogier Lankhorst

    (@rogierlankhorst)

    @piccart I have discussed this internally, we will include this change in version 7.0. If you want to join the beta program for 7 you can send us a message at support(at)complianz.io.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘problems with generate_cookie_policy_snapshot’ is closed to new replies.