当前位置: 首页>>代码示例>>PHP>>正文


PHP Cache::clean方法代码示例

本文整理汇总了PHP中Cache::clean方法的典型用法代码示例。如果您正苦于以下问题:PHP Cache::clean方法的具体用法?PHP Cache::clean怎么用?PHP Cache::clean使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Cache的用法示例。


在下文中一共展示了Cache::clean方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: loadLocalisationPack

 public function loadLocalisationPack($file, $selection, $install_mode = false, $iso_localization_pack = null)
 {
     if (!($xml = @simplexml_load_string($file))) {
         return false;
     }
     libxml_clear_errors();
     $main_attributes = $xml->attributes();
     $this->name = (string) $main_attributes['name'];
     $this->version = (string) $main_attributes['version'];
     if ($iso_localization_pack) {
         $id_country = (int) Country::getByIso($iso_localization_pack);
         if ($id_country) {
             $country = new Country($id_country);
         }
         if (!$id_country || !Validate::isLoadedObject($country)) {
             $this->_errors[] = Tools::displayError(sprintf('Cannot load country : %1d', $id_country));
             return false;
         }
         if (!$country->active) {
             $country->active = 1;
             if (!$country->update()) {
                 $this->_errors[] = Tools::displayError(sprintf('Cannot enable the associated country: %1s', $country->name));
             }
         }
     }
     $res = true;
     if (empty($selection)) {
         $res &= $this->_installStates($xml);
         $res &= $this->_installTaxes($xml);
         $res &= $this->_installCurrencies($xml, $install_mode);
         $res &= $this->installConfiguration($xml);
         $res &= $this->installModules($xml);
         $res &= $this->updateDefaultGroupDisplayMethod($xml);
         if (($res || $install_mode) && isset($this->iso_code_lang)) {
             if (!($id_lang = (int) Language::getIdByIso($this->iso_code_lang, true))) {
                 $id_lang = 1;
             }
             if (!$install_mode) {
                 Configuration::updateValue('PS_LANG_DEFAULT', $id_lang);
             }
         } elseif (!isset($this->iso_code_lang) && $install_mode) {
             $id_lang = 1;
         }
         if (!Language::isInstalled(Language::getIsoById($id_lang))) {
             $res &= $this->_installLanguages($xml, $install_mode);
             $res &= $this->_installUnits($xml);
         }
         if ($install_mode && $res && isset($this->iso_currency)) {
             Cache::clean('Currency::getIdByIsoCode_*');
             $res &= Configuration::updateValue('PS_CURRENCY_DEFAULT', (int) Currency::getIdByIsoCode($this->iso_currency));
             Currency::refreshCurrencies();
         }
     } else {
         foreach ($selection as $selected) {
             // No need to specify the install_mode because if the selection mode is used, then it's not the install
             $res &= Validate::isLocalizationPackSelection($selected) ? $this->{'_install' . $selected}($xml) : false;
         }
     }
     return $res;
 }
开发者ID:prestanesia,项目名称:PrestaShop,代码行数:60,代码来源:LocalizationPack.php

示例2: tearDown

 protected function tearDown()
 {
     $this->PDO->exec('TRUNCATE TABLE `' . PREFIX . 'training`');
     $this->PDO->exec('TRUNCATE TABLE `' . PREFIX . 'sport`');
     $this->PDO->exec('TRUNCATE TABLE `' . PREFIX . 'shoe`');
     \Cache::clean();
 }
开发者ID:n0rthface,项目名称:Runalyze,代码行数:7,代码来源:InserterTest.php

