View | Details | Raw Unified | Return to bug 254429
Collapse All | Expand All

(-)classes/file/file.class.php (-2 / +2 lines)
Lines 47-53 Link Here
47
							version		= " . $App->returnQuotedString($App->sqlSanitize($this->version, $dbh)) . ", 
47
							version		= " . $App->returnQuotedString($App->sqlSanitize($this->version, $dbh)) . ", 
48
							name		= " . $App->returnQuotedString($App->sqlSanitize($this->name, $dbh)) . ",
48
							name		= " . $App->returnQuotedString($App->sqlSanitize($this->name, $dbh)) . ",
49
							plugin_id	= " . $App->returnQuotedString($App->sqlSanitize($this->plugin_id, $dbh)) . ",
49
							plugin_id	= " . $App->returnQuotedString($App->sqlSanitize($this->plugin_id, $dbh)) . ",
50
							is_active	= 1" . $where;
50
							is_active	= " . $this->isActive . $where;
51
			if(mysql_query($sql, $dbh)) {
51
			if(mysql_query($sql, $dbh)) {
52
				if($this->file_id == 0) {
52
				if($this->file_id == 0) {
53
					$this->file_id = mysql_insert_id($dbh);
53
					$this->file_id = mysql_insert_id($dbh);
Lines 68-74 Link Here
68
	}
68
	}
69
	
69
	
70
	function getFileID($_name, $_project_id, $_version) {
70
	function getFileID($_name, $_project_id, $_version) {
71
		$rValue = 0;
71
		$rValue = -1;
72
		if($this->name != "" && $this->project_id != "" && $_version != "") {
72
		if($this->name != "" && $this->project_id != "" && $_version != "") {
73
			global $App, $dbh;
73
			global $App, $dbh;
74
74
(-)html/process_map_files.php (-5 / +36 lines)
Lines 33-38 Link Here
33
chdir("/tmp/tmp-babel")  || die("Cannot use working directory");
33
chdir("/tmp/tmp-babel")  || die("Cannot use working directory");
34
34
35
35
36
$files = array();
37
$sql = "SELECT * from files";
38
$rs_files = mysql_query($sql, $dbh);
39
while($myrow_file = mysql_fetch_assoc($rs_files)) {
40
	$File = new File();
41
	$File->project_id 	= $myrow_file['project_id'];
42
	$File->version		= $myrow_file['version'];
43
	$File->name 		= $myrow_file['name'];
44
	$File->plugin_id	= $myrow_file['plugin_id'];
45
	$File->file_id      = $myrow_file['file_id'];
46
	$files[$File->file_id] = $File;
47
}
36
48
37
49
38
$sql = "SELECT * FROM map_files WHERE is_active = 1 ORDER BY RAND()";
50
$sql = "SELECT * FROM map_files WHERE is_active = 1 ORDER BY RAND()";
Lines 40-45 Link Here
40
while($myrow_maps = mysql_fetch_assoc($rs_maps)) {
52
while($myrow_maps = mysql_fetch_assoc($rs_maps)) {
41
	echo "Processing map file: " . $myrow_maps['filename'] . " in location: " . $myrow_maps['location'] . "\n";
53
	echo "Processing map file: " . $myrow_maps['filename'] . " in location: " . $myrow_maps['location'] . "\n";
42
	
54
	
55
	
43
	$tmpdir = "/tmp/tmp-babel/" . $myrow_maps['project_id'];
56
	$tmpdir = "/tmp/tmp-babel/" . $myrow_maps['project_id'];
44
	if(is_dir($tmpdir)) {
57
	if(is_dir($tmpdir)) {
45
		# zap the directory to make sure CVS versions don't overlap
58
		# zap the directory to make sure CVS versions don't overlap
Lines 109-119 Link Here
109
						$file_name = trim(substr($out_line, 2)); 
122
						$file_name = trim(substr($out_line, 2)); 
110
						echo $html_spacer . $html_spacer . $html_spacer . "Processing .properties file: " . $file_name . "\n";
123
						echo $html_spacer . $html_spacer . $html_spacer . "Processing .properties file: " . $file_name . "\n";
111
						
124
						
112
						$File = new File();
125
						$file_id = File->getFileID($file_name, $myrow_maps['project_id'], $myrow_maps['version']);
113
						$File->project_id 	= $myrow_maps['project_id'];
126
						
114
						$File->version		= $myrow_maps['version'];
127
						if ($files[$file_id] != null) {
115
						$File->name 		= $file_name;
128
							$File = $files[$file_id];
116
						$File->plugin_id	= $plugin_id;
129
							$File->isActive = 1;
130
							unset($files[$file_id]);
131
						} else {
132
							$File = new File();
133
							$File->project_id 	= $myrow_maps['project_id'];
134
							$File->version		= $myrow_maps['version'];
135
							$File->name 		= $file_name;
136
							$File->plugin_id	= $plugin_id;
137
							$File->isActive     = 1;
138
						}
117
						if(!$File->save()) {
139
						if(!$File->save()) {
118
							echo $html_spacer . $html_spacer . $html_spacer . $html_spacer . "***ERROR saving file: " . $file_name . "\n";
140
							echo $html_spacer . $html_spacer . $html_spacer . $html_spacer . "***ERROR saving file: " . $file_name . "\n";
119
						}
141
						}
Lines 135-140 Link Here
135
		}
157
		}
136
	}
158
	}
137
}
159
}
160
echo "Marking the remaining files as inactive\n";
161
162
foreach ($files as $file) {
163
	$file->isActive = 0;
164
	if(!$file->save()) {
165
		echo $html_spacer . $html_spacer . $html_spacer . $html_spacer . "***ERROR saving file: " . $file->name . "\n";
166
	}
167
}
168
138
echo "Done.";
169
echo "Done.";
139
170
140
if($headless) {
171
if($headless) {

Return to bug 254429