File: upgrade_forum_data.php

package info (click to toggle)
gforge 3.1-31sarge5
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 9,148 kB
  • ctags: 11,865
  • sloc: sql: 27,860; php: 25,574; perl: 7,124; xml: 3,152; sh: 2,586; ansic: 315; makefile: 143
file content (54 lines) | stat: -rw-r--r-- 1,146 bytes parent folder | download
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
<?php
//
// SourceForge: Breaking Down the Barriers to Open Source Development
// Copyright 1999-2000 (c) The SourceForge Crew
// http://sourceforge.net
//
// $Id: upgrade_forum_data.php,v 1.1.1.1 2001/08/13 14:25:01 cbayle Exp $

exit;

/*

	One time use script

	calculates and updates the has_followups flag in the forums

*/

require ('pre.php');    

session_require(array('group'=>'1','admin_flags'=>'A'));

//get all the tasks
$result=db_query("SELECT msg_id FROM forum ORDER BY msg_id ASC",10000,$z);
$rows=db_numrows($result);
echo db_error();
echo "\nRows: $rows\n";
flush();

for ($i=0; $i<$rows; $i++) {

	//echo "\n".db_result($result,$i,'msg_id')."\n";

	/*
		//insert a default bug dependency
	*/

	$res2=db_query("SELECT count(*) FROM forum WHERE is_followup_to='". db_result($result,$i,'msg_id') ."'");
	$rows2=db_numrows($res2);
	if (db_result($res2,0,0) < 1) {
		// don't do anything
		$counter2++;
		//echo db_error();
	} else {
		$counter++;
		db_query ("UPDATE forum SET has_followups='1' WHERE msg_id='". db_result($result,$i,'msg_id') ."'");
	}
}

echo "\n\nUpdated: $counter";
echo "\n\nSkipped: $counter2";
flush();

?>