示例3: initializeContext

 public function initializeContext()
 {
     global $smarty;
     // Clean all cache values
     Cache::clean('*');
     Context::getContext()->shop = new Shop(1);
     Shop::setContext(Shop::CONTEXT_SHOP, 1);
     Configuration::loadConfiguration();
     if (!isset(Context::getContext()->language) || !Validate::isLoadedObject(Context::getContext()->language)) {
         if ($id_lang = (int) Configuration::get('PS_LANG_DEFAULT')) {
             Context::getContext()->language = new Language($id_lang);
         }
     }
     if (!isset(Context::getContext()->country) || !Validate::isLoadedObject(Context::getContext()->country)) {
         if ($id_country = (int) Configuration::get('PS_COUNTRY_DEFAULT')) {
             Context::getContext()->country = new Country((int) $id_country);
         }
     }
     if (!isset(Context::getContext()->currency) || !Validate::isLoadedObject(Context::getContext()->currency)) {
         if ($id_currency = (int) Configuration::get('PS_CURRENCY_DEFAULT')) {
             Context::getContext()->currency = new Currency((int) $id_currency);
         }
     }
     Context::getContext()->cart = new Cart();
     Context::getContext()->employee = new Employee(1);
     if (!defined('_PS_SMARTY_FAST_LOAD_')) {
         define('_PS_SMARTY_FAST_LOAD_', true);
     }
     require_once _PS_ROOT_DIR_ . '/config/smarty.config.inc.php';
     Context::getContext()->smarty = $smarty;
 }
开发者ID:M03G,项目名称:PrestaShop,代码行数:31,代码来源:process.php

示例4: update

 public function update($null_values = false)
 {
     Cache::clean('getContextualValue_' . $this->id . '_*');
     if (!$this->reduction_currency) {
         $this->reduction_currency = (int) Configuration::get('PS_CURRENCY_DEFAULT');
     }
     return parent::update($null_values);
 }
开发者ID:jpodracky,项目名称:dogs,代码行数:8,代码来源:CartRule.php

示例5: tearDown

 protected function tearDown()
 {
     $this->PDO->exec('DELETE FROM `' . PREFIX . 'training`');
     $this->PDO->exec('DELETE FROM `' . PREFIX . 'sport`');
     $this->PDO->exec('DELETE FROM `' . PREFIX . 'equipment_type`');
     $Factory = new Model\Factory(0);
     $Factory->clearCache('sport');
     \Cache::clean();
 }
开发者ID:9x,项目名称:Runalyze,代码行数:9,代码来源:InserterTest.php

示例6: tearDown

 protected function tearDown()
 {
     $this->PDO->exec('DELETE FROM `' . PREFIX . 'training`');
     $this->PDO->exec('DELETE FROM `' . PREFIX . 'trackdata`');
     $this->PDO->exec('DELETE FROM `' . PREFIX . 'swimdata`');
     $this->PDO->exec('DELETE FROM `' . PREFIX . 'route`');
     $this->PDO->exec('DELETE FROM `' . PREFIX . 'sport`');
     \Cache::clean();
 }
开发者ID:9x,项目名称:Runalyze,代码行数:9,代码来源:DeleterTest.php

示例7: tryToClearCache

 /**
  * Try to clear cache
  */
 protected function tryToClearCache()
 {
     try {
         new Cache();
         Cache::clean();
         $this->CacheWasCleared = true;
     } catch (Exception $e) {
         $this->CacheWasCleared = false;
     }
 }
开发者ID:aschix,项目名称:Runalyze,代码行数:13,代码来源:class.InstallerUpdate.php

示例8: run

 /**
  * Run job
  */
 public function run()
 {
     if ($this->isRequested(self::ELEVATION)) {
         $this->runRouteLoop();
     }
     if (count($this->updateSet())) {
         $this->runActivityLoop();
         // This may be removed if single activities are not cached anymore.
         \Cache::clean();
     }
 }
开发者ID:guancio,项目名称:Runalyze,代码行数:14,代码来源:JobLoop.php

示例9: loadLocalisationPack

 public function loadLocalisationPack($file, $selection, $install_mode = false)
 {
     if (!($xml = simplexml_load_string($file))) {
         return false;
     }
     $main_attributes = $xml->attributes();
     $this->name = (string) $main_attributes['name'];
     $this->version = (string) $main_attributes['version'];
     if (empty($selection)) {
         $res = true;
         $res &= $this->_installStates($xml);
         $res &= $this->_installTaxes($xml);
         $res &= $this->_installCurrencies($xml, $install_mode);
         $res &= $this->_installUnits($xml);
         $res &= $this->installConfiguration($xml);
         $res &= $this->installModules($xml);
         $res &= $this->_installLanguages($xml, $install_mode);
         if ($res && isset($this->iso_code_lang)) {
             if (!($id_lang = (int) Language::getIdByIso($this->iso_code_lang))) {
                 $id_lang = 1;
             }
             if (!$install_mode) {
                 Configuration::updateValue('PS_LANG_DEFAULT', $id_lang);
             }
         }
         if ($install_mode && $res && isset($this->iso_currency)) {
             Cache::clean('Currency::getIdByIsoCode_*');
             $res &= Configuration::updateValue('PS_CURRENCY_DEFAULT', (int) Currency::getIdByIsoCode($this->iso_currency));
             Currency::refreshCurrencies();
         }
         return $res;
     }
     foreach ($selection as $selected) {
         if (strtolower((string) $selected) == 'currencies') {
             if (!Validate::isLocalizationPackSelection($selected) || !$this->{'_install' . ucfirst($selected)}($xml, true)) {
                 return false;
             }
         } else {
             if (!Validate::isLocalizationPackSelection($selected) || !$this->{'_install' . ucfirst($selected)}($xml)) {
                 return false;
             }
         }
     }
     return true;
 }
