{ Dev Farm }

Web & Windows Development

Add filemtime to cache

Home Forum Wp Gpx Maps Request a New Feature Add filemtime to cache

  • Questo topic ha 1 risposta, 2 partecipanti ed è stato aggiornato l'ultima volta 9 anni, 8 mesi fa da max.
Stai visualizzando 2 post - dal 1 a 2 (di 2 totali)
  • Autore
    Post
  • #24264 Rispondi
    David
    Ospite

    Like your plugin!

    I have a use case where I, during a travel, upload and overwrite a GPX-file with FTP. Currently the plugin does not catch that but loads the cached file. I don’t want to disable cache, my file will be large and the reducing functionality is a great feature! I know I can hit “clear cache” but I don’t want to add that rather inconvenient step when just updating the gpx-file.

    I suggest adding the file modification time to the $cacheFileName to be able to catch . I did a quick fix as the code show below. I’d like to be able to update the plugin so if you think it’s a good idea I’d please implement it :good:

    function handle_WP_GPX_Maps_Shortcodes($attr, $content=”)
    {
    […]
    // Add file modification time to cache filename to catch new uploads with same file name
    $mtime = sitePath() . str_replace(array(‘/’, ‘\\’), DIRECTORY_SEPARATOR, trim($gpx));
    if(file_exists($mtime)) {
    $mtime = filemtime($mtime);
    } else {
    $mtime = 0;
    }

    $cacheFileName = “$gpx,$mtime,$w,$mh,$mt,$gh,$showEle,$showW,$showHr,$showAtemp,$showCad,$donotreducegpx,$pointsoffset,$showSpeed,$showGrade,$uomspeed,$uom,$distanceType,v1.3.5”;

    Thank you for at least considering!

    Best regards,
    David

    #24312 Rispondi
    max
    Amministratore del forum

    Thank you David

Stai visualizzando 2 post - dal 1 a 2 (di 2 totali)
Rispondi a: Risposta #24312 in Add filemtime to cache

You can use BBCodes to format your content.
Your account can't use Advanced BBCodes, they will be stripped before saving.

Le tue informazioni:




Non è possibile lasciare nuovi commenti.