function taxonomy_delete_permanently($id) { $hmdb = new MySQL(true, DB_NAME, DB_HOST, DB_USER, DB_PASSWORD, DB_CHARSET); hook_action('taxonomy_delete_permanently'); if (isset_taxonomy_id($id) == TRUE) { $tableName = DB_PREFIX . "taxonomy"; /* update lại parent các sub taxonomy */ $valuesArray = array('parent' => MySQL::SQLValue(0)); $whereArray = array('parent' => MySQL::SQLValue($id)); $hmdb->UpdateRows($tableName, $valuesArray, $whereArray); /* xóa bảng taxonomy */ $whereArray = array('id' => MySQL::SQLValue($id)); $hmdb->DeleteRows($tableName, $whereArray); /* xóa bảng field */ $tableName = DB_PREFIX . "field"; $whereArray = array('object_id' => MySQL::SQLValue($id), 'object_type' => MySQL::SQLValue('taxonomy')); $hmdb->DeleteRows($tableName, $whereArray); /* xóa bảng relationship */ $tableName = DB_PREFIX . "relationship"; $whereArray = array('object_id' => MySQL::SQLValue($id)); $hmdb->DeleteRows($tableName, $whereArray); /* xóa bảng request uri */ $tableName = DB_PREFIX . "request_uri"; $whereArray = array('object_id' => MySQL::SQLValue($id), 'object_type' => MySQL::SQLValue('taxonomy')); $hmdb->DeleteRows($tableName, $whereArray); } }
/** Update các field của 1 taxonomy */ public function taxonomy_update_val($args = array()) { $id = $args['id']; $values = $args['value']; if (isset_taxonomy_id($id)) { $tableName = DB_PREFIX . 'taxonomy'; $whereArray = array('id' => $id); return $this->UpdateRows($tableName, $values, $whereArray); } }