/** * Save the print buffer (should starts with {@link loadCache()}) into HTMLCache as cache content. * if there isn't cache content yet. * * This work unless {@link isExportRequest()} is true. * */ function saveToCache($StartTime=0) { if (isExportRequest()) return false; //when a export request (e.g. download csv) fire from dbnavigator, the cache should never be active! $url=$_SERVER['SERVER_PORT'].$_SERVER['REQUEST_URI']; $url=str_replace("&buildcache=","",$url); if ($StartTime==0) $Seconds=-1; else $Seconds=time()-$StartTime; $result=mysql_query("SELECT * FROM HTMLCache WHERE url=\"{$url}\" "); if (mysql_num_rows($result)==0) //page not in cache { $Q="INSERT INTO HTMLCache(date,url,html,Seconds,Fresh) VALUES ('".date("Y-m-d")."' ,\"{$url}\" ,\"".addslashes(ob_get_contents())."\" ,{$Seconds}, 'y')"; } else { $row=mysql_fetch_array($result,MYSQL_ASSOC); //update is performed by automatic cache loading...don't update accesses and last access date! $Q="UPDATE HTMLCache SET html=\"".addslashes(ob_get_contents())."\" ,Seconds={$Seconds} ,Fresh='Y' ,LastUpd='".$row[LastUpd]."' WHERE url=\"{$url}\" "; } mysql_query("SET GLOBAL max_allowed_packet=1000000000"); //echo $Q; if (!mysql_query($Q)) { $err="ERROR in INSERT/UPDATE CACHE: {$url}----".$Q."<br /><br />".mysql_error(); print($err); ResultMail("ERROR - saveToCache",$err); } // only for debugging //$tmp="Success<BR>".$Q; //ResultMail("function saveToCache",$tmp); }
if ($csvData!='') //from the 2th csv file.. array_shift($csvArray); //...remove the headings $csvData.=implode("\n",$csvArray); } $handle = fopen("/www/Msgs/pto/ToDoFile.csv", 'w'); fwrite($handle, $csvData); $_GET['file'][]="ToDoFile.csv"; //ResultMail("ToDo Load3",ob_get_clean()); $s="ImportCSV.php"; echo "</b><br /><br /><b>Calling {$s} for loading ".implode(",",$_GET['file'])." into the database</b>........<br /><br /><br />"; include($s); //ResultMail("ToDo Load4",ob_get_clean()); $s="ToDo.php"; echo "</b><br /><br /><b>Calling {$s} for loading ".implode(",",$_GET['file'])." from stage</b>........<br /><br /><br />"; include($s); echo " - SUCCESSFUL"; if ($commandline_mode===false) echo "done<BR>\n"; else ResultMail("ToDo Load",ob_get_clean()); ?>