Forums

Cookillian
[resolved] Problem with caching (27 posts)

  1. dartiss
    Member
    Posted 1 year ago #

    I've been having some problems today where the plugin wasn't return a country code no matter what. At first I thought it was the IP from work but when I tried at home I was getting the same response.

    The cache data was showing the correct IP but no country code. I commented out the part of the code that attempts to retrieve it from cache and that fixed it - it would appear that the wrong country code was being held in cache.

    I've therefore looked at the transient cache in my wp-options table and can see that of the 1192 caches that the plugin has made only 230 have country codes - the remaining are blank. This suggests to me that there's a problem with either the code look-up or the cache storage. The country codes are from lots of different countries, nothing specific.

    I'm also concerned that the stats show that not a single user has so far opted in or out.

    If it helps at all I've attached the debug information to the bottom of this post - it was generated whilst it was still failing. Meantime I'm going to disable the plugin until you can get to the bottom of the problems.

    I see the cache is retained for 24 hours - is there also a possibility of making this changeable in the options screen?

    David.

    <!-- Cookillian Debug Information:
    array (
    'Will handle the cookies' => true,
    'Is the visitor logged in' => false,
    'Is Admin (not AJAX)' => false,
    'Country list OK' => true,
    'Detected remote IP address of the visitor' => '94.192.77.222',
    '2-letter code of detected country' => '',
    'Name of detected country' => 'Unknown',
    'Block cookies for this country' => false,
    'Visitor has opted-in' => false,
    'Visitor has opted-out' => false,
    )
    -->

    Generated On: Mon, 21 May 2012 19:04:14 GMT
    Cookillian Version: 1.0.10
    PHP Version: 5.3.8
    Memory Usage: 25.51 MB Peak, 25.44 MB Current, 256 MB Max permitted by PHP
    Available PHP Extensions: Core, date, ereg, libxml, openssl, pcre, sqlite3, zlib, bcmath, calendar, ctype, curl, dom, hash, fileinfo, filter, ftp, gd, gettext, SPL, iconv, session, intl, json, mbstring, mcrypt, mysql, mysqli, standard, Phar, posix, pspell, Reflection, imap, SimpleXML, soap, sockets, exif, tidy, tokenizer, wddx, xml, xmlreader, xmlrpc, xmlwriter, xsl, zip, cgi-fcgi, OAuth, timezonedb, imagick, PDO, pdo_sqlite, SQLite, pdo_mysql, ionCube Loader, Zend Guard Loader
    Pf4wp Version: 1.0.10
    Pf4wp APC Enabled: No
    WordPress Version: 3.3.2
    WordPress Debug Mode: Yes
    Active WordPress Theme: WP-Clear Child
    Active WordPress Plugins: 'Cookillian' by Mike Green (Myatu)
    Browser: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.46 Safari/536.5
    Server: Apache
    Server OS: Linux callisto.servers.eqx.misp.co.uk 2.6.32.21-grsec #10 SMP Tue Dec 27 12:08:57 GMT 2011 x86_64
    Database Version: 5.1.62-cll
    Template Engine Version: Twig 1.7.0

    http://wordpress.org/extend/plugins/cookillian/

  2. dartiss
    Member
    Posted 1 year ago #

    Did a little more digging. Switched the plugin off and cleared down the cache. Modified your code so that it would only save the cache if a result was returned and nothing is being saved.

    Now realised too that the prompt is coming up each time as well.

    Seems horribly broken (certainly on my site).

    David.

  3. myatu
    Member
    Plugin Author

    Posted 1 year ago #

    In "Debug Mode", the prompt will always appear, which is intentional. I am considering that it will only be the case for those logged in though.

    I will address the issue about the IP's and a more intuitive caching. I'll keep you posted.

  4. myatu
    Member
    Plugin Author

    Posted 12 months ago #

    I've just pushed version 1.0.17 through.

    There was a type check for the cached results that shouldn't have been there, which kept the plugin from trying to fetch the right country code if it hadn't got one, within that 24-hour window. There was also a bit of awkward code in the geoPlugin section that needed fixing.

    There's now also the option to show an alert if the country could not be determined, which is enabled by default.

    Because relying on a remote service can give some inconsistent results (or better put: reliability issues), I've added the option to add the MaxMind GeoLite (free) or GeoIP (££) Country database to Cookillian, as well as support for the Apache/NginX modules. This reduces reliance on a remote service, and is better for higher-traffic sites (especially when using the modules).

    Also, to give immediate feedback to the plugin administrator, the IP and detected location is shown on the Settings page now. This gives an indication if the selected geolocation service is working (or not).

    As for the alert continuously showing in Debug Mode, this has been changed to always show the alert only if the user is logged in, otherwise it would display the alert as usual - the debug information is still there though.

    I hope this will improve things a bit!

  5. dartiss
    Member
    Posted 12 months ago #

    Thanks for that prompt work - greatly appreciated. I'll get the new release installed and tested!

    David.

  6. dartiss
    Member
    Posted 12 months ago #

    Didn't get far. If you I go into the option screens it simply shows a red box with the message...

    Warning! No CloudFlare Geolocation data detected.

    The Cookies title is displayed along with the 3 menu options (which you can select) but no settings are listed.

    David.

  7. myatu
    Member
    Plugin Author

    Posted 12 months ago #

    Hmm, that's new! Does PHP give any errors if you enable WP_DEBUG in wp_config.php?

  8. dartiss
    Member
    Posted 12 months ago #

    I have that enabled by default (I'm running it on a test installation), however, it doesn't appear as the page is physically breaking.

    The bottom of the page source is (I've replaced some of the filename to hide the URL of my test account)...

    <div id="message" class="error"><p><strong>Warning!</strong> No CloudFlare Geolocation data detected.</p></div><div class="wrap"><div class="icon32" id="icon-options-general"></div><h2>Cookies</h2><div><ul class="subsubsub">
    <li><a href="[removed]/wp-admin/options-general.php?page=k2NTI3O">Settings</a> | </li>
    <li><a href="[removed]/wp-admin/options-general.php?page=k2NTI3O&sub=N3ZjVlN">Cookies <span class="count">(22)</span></a> | </li>
    <li><a href="[removed]/wp-admin/options-general.php?page=k2NTI3O&sub=i5ODk3Z">Statistics</a></li>
    </div><div class="clear"></div><div>

    The thing is, the error is correct. I believe I have CloudFlare active but I don't have an account for my test site. However, the reporting of this error is breaking the page, preventing me from turning it off.

    David.

  9. myatu
    Member
    Plugin Author

    Posted 12 months ago #

    Found the error. Will push out a quick fix ASAP. Has to do with disabled functions.

  10. dartiss
    Member
    Posted 12 months ago #

    Thanks for the quick fix.

    Sorry if I'm being a pain. However, I think this is the best plugin for cookie management available for WordPress but unless it's 100% I don't want to activate something that would either just not work (and hence not abide by ICO regulations) or annoy site visitors!

    I've already put a positive write-up about it on my site (artiss.co.uk) and will update it in time with the new feature details and the fact that I'll be (hopefully!) using it on my site.

    David.

  11. myatu
    Member
    Plugin Author

    Posted 12 months ago #

    Not to worry, I'd rather have someone tell me it's broken, so I can fix it, than not at all and have me wonder why no one is using it :)

    I'm currently attempting to upload the fix, though WordPress' SVN is a extremely touchy today. If you'd rather not wish to wait, the file that needs changing is at GitHub: https://github.com/Myatu/Cookillian-WP/blob/master/app/Myatu/WordPress/Cookillian/Main.php

  12. dartiss
    Member
    Posted 12 months ago #

    I'll wait. Just been uploading one my own to SVN, so I feel your pain!

    David.

  13. dartiss
    Member
    Posted 12 months ago #

    Got it installed and will try it out thoroughly tomorrow - the options screen is working now, though! Many thanks.

    Is it worth adding an extra column to the stats page to show those who had auto opt-out because they had DONOTTRACK active?

    Otherwise, the only option (off the top of my head) that I'd still like to see is the ability to select the cache time and, optionally, clear it.

    One last thing - the latest version didn't show in my WordPress admin. It was on 1.0.17 and didn't show that a newer one was available, so I had to manually download it and install it via FTP. I don't know if this is anything to do with the version numbers or just WP only checking for updates occasionally. Anyway, I thought I'd mention it.

    David.

  14. dartiss
    Member
    Posted 12 months ago #

    Sorry, found a problem. If I sign out of my test site and access the front page I get the prompt, as I should. However, if I accept cookies the message is disappearing and then immediately re-appearing. This keeps happening whenever I state that I wish to keep cookies.

    Debug information is...

    <!-- Cookillian Debug Information:
    array (
    'Will handle the cookies' => false,
    'Is the visitor logged in' => true,
    'Is Admin (not AJAX)' => false,
    'Country list OK' => true,
    'Detected remote IP address of the visitor' => '94.192.77.222',
    '2-letter code of detected country' => 'GB',
    'Name of detected country' => 'United Kingdom',
    'Block cookies for this country' => true,
    'Visitor has opted-in' => true,
    'Visitor has opted-out' => false,
    )
    -->

    Also, would it be possible if the selected GeoLocation site fails to attempt to use another?

    David.

  15. dartiss
    Member
    Posted 12 months ago #

    BTW, the Cookillian cookie is ticked as "required". I've also switched off any script minification and caching to ensure that none of those are clashing.

    The Cookillian cookie contains "1" and the header of the site shows that I've opted in, so I'm unsure as to why the prompt is therefore re-appearing.

    However, I suspect you may need to look at my site to assist. The URL is http://www.artiss.co.uk/sandbox

    David.

  16. myatu
    Member
    Plugin Author

    Posted 12 months ago #

    I've looked at that, and that gave me a rather surprising result. At first I couldn't replicate the problem locally, using the various settings and looking at the source code. So looked at what the browser itself was doing.

    When someone clicks the "No" button, it'll go to the same page (but with ?cookillian_resp=0 attached to the URI) so Cookillian can handle the response. In your case, Cookillian did so without a problem, set a cookie with the opt-out choice and sent you back to where you were. However, which differs from what I've tested so far, it pulled up a cached HTML page from the browser - never a fresh copy from your website. A subsequent refresh on the browser forced the cache to be refreshed, and the alert was gone like it was supposed to.

    I've noticed your server responds with "max-age=1800", which I've seen only with local caches like W3TC. I will need to find a work-around for that, hoping that adding a random query argument would be sufficient to force a refresh.

  17. dartiss
    Member
    Posted 12 months ago #

    My site does have cache control set within the .htaccess....

    Header unset Cache-Control:
    Header append Cache-Control: "max-age=1800, must-revalidate"

    I'm guessing this is the cause. However, I'm obviously loath to remove this as it's adding required caching to my site.

    Are you going to be okay to work around this?

    David.

  18. myatu
    Member
    Plugin Author

    Posted 12 months ago #

    I've just updated the development version (give WordPress a few minutes to catch up with the ZIP file). Hopefully this will provide a work-around to the problem you are experiencing.

  19. dartiss
    Member
    Posted 12 months ago #

    WordPress doesn't appear to have updated - it's still showing 1.0.17.1

  20. myatu
    Member
    Plugin Author

    Posted 12 months ago #

    The development version is 1.0.17-dev21 (stable is still at 1.0.17) - I just checked the development download, and it is the latest development version now.

  21. dartiss
    Member
    Posted 12 months ago #

    Didn't work I'm afraid.

    I cleared all my cookies beforehand and visited the site. It came up with the prompt, I clicked on to accept and the URL appeared as...

    http://artiss.co.uk/sandbox/?__r=c6bdbff3

    Unfortunately, the prompt then re-appeared.

    David.

  22. dartiss
    Member
    Posted 12 months ago #

    Hold on... i've got it working. I think it may be a caching problem. I tried it in a browser in which I'd cleared down all cache and cookies and it worked. I'll give it a thorough test tomorrow and let you know the outcome.

    David.

  23. dartiss
    Member
    Posted 12 months ago #

    Sorry, had to pull the plug. Implemented it on my live site and, at first, it appeared fine. The prompt appeared after I'd cleared my cache and I clicked ok and it went.

    However, I found that after closing the browsing and going back the prompt re-appeared.

    I tried it out on a clean Firefox install. I cleared all cookies, cache, etc and visited my site. The prompt appeared and I clicked Ok. The prompt went. I was then able to peruse my site without it appearing. Closed the browser down and restarted and the prompt appeared again.

    I thought maybe my cache plugin (WP Super Cache) maybe at fault so I switched it off - that made it worse. Even after clearing cookies and cache the prompt appeared everytime.

    I've had to deactive it now as it was on my live site. However, your debug output showed...

    <!-- Cookillian Debug Information:
    array (
    'Will handle the cookies' => true,
    'Is the visitor logged in' => false,
    'Is Admin (not AJAX)' => false,
    'Country list OK' => true,
    'Detected remote IP address of the visitor' => '193.130.87.58',
    '2-letter code of detected country' => 'GB',
    'Name of detected country' => 'United Kingdom',
    'Block cookies for this country' => true,
    'Visitor has opted-in' => false,
    'Visitor has opted-out' => false,
    )
    -->

    David.

  24. myatu
    Member
    Plugin Author

    Posted 12 months ago #

    Sorry to hear that, though I wasn't aware you were using WP Super Cache - that would certainly not work well with the current version of Cookillian, as it would cache the alert itself too (so anyone would see it).

    I'll be adding a more robust method of working around caches like W3TC and WP Super Cache for the the next version.

  25. dartiss
    Member
    Posted 12 months ago #

    Damn. Any idea on when the next version is likely to be launched?

    David.

  26. dartiss
    Member
    Posted 11 months ago #

    Happy to say, it's all fixed! Many thanks.

  27. jrg_uk
    Member
    Posted 2 months ago #

    Any progress on making it compatible with WP Super Cache?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.