2 $monLibrary= dirname(__FILE__) .
"/../library";
3 require_once(
"$monLibrary/cu_top.i");
4 require_once(
"$monLibrary/ck_hticket.i");
6 if (!CheckPerm($link, $Hu, basename($_SERVER[
'SCRIPT_NAME']), $_SERVER[
'REMOTE_ADDR'])) {
9 header(
"Location: /hcuadm/hcu_noperm.prg");
13 $dms_ok=array(
'cuhome'=>
'string',
'cu'=>
'string',
'nounpack'=>
'digits',
'delhist'=>
'digits',
'skipbal'=>
'digits',
'truncate'=>
'digits',
'RestartCU'=>
'string');
17 function no_dupes($estring) {
18 foreach (explode(
";",$estring) as $x => $ema) {
20 if ($ema !=
"" && (strpos(
"$return",
"$ema") ===
false)) {
28 function Check_Lock_Status($pFile_to_Check) {
32 $upl_in_process =
false;
34 $ret_fuser = exec(
"/bin/fuser " . escapeshellcmd($pFile_to_Check));
35 if ($ret_fuser !=
false) {
36 $upl_in_process =
true;
38 return $upl_in_process;
43 cu_header(
'Upload Restart');
46 $upl_in_process =
false;
52 $sql =
"select cu, user_name from cuadmin where cu = '" . strtoupper($cu) .
"'";
54 $sth = db_query($sql, $dbh);
56 $row = db_fetch_array($sth);
57 $row[
'cu'] = trim($row[
'cu']);
58 $row[
'user_name'] = trim($row[
'user_name']);
60 $cuhome =
"/home/" . $row[
'user_name'];
67 <table width=
"80%" border=0 cellpadding=3 cellspacing=0
class=
"dmsbg"><tr><td>
68 <table width=
"100%" border=0 cellpadding=2 cellspacing=0 bgcolor=white>
69 <tr><td colspan=1
class=
"bar" align=
"center">
70 Problem Accessing Credit Union</td>
72 <tr><td
class=
'dtlc'><span style=
"font-size: 12pt;color: #990000;">An error was encountered. The Credit Union upload was NOT restarted. Please
try again by
using the
'Upload Restart' link on the left.</span></td>
84 $txt_path_file =
"{$cuhome}/public_html/status.txt";
87 $upl_in_process = Check_Lock_Status($txt_path_file);
89 if ($upl_in_process) {
97 <table width=
"80%" border=0 cellpadding=3 cellspacing=0
class=
"dmsbg"><tr><td>
98 <table width=
"100%" border=0 cellpadding=2 cellspacing=0 bgcolor=white>
99 <tr><td colspan=1
class=
"bar" align=
"center">
100 Upload Already Restarted</td>
102 <tr><td
class=
'dtlc'><span style=
"font-size: 12pt;color: #990000;">The upload for <?php echo $cu; ?> is currently being processed. Please check back later.</span></td>
112 if (isset($RestartCU)) {
119 if (isset($nounpack)) {
122 if (isset($delhist)) {
125 if (isset($skipbal)) {
128 if (isset($truncate)) {
131 $cmdopt = ($cmdopt==
"-" ?
"" : $cmdopt);
133 $cuhome = escapeshellcmd($cuhome);
134 $command =
"mv $cuhome/public_html/status.old.txt $cuhome/public_html/status.older.txt";
136 $command =
"mv $cuhome/public_html/status.txt $cuhome/public_html/status.old.txt";
141 $sql =
"SELECT role, email 143 WHERE cu = '" . strtoupper($cu) .
"' 144 AND role in ('upload', 'alert') ";
145 $em_rs = db_query($sql, $dbh);
146 for ($row=0; $em_row = db_fetch_array($em_rs,$row); $row++) {
147 $role = trim($em_row[
'role']);
148 $$role = trim($em_row[
'email']);
150 db_free_result($em_rs);
152 putenv(
"ADMUSER=HCUrestart");
153 if (
"$upload" !=
"" ) { putenv(
"ADMMAIL=$upload"); }
154 if (
"$alert" !=
"" ) { putenv(
"ALERTMAIL=$alert"); }
157 $sql =
"SELECT liveserver 159 WHERE cu = '" . strtoupper($cu) .
"'";
161 $em_rs = db_query($sql, $dbh);
162 list($pgloadcmd) = db_fetch_array($em_rs, 0);
163 db_free_result($em_rs);
164 if (trim($pgloadcmd) ==
'') {
165 $pgloadcmd =
"/usr/local/bin/pgload.pl -h $cuhome ";
167 $command = (escapeshellcmd(
"$pgloadcmd $cmdopt") .
" >" . escapeshellcmd(
"$cuhome/public_html/status.txt") .
" 2>&1 &");
175 <table width=
"80%" border=0 cellpadding=3 cellspacing=0
class=
"dmsbg"><tr><td>
176 <table width=
"100%" border=0 cellpadding=2 cellspacing=0 bgcolor=white>
177 <tr><td colspan=2
class=
"bar" align=
"center">
178 Upload Restarted</td>
180 <tr><td width=
"30%" class=
"hdr">Credit Union:</td>
181 <td width=
"70%" class=
'dtl'><?php echo $cu; ?></td>
182 <tr><td width=
"30%" class=
"hdr">Command:</td>
183 <td width=
"70%" class=
'dtl'><?php echo $command; ?></td>
208 <form action=
"<?php echo $_SERVER['PHP_SELF']?>" method=
"POST">
209 <table width=
"80%" border=0 cellpadding=3 cellspacing=0
class=
"dmsbg"><tr><td>
210 <table width=
"100%" border=0 cellpadding=2 cellspacing=0 bgcolor=white>
211 <tr><td colspan=2
class=
"bar" align=
"center">
214 <tr><td width=
"30%" class=
"hdr">Credit Union:</td>
215 <td width=
"70%" class=
'dtl'><?php echo $cu?></td>
218 <tr><td width=
"30%" class=
"hdr">Home Directory:</td>
219 <td width=
"70%" class=
'dtl'><?php echo $cuhome?></td>
221 <tr><td width=
"30%" class=
"hdr">Upload Options:</td>
222 <td width=
"70%" class=
'dtl'>
224 <input type=checkbox name=
"nounpack" 225 checked value=
"1">Skip Unpack (recommended)<br>
226 <input type=checkbox name=
"skipbal" 227 checked value=
"1">Skip Loading Balance Files<br>
228 <input type=checkbox name=
"delhist" 229 value=
"1">Delete History Prior to Inserting<br>
230 <input type=checkbox name=
"truncate" 231 value=
"1">Truncate History Files<br>
233 <form action=
"<?php echo $_SERVER['PHP_SELF']?>" method=
"POST">
234 <input type=
"hidden" name=
"cu" value=
"<?php echo $cu?>">
235 <input type=
"hidden" name=
"cuhome" value=
"<?php echo $cuhome?>">
236 <input type=
"submit" name=
"RestartCU" value=
"GO">