Ejemplo n.º 1
0
 public function clearProductCache($product_id)
 {
     $this->loadCore();
     if (!getNitroPersistence('PageCache.ClearCacheOnProductEdit')) {
         return;
     }
     initNitroProductCacheDb();
     $cachefile_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "nitro_product_cache WHERE product_id='" . $product_id . "'");
     foreach ($cachefile_query->rows as $cachefile) {
         $file = $cachefile['cachefile'];
         if (file_exists($file) && is_writable($file)) {
             unlink($file);
         }
         $filegz = $file . '.gz';
         if (file_exists($filegz) && is_writable($filegz)) {
             unlink($filegz);
         }
     }
     $this->db->query("DELETE FROM " . DB_PREFIX . "nitro_product_cache WHERE product_id='" . $product_id . "'");
     $this->clearDBCache();
 }
Ejemplo n.º 2
0
function setNitroProductCache($product_id, $cachefile)
{
    initNitroProductCacheDb();
    $db = NitroDb::getInstance();
    $db->query("INSERT INTO `" . DB_PREFIX . "nitro_product_cache` SET product_id='" . (int) $product_id . "', cachefile = '" . $cachefile . "'");
}