{ Dev Farm }

Web & Windows Development

Add filemtime to cache

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

Questo argomento contiene 1 risposta, ha 2 partecipanti, ed è stato aggiornato da  max 5 anni fa.

Stai vedendo 2 articoli - dal 1 a 2 (di 2 totali)
  • Autore
    Articoli
  • #24264 Risposta

    David

    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 Risposta

    max
    Amministratore del forum

    Thank you David

Stai vedendo 2 articoli - dal 1 a 2 (di 2 totali)
Rispondi a: 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:




:bye:  :good:  :negative:  :scratch:  :wacko:  :yahoo:  B-) 
more...
 

Non è possibile lasciare nuovi commenti.