コード例 #1
0
ファイル: cache.php プロジェクト: SwayWebStudio/night.com
 public function clear_all()
 {
     if (!$this->user->hasPermission('modify', 'module/journal2')) {
         throw new Exception('You do not have permissions to modify Journal2 module');
     }
     Journal2Cache::deleteCache();
 }
コード例 #2
0
ファイル: nitro.php プロジェクト: artlabsdesign/missbloom
 public function clearPageCache()
 {
     if ($this->user->hasPermission('modify', 'module/journal2')) {
         if (class_exists('Journal2Cache')) {
             Journal2Cache::deleteCache();
         }
     }
     initNitroProductCacheDb();
     $this->db->query("TRUNCATE TABLE " . DB_PREFIX . "nitro_product_cache");
     $this->trunc_folder(NITRO_PAGECACHE_FOLDER, 'index.html');
     return true;
 }
コード例 #3
0
ファイル: journal2.php プロジェクト: SwayWebStudio/night.com
 public function clear_cache()
 {
     if ($this->user->hasPermission('modify', 'module/journal2')) {
         Journal2Cache::deleteCache();
         $this->session->data['success'] = 'Journal Cache has been successfully cleared.';
     } else {
         $this->session->data['warning'] = 'You do not have permissions to modify Journal2 module.';
     }
     if (isset($this->session->data['j2_redirect'])) {
         $redirect = $this->url->link($this->session->data['j2_redirect'], 'token=' . $this->session->data['token'], 'SSL');
         unset($this->session->data['j2_redirect']);
     } else {
         $redirect = $this->url->link('common/home', 'token=' . $this->session->data['token'], 'SSL');
     }
     if (Front::$IS_OC2) {
         $this->response->redirect($redirect);
     } else {
         $this->redirect($redirect);
     }
 }
コード例 #4
0
ファイル: currency.php プロジェクト: kctan0620/onlinestore
 public function refresh($force = false)
 {
     if (extension_loaded('curl')) {
         $data = array();
         if ($force) {
             $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "currency WHERE code != '" . $this->db->escape($this->config->get('config_currency')) . "'");
         } else {
             $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "currency WHERE code != '" . $this->db->escape($this->config->get('config_currency')) . "' AND date_modified < '" . $this->db->escape(date('Y-m-d H:i:s', strtotime('-1 day'))) . "'");
         }
         foreach ($query->rows as $result) {
             $data[] = $this->config->get('config_currency') . $result['code'] . '=X';
         }
         $curl = curl_init();
         curl_setopt($curl, CURLOPT_URL, 'http://download.finance.yahoo.com/d/quotes.csv?s=' . implode(',', $data) . '&f=sl1&e=.csv');
         curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
         curl_setopt($curl, CURLOPT_HEADER, false);
         curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 30);
         curl_setopt($curl, CURLOPT_TIMEOUT, 30);
         $content = curl_exec($curl);
         curl_close($curl);
         $lines = explode("\n", trim($content));
         foreach ($lines as $line) {
             $currency = utf8_substr($line, 4, 3);
             $value = utf8_substr($line, 11, 6);
             if ((double) $value) {
                 $this->db->query("UPDATE " . DB_PREFIX . "currency SET value = '" . (double) $value . "', date_modified = '" . $this->db->escape(date('Y-m-d H:i:s')) . "' WHERE code = '" . $this->db->escape($currency) . "'");
             }
         }
         $this->db->query("UPDATE " . DB_PREFIX . "currency SET value = '1.00000', date_modified = '" . $this->db->escape(date('Y-m-d H:i:s')) . "' WHERE code = '" . $this->db->escape($this->config->get('config_currency')) . "'");
         if (defined('JOURNAL_FLUSH_CURRENCY_CACHE')) {
             require_once DIR_SYSTEM . 'journal2/classes/journal2_cache.php';
             Journal2Cache::deleteCache();
         }
         $this->cache->delete('currency');
     }
 }
コード例 #5
0
ファイル: core.php プロジェクト: artlabsdesign/missbloom
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");
}