summaryrefslogtreecommitdiff
blob: a40769522099e9a5b44878c593c185e2fc497f78 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?

	require_once 'header.php';
	
	// Reset packages that were updated
	$sql = "UPDATE package SET status = 0 WHERE status = 1;";
	$db->query($sql);
	
	// Set those that were gonna be updated to be live
	$sql = "UPDATE ebuild SET status = 0 WHERE status = 1;";
	$db->query($sql);
	
	// Delete the ones flagged for removal
 	$sql = "DELETE FROM ebuild WHERE status IN(2,3);";
 	$db->query($sql);
	
	// Same for bugs
	$sql = "SELECT COUNT(1) FROM package_bugs WHERE status = 1;";
	$count = $db->getOne($sql);
	
	if($count) {
		$sql = "DELETE FROM package_bugs WHERE status = 0;";
		$db->query($sql);
		
		$sql = "UPDATE package_bugs SET status = 0 WHERE status = 1;";
		$db->query($sql);
	}
	
	// Check for package_recent replacements
	$sql = "SELECT COUNT(1) FROM package_recent WHERE status = 1;";
	$count = $db->getOne($sql);
	
	if($count) {
		$sql = "DELETE FROM package_recent WHERE status = 0;";
		$db->query($sql);
		
		$sql = "UPDATE package_recent SET status = 0 WHERE status = 1;";
		$db->query($sql);
	}
	
	// Check for package_mask replacements
	$sql = "SELECT COUNT(1) FROM package_mask WHERE status = 1;";
	$count = $db->getOne($sql);
	
	if($count) {
		// Foreign key will remove any ebuild_mask entries as well
		$sql = "DELETE FROM package_mask WHERE status = 0;";
		$db->query($sql);
		
		$sql = "UPDATE package_mask SET status = 0 WHERE status = 1;";
		$db->query($sql);
		
		$sql = "UPDATE ebuild_mask SET status = 0 WHERE status = 1;";
		$db->query($sql);
	}
 	
	
?>