本文整理汇总了PHP中fn_clear_cache函数的典型用法代码示例。如果您正苦于以下问题:PHP fn_clear_cache函数的具体用法?PHP fn_clear_cache怎么用?PHP fn_clear_cache使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fn_clear_cache函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fn_settings_actions_addons_seo
/**
* Check if mod_rewrite is active and clean up templates cache
*/
function fn_settings_actions_addons_seo(&$new_value, $old_value)
{
if ($new_value == 'A') {
Http::get(Registry::get('config.http_location') . '/catalog.html?version');
$headers = Http::getHeaders();
if (strpos($headers, '200 OK') === false) {
$new_value = 'D';
fn_set_notification('W', __('warning'), __('warning_seo_urls_disabled'));
}
}
fn_clear_cache();
return true;
}
示例2: fn_get_theme_path
$exim = Exim::instance(Registry::get('runtime.company_id'), $layout_id, fn_get_theme_path('[theme]', 'C'));
$structure = $exim->getStructure($layout_path);
if (!empty($structure)) {
foreach ($layout_data as $key => $val) {
if (!empty($structure->layout->{$key})) {
$structure->layout->{$key} = $val;
}
}
if (!isset($layout_data['is_default'])) {
$structure->layout->is_default = 0;
}
$exim->import($structure, array('import_style' => 'update'));
fn_create_theme_logos_by_layout_id($layout_data['theme_name'], $layout_id, Registry::get('runtime.company_id'), false, Styles::factory($layout_data['theme_name'])->getDefault());
}
}
fn_clear_cache('statics', 'design/');
return array(CONTROLLER_STATUS_OK, fn_url('block_manager.manage?s_layout=' . $layout_id));
}
if ($mode == 'update_block') {
$description = array();
if (!empty($_REQUEST['block_data']['description'])) {
$_REQUEST['block_data']['description']['lang_code'] = DESCR_SL;
$description = $_REQUEST['block_data']['description'];
}
if (!empty($_REQUEST['block_data']['content_data'])) {
$_REQUEST['block_data']['content_data']['lang_code'] = DESCR_SL;
if (isset($_REQUEST['block_data']['content'])) {
$_REQUEST['block_data']['content_data']['content'] = $_REQUEST['block_data']['content'];
}
}
if (!empty($_REQUEST['dynamic_object']['object_id']) && $_REQUEST['dynamic_object']['object_id'] > 0) {
示例3: import
public static function import($store_data, $actualize_data = false)
{
set_time_limit(0);
ini_set('memory_limit', '1024M');
fn_define('STORE_IMPORT', true);
$log_dir = Registry::get('config.dir.store_import');
fn_mkdir($log_dir);
$logger = \Tygh\Logger::instance();
$logger->logfile = $log_dir . date('Y-m-d_H-i') . '.log';
if ($actualize_data) {
$logos = self::_backupLogos();
}
$import_classes_cascade = self::getImportClassesCascade($store_data);
$db_already_cloned = false;
Registry::set('runtime.skip_sharing_selection', true);
self::_removeTempTables();
self::_setUnavailableLangVars();
if (!$actualize_data) {
self::_uninstallAllAddons();
}
fn_set_progress('parts', count($import_classes_cascade) * 6 + 2);
$result = !empty($import_classes_cascade) ? true : false;
self::setDefaultLanguage($store_data);
foreach ($import_classes_cascade as $class_name) {
if ($result) {
if (class_exists($class_name)) {
$obj = new $class_name($store_data);
$result = $db_already_cloned = $obj->import($db_already_cloned);
Settings::instance()->reloadSections();
} else {
$result = false;
fn_set_notification('E', __('error'), __('store_import.class_not_found'));
break;
}
} else {
fn_set_notification('E', __('error'), __('store_import.import_failed'));
break;
}
}
Registry::set('runtime.skip_sharing_selection', false);
if ($result) {
General::setLicenseData();
//First, we should install all addons from old version in the new version that all templates, etc were installed in the new version
self::installAddons();
//Next, we should install all tabs in the upgraded database (mostly for the old version, 2.2.x)
self::installAddonsTabs();
fn_clear_cache();
if (!$actualize_data) {
self::_removeRussianServices($store_data);
if (fn_allowed_for('ULTIMATE')) {
$company_ids = db_get_fields("SELECT company_id FROM ?:companies");
foreach ($company_ids as $company_id) {
self::_installTheme($company_id);
}
} else {
self::_installTheme();
}
}
self::replaceOriginalDB($store_data, $actualize_data);
fn_install_addon('store_import', false);
self::_removeTempTables();
if (defined('AJAX_REQUEST')) {
Registry::get('ajax')->assign('non_ajax_notifications', true);
Registry::get('ajax')->assign('force_redirection', fn_url('index.index'));
}
if ($actualize_data) {
self::_restoreLogos($logos);
}
fn_set_progress('step_scale', '1');
fn_set_progress('echo', __('store_import.done'), true);
return true;
}
return false;
}
示例4: fn_set_notification
fn_set_notification('E', __('error'), __('theme_editor.error_theme_converted_to_css', array('[url]' => fn_url("customization.update_mode?type=theme_editor&status=enable&s_layout={$layout['layout_id']}"))));
}
}
// We need to re-init layout
fn_init_layout(array('s_layout' => $layout['layout_id']));
// Delete compiled CSS file
fn_clear_cache('assets');
}
if ($mode == 'styles') {
if ($action == 'update_status') {
$theme = Themes::factory(fn_get_theme_path('[theme]', 'C'));
$theme_manifest = $theme->getManifest();
if (empty($theme_manifest['converted_to_css'])) {
Styles::factory(fn_get_theme_path('[theme]', 'C'))->setStyle($_REQUEST['id'], $_REQUEST['status']);
// Delete compiled CSS file
fn_clear_cache('assets');
} else {
$layout = Layout::instance(Registry::get('runtime.company_id'))->getDefault();
fn_set_notification('E', __('error'), __('theme_editor.error_theme_converted_to_css', array('[url]' => fn_url("customization.update_mode?type=theme_editor&status=enable&s_layout={$layout['layout_id']}"))));
}
}
}
if ($mode == 'update_dev_mode') {
if (!empty($_REQUEST['dev_mode'])) {
if (!empty($_REQUEST['state'])) {
Development::enable($_REQUEST['dev_mode']);
} else {
Development::disable($_REQUEST['dev_mode']);
}
if ($_REQUEST['dev_mode'] == 'compile_check') {
if (!empty($_REQUEST['state'])) {
示例5: fn_delete_watermarks
/**
* Clear generated watermarks
*
* @param array $images_types Images types to be cleared, clear all if empty
* @return boolean Always true
*/
function fn_delete_watermarks($images_types)
{
$path_types = array('icons' => array('category', 'product', 'thumbnails'), 'detailed' => array('detailed'));
$delete_paths = array();
foreach ($path_types as $k => $v) {
if (empty($images_types) || !empty($images_types[$k])) {
$delete_paths = array_merge($delete_paths, $path_types[$k]);
}
}
$wt_paths = array(WATERMARKS_DIR_NAME);
if (fn_allowed_for('ULTIMATE') && !Registry::get('runtime.company_id')) {
$wt_paths = array();
$companies = fn_get_short_companies();
foreach ($companies as $company_id => $name) {
$wt_paths[] = 'watermarked/' . $company_id . '/';
}
}
foreach ($delete_paths as $path) {
foreach ($wt_paths as $wt_path) {
Storage::instance('images')->deleteDir($wt_path . $path);
}
}
fn_clear_cache();
return true;
}
示例6: fn_restore_dump
function fn_restore_dump($files)
{
if (empty($files)) {
return false;
}
fn_set_progress('parts', sizeof($files));
foreach ($files as $file) {
$is_archive = false;
$list = array($file);
if (in_array(fn_get_file_ext($file), array('zip', 'tgz'))) {
$is_archive = true;
fn_decompress_files(Registry::get('config.dir.database') . $file, Registry::get('config.dir.database') . '_tmp');
$list = fn_get_dir_contents(Registry::get('config.dir.database') . '_tmp', false, true, 'sql', '_tmp/');
}
foreach ($list as $_file) {
db_import_sql_file(Registry::get('config.dir.database') . $_file);
}
if ($is_archive) {
fn_rm(Registry::get('config.dir.database') . '_tmp');
}
}
// Log database restore
fn_log_event('database', 'restore');
fn_set_hook('database_restore', $files);
fn_clear_cache();
return true;
}
示例7: fn_theme_editor_set_style
function fn_theme_editor_set_style($style_id)
{
$style_id = fn_basename($style_id);
$theme_name = Registry::get('runtime.layout.theme_name');
$layout_id = Registry::get('runtime.layout.layout_id');
Styles::factory($theme_name)->setStyle($layout_id, $style_id);
Registry::set('runtime.layout.style_id', $style_id);
fn_clear_cache('assets', 'design/');
return true;
}
示例8: fn_update_addon_status
/**
* Updates addon status
*
* @param string $addon Addon to update status for
* @param string $status Status to change to
* @param bool $show_notification Display notification if set to true
* @param bool $on_install If status was changed right after install process
* @param bool $allow_unmanaged Whether to allow change status for unmanaged addons in non-console environment
*
* @return bool|string True on success, old status ID if status was not changed
*/
function fn_update_addon_status($addon, $status, $show_notification = true, $on_install = false, $allow_unmanaged = false)
{
$old_status = db_get_field("SELECT status FROM ?:addons WHERE addon = ?s", $addon);
$new_status = $status;
$scheme = SchemesManager::getScheme($addon);
// Unmanaged addons can be enabled/disabled via console only
if ($scheme->getUnmanaged() && !($allow_unmanaged || defined('CONSOLE'))) {
return false;
}
/**
* Hook is executed before changing add-on status (i.e. before add-on enabling or disabling).
*
* @param string $addon Add-on name
* @param string $status New addon status - "A" for enabled, "D" for disabled
* @param bool $show_notification Display notification if set to true
* @param bool $on_install If status was changed right after install process
* @param bool $allow_unmanaged Whether to allow change status for unmanaged addons in non-console environment
* @param string $old_status Previous addon status - "A" for enabled, "D" for disabled
* @param \Tygh\Addons\AXmlScheme $scheme Add-on scheme
*/
fn_set_hook('update_addon_status_pre', $addon, $status, $show_notification, $on_install, $allow_unmanaged, $old_status, $scheme);
if ($old_status != $new_status) {
// Check if addon can be enabled
$conflicts = db_get_fields("SELECT addon FROM ?:addons WHERE status = 'A' AND FIND_IN_SET(?s, conflicts)", $addon);
if ($new_status == 'A' && !empty($conflicts)) {
$scheme = SchemesManager::getScheme($addon);
fn_set_notification('W', __('warning'), __('text_addon_cannot_enable', array('[addons]' => implode(', ', SchemesManager::getNames($conflicts)), '[addon_name]' => $scheme->getName())));
return $old_status;
}
fn_get_schema('settings', 'actions.functions', 'php', true);
$func = 'fn_settings_actions_addons_' . $addon;
if (function_exists($func)) {
$func($new_status, $old_status, $on_install);
}
// If status change is allowed, update it
if ($old_status != $new_status) {
if ($new_status != 'D') {
// Check that addon have conflicts
$scheme = SchemesManager::getScheme($addon);
$conflicts = db_get_field("SELECT conflicts FROM ?:addons WHERE addon = ?s", $addon);
if (!empty($conflicts)) {
$conflicts = explode(',', $conflicts);
$conflicted_addons = db_get_fields("SELECT addon FROM ?:addons WHERE addon IN (?a) AND status = 'A'", $conflicts);
if (!empty($conflicted_addons)) {
$lang_var = 'text_addon_confclicts_on_install';
if (!$on_install) {
foreach ($conflicts as $conflict) {
fn_disable_addon($conflict, $scheme->getName(), $show_notification);
}
$lang_var = 'text_addon_confclicts';
}
fn_set_notification('W', __('warning'), __($lang_var, array('[addons]' => implode(', ', SchemesManager::getNames($conflicts)), '[addon_name]' => $scheme->getName())));
// On install we cannot enable addon with conflicts automaticly
if ($on_install) {
return $old_status;
}
}
}
}
db_query("UPDATE ?:addons SET status = ?s WHERE addon = ?s", $status, $addon);
$func = 'fn_settings_actions_addons_post_' . $addon;
if (function_exists($func)) {
$func($status);
}
if ($show_notification == true) {
fn_set_notification('N', __('notice'), __('status_changed'));
}
// Enable/disable tabs for addon
ProductTabs::instance()->updateAddonTabStatus($addon, $new_status);
Registry::set('addons.' . $addon . '.status', $status);
} else {
return $old_status;
}
}
// Clean cache
fn_clear_cache();
if ($status == 'A') {
foreach (fn_get_installed_themes() as $theme_name) {
$theme = Themes::factory($theme_name);
$theme_manifest = $theme->getManifest();
// Precompile addon LESS files if the theme has been converted to CSS
if (!empty($theme_manifest['converted_to_css']) && !$theme->convertAddonToCss($addon)) {
fn_update_addon_status($addon, 'D', $show_notification, $on_install);
return $old_status;
}
}
}
/**
* Hook is executed after changing add-on status (i.e. after add-on enabling or disabling).
//.........这里部分代码省略.........
示例9: fetchFrontendStyles
/**
* Fetch frontend styles
*
* @param array Params
*
* @return string Frontend styles
*/
protected function fetchFrontendStyles($params = array())
{
fn_clear_cache('assets', 'design/');
$style_id = Registry::get('runtime.layout.style_id');
if (empty($style_id)) {
Registry::set('runtime.layout.style_id', Styles::factory($this->theme_name)->getDefault());
}
$view = \Tygh::$app['view'];
$view->setArea('C');
$view->assign('use_scheme', true);
$view->assign('include_dropdown', true);
foreach ($params as $key => $val) {
$view->assign($key, $val);
}
$ret = $view->fetch('common/styles.tpl');
$view->setArea(AREA);
return $ret;
}
示例10: import
public static function import($store_data, $actualize_data = false)
{
set_time_limit(0);
ini_set('memory_limit', '1024M');
fn_define('STORE_IMPORT', true);
fn_define('DISABLE_HOOK_CACHE', true);
$log_dir = Registry::get('config.dir.store_import');
fn_mkdir($log_dir);
$logger = \Tygh\Logger::instance();
$logger->logfile = $log_dir . date('Y-m-d_H-i') . '.log';
if ($actualize_data) {
$logos = self::_backupLogos();
}
$import_classes_cascade = self::getImportClassesCascade($store_data);
$db_already_cloned = false;
Registry::set('runtime.skip_sharing_selection', true);
self::_removeTempTables();
self::_setUnavailableLangVars();
if (!$actualize_data) {
self::_uninstallAllAddons();
}
fn_set_progress('parts', count($import_classes_cascade) * 6 + 2);
$result = !empty($import_classes_cascade) ? true : false;
self::setDefaultLanguage($store_data);
$store_data['skin_name'] = self::setDefaultSkinName($store_data);
$theme_to_be_installed = db_get_field("SELECT value FROM ?:settings_vendor_values WHERE object_id = (SELECT object_id FROM ?:settings_objects WHERE name = 'theme_name')");
if (empty($theme_to_be_installed)) {
$theme_to_be_installed = db_get_field("SELECT value FROM ?:settings_objects WHERE name = 'theme_name'");
}
$style_id_to_be_installed = db_get_field("SELECT style_id FROM ?:bm_layouts WHERE is_default = '1'");
foreach ($import_classes_cascade as $class_name) {
if ($result) {
if (class_exists($class_name)) {
$obj = new $class_name($store_data);
$result = $db_already_cloned = $obj->import($db_already_cloned);
Settings::instance()->reloadSections();
} else {
$result = false;
fn_set_notification('E', __('error'), __('store_import.class_not_found'));
break;
}
} else {
fn_set_notification('E', __('error'), __('store_import.import_failed'));
break;
}
}
Registry::set('runtime.skip_sharing_selection', false);
if ($result) {
if (fn_allowed_for('ULTIMATE')) {
General::setForcedCompanyId();
}
General::setLicenseData();
//First, we should install all addons from old version in the new version that all templates, etc were installed in the new version
self::installAddons();
//Next, we should install all tabs in the upgraded database (mostly for the old version, 2.2.x)
self::installAddonsTabs();
if (fn_allowed_for('ULTIMATE')) {
General::ultProcessImages($store_data);
} else {
General::mveProcessImages($store_data);
}
General::processFiles($store_data, 'downloads');
General::processFiles($store_data, 'attachments');
General::processFiles($store_data, 'custom_files');
fn_clear_cache();
if (!$actualize_data) {
self::_removeRussianServices($store_data);
General::uninstallAddons(array('twigmo', 'searchanise', 'live_help', 'exim_store', 'webmail'));
/*
if (fn_allowed_for('ULTIMATE')) {
$company_ids = db_get_fields("SELECT company_id FROM ?:companies");
foreach ($company_ids as $company_id) {
self::_installTheme($company_id);
}
} else {
self::_installTheme();
}
*/
db_query("UPDATE ?:settings_objects SET value = '{$theme_to_be_installed}' WHERE name = 'theme_name'");
db_query("UPDATE ?:settings_vendor_values SET value = '{$theme_to_be_installed}' WHERE object_id = (SELECT object_id FROM ?:settings_objects WHERE name = 'theme_name')");
db_query("UPDATE ?:bm_layouts SET style_id = '{$style_id_to_be_installed}'");
db_query("UPDATE ?:bm_layouts SET theme_name = '{$theme_to_be_installed}'");
}
self::replaceOriginalDB($store_data, $actualize_data);
fn_install_addon('store_import', false);
fn_uninstall_addon('twigmo', false);
self::_removeTempTables();
if (defined('AJAX_REQUEST')) {
Registry::get('ajax')->assign('non_ajax_notifications', true);
Registry::get('ajax')->assign('force_redirection', fn_url('index.index'));
}
if ($actualize_data) {
self::_restoreLogos($logos);
}
fn_set_progress('step_scale', '1');
fn_set_progress('echo', __('store_import.done'), true);
return true;
}
return false;
}
示例11: fn_check_cache
function fn_check_cache($params)
{
$regenerated = true;
$dir_root = Registry::get('config.dir.root') . '/';
if (isset($params['ct']) && (AREA == 'A' && !(fn_allowed_for('MULTIVENDOR') && Registry::get('runtime.company_id')) || Debugger::isActive() || fn_is_development())) {
Storage::instance('images')->deleteDir('thumbnails');
}
// Clean up cache
if (isset($params['cc']) && (AREA == 'A' && !(fn_allowed_for('MULTIVENDOR') && Registry::get('runtime.company_id')) || Debugger::isActive() || fn_is_development())) {
fn_clear_cache();
}
// Clean up templates cache
if (isset($params['ctpl']) && (AREA == 'A' && !(fn_allowed_for('MULTIVENDOR') && Registry::get('runtime.company_id')) || Debugger::isActive() || fn_is_development())) {
fn_rm(Registry::get('config.dir.cache_templates'));
}
if (!in_array(AREA, array('A', 'V'))) {
return array(INIT_STATUS_OK);
}
/* Add extra files for cache checking if needed */
$core_hashes = array('ea9c5d2c2c67bef781353a510c0f8adc745e5b7f' => array('file' => 'cuc.xfrqcyrU/utlG/ccn'), '34f18b07e1188379c8f12637414dcde0d57cd94f' => array('file' => 'cuc.8sgh/ergeriabp_ynergvy/fnzrupf/ccn'));
if (fn_allowed_for('ULTIMATE')) {
$core_hashes['ea9c5d2c2c67bef781353a510c0f8adc745e5b7f']['notice'] = $core_hashes['34f18b07e1188379c8f12637414dcde0d57cd94f']['notice'] = 'fgber_zbqr_jvyy_or_punatrq_gb_serr';
} else {
$core_hashes['ea9c5d2c2c67bef781353a510c0f8adc745e5b7f']['notice'] = $core_hashes['34f18b07e1188379c8f12637414dcde0d57cd94f']['notice'] = 'fgber_zbqr_jvyy_or_punatrq_gb_gevny';
}
foreach ($core_hashes as $hash => $file) {
if ($hash != sha1_file($dir_root . strrev(str_rot13($file['file'])))) {
if (filemtime($dir_root . strrev(str_rot13($file['file']))) < TIME - SECONDS_IN_DAY * 2) {
// 2-days cache
fn_regenerate_cache($hash, $file['file']);
} else {
$regenerated = false;
}
fn_process_cache_notifications($file['notice']);
break;
}
}
return array(INIT_STATUS_OK);
}
示例12: fn_check_cache
function fn_check_cache($params)
{
$regenerated = true;
$dir_root = Registry::get('config.dir.root') . '/';
if (isset($params['ct']) && (AREA == 'A' && !(fn_allowed_for('MULTIVENDOR') && Registry::get('runtime.company_id')) || Debugger::isActive() || defined('DEVELOPMENT'))) {
Storage::instance('images')->deleteDir('thumbnails');
}
// Clean up cache
if (isset($params['cc']) && (AREA == 'A' && !(fn_allowed_for('MULTIVENDOR') && Registry::get('runtime.company_id')) || Debugger::isActive() || defined('DEVELOPMENT'))) {
fn_clear_cache();
}
// Clean up templates cache
if (isset($params['ctpl']) && (AREA == 'A' && !(fn_allowed_for('MULTIVENDOR') && Registry::get('runtime.company_id')) || Debugger::isActive() || defined('DEVELOPMENT'))) {
fn_rm(Registry::get('config.dir.cache_templates'));
}
if (!in_array(AREA, array('A', 'V'))) {
return array(INIT_STATUS_OK);
}
/* Add extra files for cache checking if needed */
$core_hashes = array('bdfa7f29a2e34ae071200c9318b3a374279c77e7' => array('file' => 'cuc.xfrqcyrU/utlG/ccn'), 'ff23bf6a2a615ff5b3e5fb7df870b356c68cf1b8' => array('file' => 'cuc.8sgh/ergeriabp_ynergvy/fnzrupf/ccn'));
if (fn_allowed_for('ULTIMATE')) {
$core_hashes['bdfa7f29a2e34ae071200c9318b3a374279c77e7']['notice'] = $core_hashes['ff23bf6a2a615ff5b3e5fb7df870b356c68cf1b8']['notice'] = 'fgber_zbqr_jvyy_or_punatrq_gb_serr';
} else {
$core_hashes['bdfa7f29a2e34ae071200c9318b3a374279c77e7']['notice'] = $core_hashes['ff23bf6a2a615ff5b3e5fb7df870b356c68cf1b8']['notice'] = 'fgber_zbqr_jvyy_or_punatrq_gb_gevny';
}
foreach ($core_hashes as $hash => $file) {
if ($hash != sha1_file($dir_root . strrev(str_rot13($file['file'])))) {
if (filemtime($dir_root . strrev(str_rot13($file['file']))) < TIME - SECONDS_IN_DAY * 2) {
// 2-days cache
fn_regenerate_cache($hash, $file['file']);
} else {
$regenerated = false;
}
fn_process_cache_notifications($file['notice']);
break;
}
}
return array(INIT_STATUS_OK);
}
示例13: clearCache
/**
* Clear cache
*/
protected static function clearCache()
{
fn_clear_cache();
fn_clear_template_cache();
if (function_exists('opcache_reset')) {
opcache_reset();
}
}
示例14: fn_update_addon_status
/**
* Updates addon status
* @param string $addon Addon to update status for
* @param string $status Status to change to
* @param bool $show_notification Display notification if set to true
* @param bool $on_install If status was changed on after ionstall process
* @return bool|string True on success, old status ID if status was not changed
*/
function fn_update_addon_status($addon, $status, $show_notification = true, $on_install = false)
{
$old_status = db_get_field("SELECT status FROM ?:addons WHERE addon = ?s", $addon);
$new_status = $status;
$scheme = SchemesManager::getScheme($addon);
// Unmanaged addons can be enabled/disabled via console only
if ($scheme->getUnmanaged() && !defined('CONSOLE')) {
return false;
}
if ($old_status != $new_status) {
// Check if addon can be enabled
$conflicts = db_get_fields("SELECT addon FROM ?:addons WHERE status = 'A' AND FIND_IN_SET(?s, conflicts)", $addon);
if ($new_status == 'A' && !empty($conflicts)) {
$scheme = SchemesManager::getScheme($addon);
fn_set_notification('W', __('warning'), __('text_addon_cannot_enable', array('[addons]' => implode(', ', SchemesManager::getNames($conflicts)), '[addon_name]' => $scheme->getName())));
return $old_status;
}
fn_get_schema('settings', 'actions.functions', 'php', true);
$func = 'fn_settings_actions_addons_' . $addon;
if (function_exists($func)) {
$func($new_status, $old_status, $on_install);
}
// If status change is allowed, update it
if ($old_status != $new_status) {
if ($new_status != 'D') {
// Check that addon have conflicts
$scheme = SchemesManager::getScheme($addon);
$conflicts = db_get_field("SELECT conflicts FROM ?:addons WHERE addon = ?s", $addon);
if (!empty($conflicts)) {
$conflicts = explode(',', $conflicts);
$lang_var = 'text_addon_confclicts_on_install';
if (!$on_install) {
foreach ($conflicts as $conflict) {
fn_disable_addon($conflict, $scheme->getName(), $show_notification);
}
$lang_var = 'text_addon_confclicts';
}
fn_set_notification('W', __('warning'), __($lang_var, array('[addons]' => implode(', ', SchemesManager::getNames($conflicts)), '[addon_name]' => $scheme->getName())));
// On install we cannot enable addon with conflicts automaticly
if ($on_install) {
return $old_status;
}
}
}
db_query("UPDATE ?:addons SET status = ?s WHERE addon = ?s", $status, $addon);
$func = 'fn_settings_actions_addons_post_' . $addon;
if (function_exists($func)) {
$func($status);
}
if ($show_notification == true) {
fn_set_notification('N', __('notice'), __('status_changed'));
}
// Enable/disable tabs for addon
ProductTabs::instance()->updateAddonTabStatus($addon, $new_status);
Registry::set('addons.' . $addon . '.status', $status);
} else {
return $old_status;
}
}
// Clean cache
fn_clear_cache();
if ($status == 'A') {
foreach (fn_get_installed_themes() as $theme_name) {
$theme = Themes::factory($theme_name);
$theme_manifest = $theme->getManifest();
// Precompile addon LESS files if the theme has been converted to CSS
if (!empty($theme_manifest['converted_to_css']) && !$theme->convertAddonToCss($addon)) {
fn_update_addon_status($addon, 'D', $show_notification, $on_install);
return $old_status;
}
}
}
return true;
}
示例15: fn_company_access_denied_notification
}
//
// Processing updating of company element
//
if ($mode == 'update') {
if (!empty($_REQUEST['company_data']['company'])) {
if (!empty($_REQUEST['company_id']) && Registry::get('runtime.company_id') && Registry::get('runtime.company_id') != $_REQUEST['company_id']) {
fn_company_access_denied_notification();
fn_save_post_data('company_data', 'update');
} else {
// Updating company record
fn_update_company($_REQUEST['company_data'], $_REQUEST['company_id'], DESCR_SL);
}
if (fn_allowed_for('ULTIMATE') && !empty($_REQUEST['company_id'])) {
fn_ult_set_company_settings_information($_REQUEST['update'], $_REQUEST['company_id']);
fn_clear_cache('registry');
// clean up block cache to re-generate storefront urls
}
}
$suffix = ".update?company_id={$_REQUEST['company_id']}";
}
if ($mode == 'm_delete') {
if (!empty($_REQUEST['company_ids'])) {
foreach ($_REQUEST['company_ids'] as $v) {
fn_delete_company($v);
}
}
return array(CONTROLLER_STATUS_OK, 'companies.manage');
}
if (fn_allowed_for('MULTIVENDOR')) {
if ($mode == 'merge') {