/** * Standard aed_module delete actualiser. * * @param ID_TEXT The entry being deleted */ function delete_actualisation($id) { require_code('catalogues2'); $catalogue_name = $GLOBALS['SITE_DB']->query_value_null_ok('catalogue_categories', 'c_name', array('id' => $id)); if (is_null($catalogue_name)) { warn_exit(do_lang_tempcode('MISSING_RESOURCE')); } actual_delete_catalogue_category(intval($id)); $this->donext_catalogue_name = $catalogue_name; }
function tearDown() { actual_delete_catalogue_category($this->cat_id, false); parent::tearDown(); }
/** * Delete a catalogue. * * @param ID_TEXT The name of the catalogue */ function actual_delete_catalogue($name) { // Delete lang $rows = $GLOBALS['SITE_DB']->query_select('catalogues', array('c_description', 'c_title'), array('c_name' => $name), '', 1); if (!array_key_exists(0, $rows)) { warn_exit(do_lang_tempcode('MISSING_RESOURCE')); } $myrow = $rows[0]; // Delete anything involved (ha ha destruction!) if (function_exists('set_time_limit')) { @set_time_limit(0); } do { $entries = collapse_1d_complexity('id', $GLOBALS['SITE_DB']->query_select('catalogue_entries', array('id'), array('c_name' => $name), '', 500)); foreach ($entries as $entry) { actual_delete_catalogue_entry($entry); } } while (array_key_exists(0, $entries)); do { $categories = collapse_1d_complexity('id', $GLOBALS['SITE_DB']->query_select('catalogue_categories', array('id'), array('c_name' => $name), '', 30)); foreach ($categories as $category) { actual_delete_catalogue_category($category, true); } } while (array_key_exists(0, $categories)); $fields = collapse_1d_complexity('id', $GLOBALS['SITE_DB']->query_select('catalogue_fields', array('id'), array('c_name' => $name))); foreach ($fields as $field) { actual_delete_catalogue_field($field); } $GLOBALS['SITE_DB']->query_delete('catalogues', array('c_name' => $name), '', 1); delete_lang($myrow['c_title']); delete_lang($myrow['c_description']); $GLOBALS['SITE_DB']->query_delete('group_category_access', array('module_the_name' => 'catalogues_catalogue', 'category_name' => $name)); $GLOBALS['SITE_DB']->query_delete('gsp', array('module_the_name' => 'catalogues_catalogue', 'category_name' => $name)); log_it('DELETE_CATALOGUE', $name); }