diff options
-rw-r--r-- | import.ebuild_mask.php | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/import.ebuild_mask.php b/import.ebuild_mask.php index c94309c..3e9373c 100644 --- a/import.ebuild_mask.php +++ b/import.ebuild_mask.php @@ -1,6 +1,7 @@ <? $verbose = true; + $debug = true; $qa = true; @@ -14,31 +15,32 @@ $sql = "DELETE FROM ebuild_mask;"; $db->query($sql); - // Delete the old masks -// $sql = "DELETE FROM ebuild_mask;"; -// $db->query($sql); + if($debug) + $str_status = "0,1"; + else + $str_status = "1"; // Insert entries where the entire package is masked - $sql = "INSERT INTO ebuild_mask SELECT pm.id, e.id FROM ebuild e INNER JOIN package p ON e.package = p.id INNER JOIN package_mask pm ON pm.package = e.package WHERE e.status = 2 AND pm.pvr = '' AND lt = FALSE AND gt = FALSE AND eq = FALSE AND ar = FALSE AND av = FALSE;"; - $db->query($sql); + $sql = "INSERT INTO ebuild_mask SELECT pm.id, e.id FROM ebuild e INNER JOIN package p ON e.package = p.id INNER JOIN package_mask pm ON pm.package = e.package WHERE e.status IN($str_status) AND pm.pvr = '' AND lt = FALSE AND gt = FALSE AND eq = FALSE AND ar = FALSE AND av = FALSE;"; + $db->query($sql); // Insert entries where it's an exact package and version - $sql = "INSERT INTO ebuild_mask SELECT pm.id, e.id FROM ebuild e INNER JOIN package p ON e.package = p.id INNER JOIN package_mask pm ON pm.package = e.package WHERE e.status = 2 AND pm.pvr = e.pvr AND lt = FALSE AND gt = FALSE AND eq = TRUE AND ar = FALSE AND av = FALSE;"; - $db->query($sql); + $sql = "INSERT INTO ebuild_mask SELECT pm.id, e.id FROM ebuild e INNER JOIN package p ON e.package = p.id INNER JOIN package_mask pm ON pm.package = e.package WHERE e.status IN($str_status) AND pm.pvr = e.pvr AND lt = FALSE AND gt = FALSE AND eq = TRUE AND ar = FALSE AND av = FALSE;"; + $db->query($sql); // Insert entries where atom is like: // =media-video/mplayer-1.0* // Specifically IGNORE gt and lt - $sql = "INSERT INTO ebuild_mask SELECT pm.id, e.id FROM ebuild e INNER JOIN package p ON e.package = p.id INNER JOIN package_mask pm ON pm.package = e.package WHERE e.status = 2 AND e.pvr LIKE (pm.pvr || '%') AND eq = TRUE AND ar = FALSE AND av = TRUE;"; + $sql = "INSERT INTO ebuild_mask SELECT pm.id, e.id FROM ebuild e INNER JOIN package p ON e.package = p.id INNER JOIN package_mask pm ON pm.package = e.package WHERE e.status IN($str_status) AND e.pvr LIKE (pm.pvr || '%') AND eq = TRUE AND ar = FALSE AND av = TRUE;"; $db->query($sql); // Insert entries where atom is like: // ~media-video/mplayer-1.0 - $sql = "INSERT INTO ebuild_mask SELECT pm.id, e.id FROM ebuild e INNER JOIN package p ON e.package = p.id INNER JOIN package_mask pm ON pm.package = e.package WHERE e.status = 2 AND pm.pvr = e.version AND lt = FALSE AND gt = FALSE AND eq = FALSE AND ar = TRUE AND av = FALSE;"; + $sql = "INSERT INTO ebuild_mask SELECT pm.id, e.id FROM ebuild e INNER JOIN package p ON e.package = p.id INNER JOIN package_mask pm ON pm.package = e.package WHERE e.status IN($str_status) AND pm.pvr = e.version AND lt = FALSE AND gt = FALSE AND eq = FALSE AND ar = TRUE AND av = FALSE;"; $db->query($sql); - - $sql = "SELECT pm.id AS pm_id, pm.package, pm.atom, pm.version AS pm_version, pm.gt, pm.lt, pm.eq, pl.level AS pm_level, e.version AS ebuild_version, el.level AS ebuild_level, e.id AS ebuild FROM package_mask pm INNER JOIN view_pmask_level pl ON pl.id = pm.id INNER JOIN ebuild e ON e.package = pm.package INNER JOIN view_ebuild_level el ON el.id = e.id WHERE e.status = 2 AND pm.gt = TRUE OR pm.lt = TRUE ORDER BY pm.gt, pm.eq, pm.package;"; + // All others + $sql = "SELECT pm.id AS pm_id, pm.package, pm.atom, pm.version AS pm_version, pm.gt, pm.lt, pm.eq, pl.level AS pm_level, e.version AS ebuild_version, el.level AS ebuild_level, e.id AS ebuild FROM package_mask pm INNER JOIN view_pmask_level pl ON pl.id = pm.id INNER JOIN ebuild e ON e.package = pm.package INNER JOIN view_ebuild_level el ON el.id = e.id WHERE e.status IN($str_status) AND pm.gt = TRUE OR pm.lt = TRUE ORDER BY pm.gt, pm.eq, pm.package;"; // shell::msg($sql); $arr = $db->getAll($sql); |