开发者ID:toufikadfab,项目名称:PrestaShop-1.5,代码行数:45,代码来源:LocalizationPack.php

示例10: loadLocalisationPack

 public function loadLocalisationPack($file, $selection, $install_mode = false)
 {
     if (!($xml = simplexml_load_string($file))) {
         return false;
     }
     $main_attributes = $xml->attributes();
     $this->name = (string) $main_attributes['name'];
     $this->version = (string) $main_attributes['version'];
     $res = true;
     if (empty($selection)) {
         $res &= $this->_installStates($xml);
         $res &= $this->_installTaxes($xml);
         $res &= $this->_installCurrencies($xml, $install_mode);
         $res &= $this->_installUnits($xml);
         $res &= $this->installConfiguration($xml);
         $res &= $this->installModules($xml);
         $res &= $this->_installLanguages($xml, $install_mode);
         $res &= $this->updateDefaultGroupDisplayMethod($xml);
         if ($res && isset($this->iso_code_lang)) {
             if (!($id_lang = (int) Language::getIdByIso($this->iso_code_lang))) {
                 $id_lang = 1;
             }
             if (!$install_mode) {
                 Configuration::updateValue('PS_LANG_DEFAULT', $id_lang);
             }
         }
         if ($install_mode && $res && isset($this->iso_currency)) {
             Cache::clean('Currency::getIdByIsoCode_*');
             $res &= Configuration::updateValue('PS_CURRENCY_DEFAULT', (int) Currency::getIdByIsoCode($this->iso_currency));
             Currency::refreshCurrencies();
         }
     } else {
         foreach ($selection as $selected) {
             // No need to specify the install_mode because if the selection mode is used, then it's not the install
             $res &= Validate::isLocalizationPackSelection($selected) ? $this->{'_install' . $selected}($xml) : false;
         }
     }
     return $res;
 }
开发者ID:dev-lav,项目名称:htdocs,代码行数:39,代码来源:LocalizationPack.php

示例11: clearCache

 /**
  * Clear complete cache 
  */
 public static function clearCache()
 {
     Cache::clean();
 }
开发者ID:steckbrief,项目名称:Runalyze,代码行数:7,代码来源:class.System.php

