Skip to content

Commit

Permalink
Properly truncate the taxonomy table in com_finder
Browse files Browse the repository at this point in the history
  • Loading branch information
Hackwar committed Jun 30, 2018
1 parent 9c86ac8 commit ba0bada
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions administrator/components/com_finder/Model/IndexModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -350,12 +350,10 @@ public function purge()
// Truncate the taxonomy map table.
$db->truncateTable('#__finder_taxonomy_map');

// Delete all the taxonomy nodes except the root.
$query = $db->getQuery(true)
->delete($db->quoteName('#__finder_taxonomy'))
->where($db->quoteName('id') . ' > 1');
$db->setQuery($query);
$db->execute();
// Truncate the taxonomy table and insert the root node.
$db->truncateTable('#__finder_taxonomy');
$root = (object) array('id' => 1, 'parent_id' => 0, 'title' => 'ROOT', 'state' => 0, 'access' => 0, 'ordering' => 0);
$db->insertObject('#__finder_taxonomy', $root);

// Truncate the tokens tables.
$db->truncateTable('#__finder_tokens');
Expand Down

0 comments on commit ba0bada

Please sign in to comment.