Skip to content

Commit

Permalink
Adds removal of duplicates from sectionref table in repair method/upg…
Browse files Browse the repository at this point in the history
…rade script [#1115 state:resolved]

(cherry picked from commit 4e701bf)
  • Loading branch information
dleffler committed Nov 28, 2013
1 parent c794346 commit e074a0c
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1074,6 +1074,7 @@ public static function checkPermissions($permission,$location) {
* Rebuild the sectionref table as a list of modules on a page
*/
public static function rebuild_sectionrefs() {
global $db;

function scan_container($container_id, $page_id) {
global $db;
Expand Down Expand Up @@ -1104,6 +1105,7 @@ function scan_page($parent_id) {
return $ret;
}

$db->sql('DELETE FROM ' . DB_TABLE_PREFIX . '_sectionref WHERE id NOT IN (SELECT * FROM (SELECT MIN(n.id) FROM ' . DB_TABLE_PREFIX . '_sectionref n GROUP BY n.module, n.source) x)');
$ret = scan_page(0); // the page hierarchy
$ret .= scan_page(-1); // now the stand alone pages
return $ret;
Expand Down

0 comments on commit e074a0c

Please sign in to comment.