示例12: removeCartRule

    public function removeCartRule($id_cart_rule)
    {
        Cache::clean('Cart::getCartRules' . $this->id . '-' . CartRule::FILTER_ACTION_ALL);
        Cache::clean('Cart::getCartRules' . $this->id . '-' . CartRule::FILTER_ACTION_SHIPPING);
        Cache::clean('Cart::getCartRules' . $this->id . '-' . CartRule::FILTER_ACTION_REDUCTION);
        Cache::clean('Cart::getCartRules' . $this->id . '-' . CartRule::FILTER_ACTION_GIFT);
        $result = Db::getInstance()->execute('
		DELETE FROM `' . _DB_PREFIX_ . 'cart_cart_rule`
		WHERE `id_cart_rule` = ' . (int) $id_cart_rule . '
		AND `id_cart` = ' . (int) $this->id . '
		LIMIT 1');
        $cart_rule = new CartRule($id_cart_rule, Configuration::get('PS_LANG_DEFAULT'));
        if ((int) $cart_rule->gift_product) {
            $this->updateQty(1, $cart_rule->gift_product, $cart_rule->gift_product_attribute, null, 'down', 0, null, false);
        }
        return $result;
    }
开发者ID:jicheng17,项目名称:pengwine,代码行数:17,代码来源:Cart.php

示例13: setDeliveryOption

 /**
  * Set the delivery option and id_carrier, if there is only one carrier
  */
 public function setDeliveryOption($delivery_option = null)
 {
     if (empty($delivery_option) || count($delivery_option) == 0) {
         $this->delivery_option = '';
         $this->id_carrier = 0;
         return;
     }
     Cache::clean('getContextualValue_*');
     $delivery_option_list = $this->getDeliveryOptionList(null, true);
     foreach ($delivery_option_list as $id_address => $options) {
         if (!isset($delivery_option[$id_address])) {
             foreach ($options as $key => $option) {
                 if ($option['is_best_price']) {
                     $delivery_option[$id_address] = $key;
                     break;
                 }
             }
         }
     }
     if (count($delivery_option) == 1) {
         $this->id_carrier = $this->getIdCarrierFromDeliveryOption($delivery_option);
     }
     $this->delivery_option = serialize($delivery_option);
 }
开发者ID:dev-lav,项目名称:htdocs,代码行数:27,代码来源:Cart.php

示例14: validateOrder

 public function validateOrder($id_cart, $id_order_state, $amountPaid, $paymentMethod = 'Unknown', $message = NULL, $extraVars = array(), $currency_special = NULL, $dont_touch_amount = false, $secure_key = false, Shop $shop = null)
 {
     @session_start();
     @set_time_limit(120);
     $_SESSION['id_cart_validating'] = (int) $id_cart;
     if (Module::isInstalled('agileprepaidcredit')) {
         require_once _PS_ROOT_DIR_ . "/modules/agileprepaidcredit/agileprepaidcredit.php";
         AgilePrepaidCredit::set_token_payment_processing_marker($id_cart, true);
     }
     if (!Module::isInstalled('agilemultipleseller')) {
         $ret = parent::validateOrder($id_cart, $id_order_state, $amountPaid, $paymentMethod, $message, $extraVars, $currency_special, $dont_touch_amount, $secure_key);
         if (Module::isInstalled('agileprepaidcredit')) {
             AgilePrepaidCredit::adjustOrderForTokens($this->currentOrder);
             if ($this->name == 'agilepaypalparallel' || ($this->name = 'agilepaypaladaptive')) {
                 AgilePrepaidCredit::checkOrderInvoicePayment($this->currentOrder);
             }
         }
         return $ret;
     }
     require_once _PS_ROOT_DIR_ . "/modules/agilemultipleseller/agilemultipleseller.php";
     $paymode = (int) Configuration::get('AGILE_MS_PAYMENT_MODE');
     $sellers = AgileMultipleSeller::getSellersByCart($id_cart);
     if (count($sellers) <= 1) {
         $id_cart_patent = AgileMultipleSeller::get_subcart_parentid($id_cart);
         $ordervalided = parent::validateOrder($id_cart, $id_order_state, $amountPaid, $paymentMethod, $message, $extraVars, $currency_special, $dont_touch_amount, $secure_key);
         $this->updateSellerCommissionRecordType($paymode, $message);
         if ($ordervalided and $id_cart_patent > 0) {
             AgileMultipleSeller::remove_subcart_items_from_maincart($id_cart, $this->currentOrder);
         }
         if (Module::isInstalled('agileprepaidcredit')) {
             AgilePrepaidCredit::adjustOrderForTokens($this->currentOrder);
             if ($this->name == 'agilepaypalparallel' || ($this->name = 'agilepaypaladaptive')) {
                 AgilePrepaidCredit::checkOrderInvoicePayment($this->currentOrder);
             }
         }
         return $ordervalided;
     }
     $cartinfos = AgileMultipleSeller::split_shopping_cart($id_cart, $sellers);
     if (empty($cartinfos)) {
         $ret = parent::validateOrder($id_cart, $id_order_state, $amountPaid, $paymentMethod, $message, $extraVars, $currency_special, $dont_touch_amount, $secure_key);
         $this->updateSellerCommissionRecordType($paymode, $message);
         if (Module::isInstalled('agileprepaidcredit')) {
             AgilePrepaidCredit::adjustOrderForTokens($this->currentOrder);
             if ($this->name == 'agilepaypalparallel' || ($this->name = 'agilepaypaladaptive')) {
                 AgilePrepaidCredit::checkOrderInvoicePayment($this->currentOrder);
             }
         }
         return $ret;
     }
     $ret = true;
     foreach ($cartinfos as $cartinfo) {
         $_SESSION['id_cart_validating'] = (int) $cartinfo['id_cart'];
         $this->context->cart = new Cart(intval($cartinfo['id_cart']));
         $this->context->cart->getPackageList(true);
         $filter = CartRule::FILTER_ACTION_ALL;
         $cache_key = 'Cart::getCartRules' . $cartinfo['id_cart'] . '-' . $filter;
         if (Cache::isStored($cache_key)) {
             Cache::clean($cache_key);
         }
         if (Module::isInstalled('agileprepaidcredit')) {
             AgilePrepaidCredit::set_token_payment_processing_marker($cartinfo['id_cart'], true);
         }
         $ret = $ret and parent::validateOrder($cartinfo['id_cart'], $id_order_state, $cartinfo['amountPaid'], $paymentMethod, $message, $extraVars, $currency_special, $dont_touch_amount, $secure_key);
         $this->updateSellerCommissionRecordType($paymode, $message);
         if ($this->name == 'agilepaypalparallel') {
             $this->updateTxnDetailCartID($message, $this->currentOrder, $cartinfo['id_cart']);
         }
         if (Module::isInstalled('agileprepaidcredit')) {
             AgilePrepaidCredit::adjustOrderForTokens($this->currentOrder);
             if ($this->name == 'agilepaypalparallel' || ($this->name = 'agilepaypaladaptive')) {
                 AgilePrepaidCredit::adjustOrderPaymentAmount($this->currentOrder, $this->name);
                 AgilePrepaidCredit::checkOrderInvoicePayment($this->currentOrder);
             }
         }
     }
     return $ret;
 }
开发者ID:sho5kubota,项目名称:guidingyou2,代码行数:77,代码来源:PaymentModule.php

示例15: addOrderPayment

    /**
     *
     * This method allows to add a payment to the current order
     * @since 1.5.0.1
     * @param float $amount_paid
     * @param string $payment_method
     * @param string $payment_transaction_id
     * @param Currency $currency
     * @param string $date
     * @param OrderInvoice $order_invoice
     * @return bool
     */
    public function addOrderPayment($amount_paid, $payment_method = null, $payment_transaction_id = null, $currency = null, $date = null, $order_invoice = null)
    {
        $order_payment = new OrderPayment();
        $order_payment->order_reference = $this->reference;
        $order_payment->id_currency = $currency ? $currency->id : $this->id_currency;
        // we kept the currency rate for historization reasons
        $order_payment->conversion_rate = $currency ? $currency->conversion_rate : 1;
        // if payment_method is define, we used this
        $order_payment->payment_method = $payment_method ? $payment_method : $this->payment;
        $order_payment->transaction_id = $payment_transaction_id;
        $order_payment->amount = $amount_paid;
        $order_payment->date_add = $date ? $date : null;
        // Update total_paid_real value for backward compatibility reasons
        if ($order_payment->id_currency == $this->id_currency) {
            $this->total_paid_real += $order_payment->amount;
        } else {
            $this->total_paid_real += Tools::ps_round(Tools::convertPrice($order_payment->amount, $order_payment->id_currency, false), 2);
        }
        // We put autodate parameter of add method to true if date_add field is null
        $res = $order_payment->add(is_null($order_payment->date_add)) && $this->update();
        if (!$res) {
            return false;
        }
        if (!is_null($order_invoice)) {
            $res = Db::getInstance()->execute('
			INSERT INTO `' . _DB_PREFIX_ . 'order_invoice_payment` (`id_order_invoice`, `id_order_payment`, `id_order`)
			VALUES(' . (int) $order_invoice->id . ', ' . (int) $order_payment->id . ', ' . (int) $this->id . ')');
            // Clear cache
            Cache::clean('order_invoice_paid_*');
        }
        return $res;
    }
开发者ID:TheTypoMaster,项目名称:neotienda,代码行数:44,代码来源:NeoExchanges.php


注:本文中的Cache::clean方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。