function cleanNitroCacheFolders($touch = false, $time = false) { cleanFolder(NITRO_PAGECACHE_FOLDER, $touch, $time); cleanFolder(NITRO_DBCACHE_FOLDER, $touch, $time); cleanFolder(NITRO_FOLDER . 'temp' . DS, $touch, $time); cleanFolder(dirname(DIR_APPLICATION) . DS . 'assets' . DS . 'css' . DS, $touch, $time); cleanFolder(dirname(DIR_APPLICATION) . DS . 'assets' . DS . 'js' . DS, $touch, $time); if (class_exists('Journal2Cache')) { Journal2Cache::deleteCache(); } $db = NitroDb::getInstance(); $db->query("TRUNCATE TABLE " . DB_PREFIX . "nitro_product_cache"); }
function generateNameOfCacheFile() { if (!empty($GLOBALS['nitro.pagecache.file'])) { return $GLOBALS['nitro.pagecache.file']; } nitroEnableSession(); if (empty($_SESSION['language']) && empty($_SESSION['currency'])) { $db = NitroDb::getInstance(); $db->query("SET NAMES 'utf8'"); $db->query("SET CHARACTER SET utf8"); $db->query("SET CHARACTER_SET_CONNECTION=utf8"); $db->query("SET SQL_MODE = ''"); // In, when the site is opened for first time // Store if (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] == '1')) { $store_query = $db->query("SELECT * FROM " . DB_PREFIX . "store WHERE REPLACE(`ssl`, 'www.', '') = '" . $db->escape('https://' . str_replace('www.', '', $_SERVER['HTTP_HOST']) . rtrim(dirname($_SERVER['PHP_SELF']), '/.\\') . '/') . "'"); } else { $store_query = $db->query("SELECT * FROM " . DB_PREFIX . "store WHERE REPLACE(`url`, 'www.', '') = '" . $db->escape('http://' . str_replace('www.', '', $_SERVER['HTTP_HOST']) . rtrim(dirname($_SERVER['PHP_SELF']), '/.\\') . '/') . "'"); } $store_id = 0; if ($store_query->num_rows) { $result = $store_query->row; $store_id = (int) $result['store_id']; } $GLOBALS['nitro.store_id'] = $store_id; $resource = $db->query("SELECT * FROM " . DB_PREFIX . "setting WHERE (`key`='config_language' OR `key`='config_currency') AND `store_id` = '" . $store_id . "'"); if ($resource->num_rows) { $data = array(); $config_language = 0; $config_currency = 0; foreach ($resource->rows as $result) { if (!empty($result['key']) && $result['key'] == 'config_language') { $config_language = strtolower($result['value']); } if (!empty($result['key']) && $result['key'] == 'config_currency') { $config_currency = strtolower($result['value']); } } if (isset($_SESSION)) { $_SESSION['language'] = $config_language; $_SESSION['currency'] = $config_currency; } } } $filename = getFullURL(); $filename = str_replace(array('/', '?', ':', ';', '=', '&', '&', '.', '--', '%', '~', '-amp-'), '-', $filename); $default_language = !empty($_COOKIE['language']) ? $_COOKIE['language'] : '0'; $default_currency = !empty($_COOKIE['currency']) ? $_COOKIE['currency'] : '0'; $language = strtolower(!empty($_SESSION['language']) && is_string($_SESSION['language']) ? $_SESSION['language'] : $default_language); $currency = strtolower(!empty($_SESSION['currency']) && is_string($_SESSION['currency']) ? $_SESSION['currency'] : $default_currency); if (NITRO_DEBUG_MODE) { $cached_filename = $filename . '-' . $language . '-' . $currency . '.html'; } else { $cached_filename = md5($filename . '-' . $language . '-' . $currency) . '.html'; } if (mobileCheck()) { $cached_filename = 'mobile-' . $cached_filename; } $GLOBALS['nitro.pagecache.file'] = getSSLCachePrefix() . $cached_filename; return $GLOBALS['nitro.pagecache.file']; }