]> git.immae.eu Git - github/shaarli/Shaarli.git/blobdiff - application/ApplicationUtils.php
Add a version hash for asset loading to prevent browser's cache issue
[github/shaarli/Shaarli.git] / application / ApplicationUtils.php
index 85dcbeebdb164858680ff68b9fbc1048340d05f1..20fec376faebddda7b040eb2b35a73e457396fd8 100644 (file)
@@ -220,4 +220,19 @@ class ApplicationUtils
 
         return $errors;
     }
+
+    /**
+     * Returns a salted hash representing the current Shaarli version.
+     *
+     * Useful for assets browser cache.
+     *
+     * @param string $currentVersion of Shaarli
+     * @param string $salt           User personal salt, also used for the authentication
+     *
+     * @return string version hash
+     */
+    public static function getVersionHash($currentVersion, $salt)
+    {
+        return hash_hmac('sha256', $currentVersion, $salt);
+    }
 }