本文整理汇总了PHP中Media::clearCache方法的典型用法代码示例。如果您正苦于以下问题:PHP Media::clearCache方法的具体用法?PHP Media::clearCache怎么用?PHP Media::clearCache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Media
的用法示例。
在下文中一共展示了Media::clearCache方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: clearCache
public static function clearCache()
{
Tools::clearSmartyCache();
Tools::clearXMLCache();
Media::clearCache();
Tools::generateIndex();
}
示例2: beforeUpdateOptions
public function beforeUpdateOptions()
{
if (!Tools::getValue('PS_STOCK_MANAGEMENT', true)) {
$_POST['PS_ORDER_OUT_OF_STOCK'] = 1;
$_POST['PS_DISPLAY_QTIES'] = 0;
}
// if advanced stock management is disabled, updates concerned tables
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT') == 1 && (int) Tools::getValue('PS_ADVANCED_STOCK_MANAGEMENT') == 0 && Context::getContext()->shop->getContext() == Shop::CONTEXT_ALL) {
ObjectModel::updateMultishopTable('Product', array('advanced_stock_management' => 0), 'product_shop.`advanced_stock_management` = 1');
Db::getInstance()->execute('UPDATE `' . _DB_PREFIX_ . 'stock_available`
SET `depends_on_stock` = 0, `quantity` = 0
WHERE `depends_on_stock` = 1');
}
if (Tools::getIsset('PS_CATALOG_MODE')) {
Tools::clearSmartyCache();
Media::clearCache();
}
}
示例3: beforeUpdateOptions
public function beforeUpdateOptions()
{
if (!Tools::getValue('PS_STOCK_MANAGEMENT', true)) {
$_POST['PS_ORDER_OUT_OF_STOCK'] = 1;
$_POST['PS_DISPLAY_QTIES'] = 0;
}
// if advanced stock management is disabled, updates concerned tables
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT') == 1 && (int) Tools::getValue('PS_ADVANCED_STOCK_MANAGEMENT') == 0) {
$id_shop_list = Shop::getContextListShopID();
$sql_shop = 'UPDATE `' . _DB_PREFIX_ . 'product_shop` SET `advanced_stock_management` = 0 WHERE
`advanced_stock_management` = 1 AND (`id_shop` = ' . implode(' OR `id_shop` = ', $id_shop_list) . ')';
$sql_stock = 'UPDATE `' . _DB_PREFIX_ . 'stock_available` SET `depends_on_stock` = 0, `quantity` = 0
WHERE `depends_on_stock` = 1 AND (`id_shop` = ' . implode(' OR `id_shop` = ', $id_shop_list) . ')';
$sql = 'UPDATE `' . _DB_PREFIX_ . 'product` SET `advanced_stock_management` = 0 WHERE
`advanced_stock_management` = 1 AND (`id_shop_default` = ' . implode(' OR `id_shop_default` = ', $id_shop_list) . ')';
Db::getInstance()->execute($sql_shop);
Db::getInstance()->execute($sql_stock);
Db::getInstance()->execute($sql);
}
if (Tools::getIsset('PS_CATALOG_MODE')) {
Tools::clearSmartyCache();
Media::clearCache();
}
}
示例4: postProcess
//.........这里部分代码省略.........
} else {
$redirectAdmin = true;
if (Configuration::get('PS_HTACCESS_CACHE_CONTROL')) {
Tools::generateHtaccess();
}
}
} else {
$this->errors[] = Tools::displayError('You do not have permission to edit this.');
}
}
if ((bool) Tools::getValue('media_server_up')) {
if ($this->tabAccess['edit'] === '1') {
if (Tools::getValue('_MEDIA_SERVER_1_') != null && !Validate::isFileName(Tools::getValue('_MEDIA_SERVER_1_'))) {
$this->errors[] = Tools::displayError('Media server #1 is invalid');
}
if (Tools::getValue('_MEDIA_SERVER_2_') != null && !Validate::isFileName(Tools::getValue('_MEDIA_SERVER_2_'))) {
$this->errors[] = Tools::displayError('Media server #2 is invalid');
}
if (Tools::getValue('_MEDIA_SERVER_3_') != null && !Validate::isFileName(Tools::getValue('_MEDIA_SERVER_3_'))) {
$this->errors[] = Tools::displayError('Media server #3 is invalid');
}
if (!count($this->errors)) {
$base_urls = array();
$base_urls['_MEDIA_SERVER_1_'] = Tools::getValue('_MEDIA_SERVER_1_');
$base_urls['_MEDIA_SERVER_2_'] = Tools::getValue('_MEDIA_SERVER_2_');
$base_urls['_MEDIA_SERVER_3_'] = Tools::getValue('_MEDIA_SERVER_3_');
if ($base_urls['_MEDIA_SERVER_1_'] || $base_urls['_MEDIA_SERVER_2_'] || $base_urls['_MEDIA_SERVER_3_']) {
Configuration::updateValue('PS_MEDIA_SERVERS', 1);
} else {
Configuration::updateValue('PS_MEDIA_SERVERS', 0);
}
rewriteSettingsFile($base_urls, null, null);
Tools::clearSmartyCache();
Media::clearCache();
Tools::generateHtaccess(null, null, null, '', null, array($base_urls['_MEDIA_SERVER_1_'], $base_urls['_MEDIA_SERVER_2_'], $base_urls['_MEDIA_SERVER_3_']));
unset($this->_fieldsGeneral['_MEDIA_SERVER_1_']);
unset($this->_fieldsGeneral['_MEDIA_SERVER_2_']);
unset($this->_fieldsGeneral['_MEDIA_SERVER_3_']);
$redirectAdmin = true;
}
} else {
$this->errors[] = Tools::displayError('You do not have permission to edit this.');
}
}
if ((bool) Tools::getValue('ciphering_up') && Configuration::get('PS_CIPHER_ALGORITHM') != (int) Tools::getValue('PS_CIPHER_ALGORITHM')) {
if ($this->tabAccess['edit'] === '1') {
$algo = (int) Tools::getValue('PS_CIPHER_ALGORITHM');
$prev_settings = file_get_contents(_PS_ROOT_DIR_ . '/config/settings.inc.php');
$new_settings = $prev_settings;
if ($algo) {
if (!function_exists('mcrypt_encrypt')) {
$this->errors[] = Tools::displayError('The "Mcrypt" PHP extension is not activated on this server.');
} else {
if (!strstr($new_settings, '_RIJNDAEL_KEY_')) {
$key_size = mcrypt_get_key_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_ECB);
$key = Tools::passwdGen($key_size);
$new_settings = preg_replace('/define\\(\'_COOKIE_KEY_\', \'([a-z0-9=\\/+-_]+)\'\\);/i', 'define(\'_COOKIE_KEY_\', \'\\1\');' . "\n" . 'define(\'_RIJNDAEL_KEY_\', \'' . $key . '\');', $new_settings);
}
if (!strstr($new_settings, '_RIJNDAEL_IV_')) {
$iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_ECB);
$iv = base64_encode(mcrypt_create_iv($iv_size, MCRYPT_RAND));
$new_settings = preg_replace('/define\\(\'_COOKIE_IV_\', \'([a-z0-9=\\/+-_]+)\'\\);/i', 'define(\'_COOKIE_IV_\', \'\\1\');' . "\n" . 'define(\'_RIJNDAEL_IV_\', \'' . $iv . '\');', $new_settings);
}
}
}
if (!count($this->errors)) {
示例5: processSave
public function processSave()
{
/** @var ShopUrl $object */
$object = $this->loadObject(true);
if ($object->canAddThisUrl(Tools::getValue('domain'), Tools::getValue('domain_ssl'), Tools::getValue('physical_uri'), Tools::getValue('virtual_uri'))) {
$this->errors[] = $this->trans('A shop URL that uses this domain already exists.', array(), 'Admin.Notifications.Error');
}
$unallowed = str_replace('/', '', Tools::getValue('virtual_uri'));
if ($unallowed == 'c' || $unallowed == 'img' || is_numeric($unallowed)) {
$this->errors[] = $this->trans('A shop virtual URL cannot be "%URL%"', array('%URL%' => $unallowed), 'Admin.Notifications.Error');
}
$return = parent::processSave();
if (!$this->errors) {
Tools::generateHtaccess();
Tools::clearSmartyCache();
Media::clearCache();
}
return $return;
}
示例6: processSave
public function processSave()
{
$object = $this->loadObject(true);
if ($object->canAddThisUrl(Tools::getValue('domain'), Tools::getValue('domain_ssl'), Tools::getValue('physical_uri'), Tools::getValue('virtual_uri'))) {
$this->errors[] = Tools::displayError('A shop URL that uses this domain already exists.');
}
$return = parent::processSave();
if (!$this->errors) {
Tools::generateHtaccess();
Tools::clearSmartyCache();
Media::clearCache();
}
return $return;
}
示例7: processSave
public function processSave()
{
$object = $this->loadObject(true);
if ($object->canAddThisUrl(Tools::getValue('domain'), Tools::getValue('domain_ssl'), Tools::getValue('physical_uri'), Tools::getValue('virtual_uri'))) {
$this->errors[] = Tools::displayError('A shop URL that uses this domain already exists.');
}
if (str_replace('/', '', Tools::getValue('virtual_uri')) == 'c') {
$this->errors[] = Tools::displayError('A shop virtual URL can not be "/c/", because "/c/" is the virtual url prefix for category images.');
}
$return = parent::processSave();
if (!$this->errors) {
Tools::generateHtaccess();
Tools::clearSmartyCache();
Media::clearCache();
}
return $return;
}
示例8: psmClearCache
function psmClearCache()
{
Tools::clearSmartyCache();
Media::clearCache();
Tools::generateIndex();
}
示例9: clear_smarty_cache
public static function clear_smarty_cache()
{
$configuration = PS_CLI_Configure::getConfigurationInstance();
echo "Clearing cache...\n";
if ($configuration->verbose) {
echo "Smarty cache ";
}
Tools::clearSmartyCache();
if ($configuration->verbose) {
echo "[OK]\nXML cache ";
}
Tools::clearXMLCache();
if ($configuration->verbose) {
echo "[OK]\nClearing media cache ";
}
Media::clearCache();
if ($configuration->verbose) {
echo "[OK]\nRegenerating index ";
}
Tools::generateIndex();
if ($configuration->verbose) {
echo "[OK]\n";
}
echo "Done !\n";
return true;
}
示例10: clearMigrationCache
private function clearMigrationCache()
{
Tools::clearCache();
Tools::clearXMLCache();
Media::clearCache();
Tools::generateIndex();
$sf2Refresh = new \PrestaShopBundle\Service\Cache\Refresh();
$sf2Refresh->addCacheClear(_PS_MODE_DEV_ ? 'dev' : 'prod');
$sf2Refresh->execute();
}
示例11: postProcess
//.........这里部分代码省略.........
}
}
}
} else {
$this->errors[] = $this->trans('You do not have permission to edit this.', array(), 'Admin.Notifications.Error');
}
}
if ((bool) Tools::getValue('media_server_up') && !defined('_PS_HOST_MODE_')) {
if ($this->access('edit')) {
if (Tools::getValue('_MEDIA_SERVER_1_') != null && !Validate::isFileName(Tools::getValue('_MEDIA_SERVER_1_'))) {
$this->errors[] = $this->trans('Media server #1 is invalid', array(), 'Admin.Parameters.Notification');
}
if (Tools::getValue('_MEDIA_SERVER_2_') != null && !Validate::isFileName(Tools::getValue('_MEDIA_SERVER_2_'))) {
$this->errors[] = $this->trans('Media server #2 is invalid', array(), 'Admin.Parameters.Notification');
}
if (Tools::getValue('_MEDIA_SERVER_3_') != null && !Validate::isFileName(Tools::getValue('_MEDIA_SERVER_3_'))) {
$this->errors[] = $this->trans('Media server #3 is invalid', array(), 'Admin.Parameters.Notification');
}
if (!count($this->errors)) {
$base_urls = array();
$base_urls['_MEDIA_SERVER_1_'] = Tools::getValue('_MEDIA_SERVER_1_');
$base_urls['_MEDIA_SERVER_2_'] = Tools::getValue('_MEDIA_SERVER_2_');
$base_urls['_MEDIA_SERVER_3_'] = Tools::getValue('_MEDIA_SERVER_3_');
if ($base_urls['_MEDIA_SERVER_1_'] || $base_urls['_MEDIA_SERVER_2_'] || $base_urls['_MEDIA_SERVER_3_']) {
Configuration::updateValue('PS_MEDIA_SERVERS', 1);
} else {
Configuration::updateValue('PS_MEDIA_SERVERS', 0);
}
rewriteSettingsFile($base_urls, null, null);
Configuration::updateValue('PS_MEDIA_SERVER_1', Tools::getValue('_MEDIA_SERVER_1_'));
Configuration::updateValue('PS_MEDIA_SERVER_2', Tools::getValue('_MEDIA_SERVER_2_'));
Configuration::updateValue('PS_MEDIA_SERVER_3', Tools::getValue('_MEDIA_SERVER_3_'));
Tools::clearSmartyCache();
Media::clearCache();
if (is_writable(_PS_ROOT_DIR_ . '/.htaccess')) {
Tools::generateHtaccess(null, null, null, '', null, array($base_urls['_MEDIA_SERVER_1_'], $base_urls['_MEDIA_SERVER_2_'], $base_urls['_MEDIA_SERVER_3_']));
unset($this->_fieldsGeneral['_MEDIA_SERVER_1_']);
unset($this->_fieldsGeneral['_MEDIA_SERVER_2_']);
unset($this->_fieldsGeneral['_MEDIA_SERVER_3_']);
$redirectAdmin = true;
} else {
$message = $this->l('Before being able to use this tool, you need to:');
$message .= '<br />- ' . $this->l('Create a blank .htaccess in your root directory.');
$message .= '<br />- ' . $this->l('Give it write permissions (CHMOD 666 on Unix system).');
$this->errors[] = Tools::displayError($message, false);
Configuration::updateValue('PS_HTACCESS_CACHE_CONTROL', false);
}
}
} else {
$this->errors[] = $this->trans('You do not have permission to edit this.', array(), 'Admin.Notifications.Error');
}
}
if ((bool) Tools::getValue('cache_up')) {
if ($this->access('edit')) {
$config = Yaml::parse(_PS_ROOT_DIR_ . '/app/config/parameters.yml');
$cache_active = (bool) Tools::getValue('cache_active');
if ($caching_system = preg_replace('[^a-zA-Z0-9]', '', Tools::getValue('caching_system'))) {
$config['parameters']['ps_caching'] = $caching_system;
} else {
$cache_active = false;
$this->errors[] = $this->trans('The caching system is missing.', array(), 'Admin.Parameters.Notification');
}
if ($cache_active) {
if ($caching_system == 'CacheMemcache' && !extension_loaded('memcache')) {
$this->errors[] = $this->trans('To use Memcached, you must install the Memcache PECL extension on your server.', array(), 'Admin.Parameters.Notification') . '
<a href="http://www.php.net/manual/en/memcache.installation.php">http://www.php.net/manual/en/memcache.installation.php</a>';