0
我試圖在管理頁面的某些CRUD操作期間刪除seo_pro
緩存文件,其中$this->cache->delete('seo_pro')
。但它不起作用。如何刪除seo_pro緩存
例子:
public function addCategory($data) {
$this->event->trigger('pre.admin.category.add', $data);
$this->db->query("INSERT INTO " . DB_PREFIX . "category SET parent_id = '" . (int)$data['parent_id'] . "', `top` = '" . (isset($data['top']) ? (int)$data['top'] : 0) . "', `column` = '" . (int)$data['column'] . "', sort_order = '" . (int)$data['sort_order'] . "', status = '" . (int)$data['status'] . "', date_modified = NOW(), date_added = NOW()");
$category_id = $this->db->getLastId();
if (isset($data['image'])) {
$this->db->query("UPDATE " . DB_PREFIX . "category SET image = '" . $this->db->escape($data['image']) . "' WHERE category_id = '" . (int)$category_id . "'");
}
foreach ($data['category_description'] as $language_id => $value) {
$this->db->query("INSERT INTO " . DB_PREFIX . "category_description SET category_id = '" . (int)$category_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "', description = '" . $this->db->escape($value['description']) . "', meta_title = '" . $this->db->escape($value['meta_title']) . "', meta_h1 = '" . $this->db->escape($value['meta_h1']) . "', meta_description = '" . $this->db->escape($value['meta_description']) . "', meta_keyword = '" . $this->db->escape($value['meta_keyword']) . "'");
}
// MySQL Hierarchical Data Closure Table Pattern
$level = 0;
$query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "category_path` WHERE category_id = '" . (int)$data['parent_id'] . "' ORDER BY `level` ASC");
foreach ($query->rows as $result) {
$this->db->query("INSERT INTO `" . DB_PREFIX . "category_path` SET `category_id` = '" . (int)$category_id . "', `path_id` = '" . (int)$result['path_id'] . "', `level` = '" . (int)$level . "'");
$level++;
}
$this->db->query("INSERT INTO `" . DB_PREFIX . "category_path` SET `category_id` = '" . (int)$category_id . "', `path_id` = '" . (int)$category_id . "', `level` = '" . (int)$level . "'");
if (isset($data['category_filter'])) {
foreach ($data['category_filter'] as $filter_id) {
$this->db->query("INSERT INTO " . DB_PREFIX . "category_filter SET category_id = '" . (int)$category_id . "', filter_id = '" . (int)$filter_id . "'");
}
}
if (isset($data['category_store'])) {
foreach ($data['category_store'] as $store_id) {
$this->db->query("INSERT INTO " . DB_PREFIX . "category_to_store SET category_id = '" . (int)$category_id . "', store_id = '" . (int)$store_id . "'");
}
}
// Set which layout to use with this category
if (isset($data['category_layout'])) {
foreach ($data['category_layout'] as $store_id => $layout_id) {
$this->db->query("INSERT INTO " . DB_PREFIX . "category_to_layout SET category_id = '" . (int)$category_id . "', store_id = '" . (int)$store_id . "', layout_id = '" . (int)$layout_id . "'");
}
}
if (isset($data['keyword'])) {
$this->db->query("INSERT INTO " . DB_PREFIX . "url_alias SET query = 'category_id=" . (int)$category_id . "', keyword = '" . $this->db->escape($data['keyword']) . "'");
}
$this->cache->delete('seo_pro');
$this->cache->delete('category');
$this->event->trigger('post.admin.category.add', $category_id);
return $category_id;
}
一個有趣的事情 - $this->cache->delete('category')
完美的作品。
我對你使用的工具一無所知,但是所有代碼都與問題相關嗎?總是嘗試發佈[MVCE](http://stackoverflow.com/help/mcve)。 – Stijn