File: tools_data_cleanup.php

package info (click to toggle)
fusionforge 5.3.2%2B20141104-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 60,472 kB
  • sloc: php: 271,846; sql: 36,817; python: 14,575; perl: 6,406; sh: 5,980; xml: 4,294; pascal: 1,411; makefile: 911; cpp: 52; awk: 27
file content (43 lines) | stat: -rw-r--r-- 891 bytes parent folder | download | duplicates (4)
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
<?php

/*
 *  Due to bug in code, patch and support req close date wasn't
 *  set properly before 2000-11-16. This script is to fix it (kinda).
 *
 */

require_once $gfcommon.'include/pre.php';

if (!strstr($REMOTE_ADDR,$sys_internal_network)) {
        exit_permission_denied();
}

echo "Patching patches<br />";

# If some patch is not opened, set its close date one month after open
$res=db_query_params ('
UPDATE patch
SET close_date=open_date+60*60*24*30
WHERE close_date=0 AND patch_status_id NOT IN (0,1)
',
			array());

if (!$res) print "error<br />";

echo "Affected rows: ",db_affected_rows($res),"<br />";




echo "Patching sup reqs<br />";

$res=db_query_params ('
UPDATE support
SET close_date=open_date+60*60*24*30
WHERE close_date=0 AND support_status_id NOT IN (0,1)
',
			array());

if (!$res) print "error<br />";

echo "Affected rows: ",db_affected_rows($res),"<br />";