Source for file tera_wurfl_updatedb.php
Documentation is available at tera_wurfl_updatedb.php
* Tera_WURFL - PHP MySQL driven WURFL
* Tera-WURFL was written by Steve Kamerman, Tera Technologies and is based on the
* WURFL PHP Tools from http://wurfl.sourceforge.net/. This version uses a MySQL database
* to store the entire WURFL file to provide extreme performance increases.
* @author Steve Kamerman, Tera Technologies (kamermans AT teratechnologies DOT net)
* @version Stable 1.5.0 $Date: 2007/04/27 17:43:50 $
* @version Stable 1.5.0 $Date: 2007/04/27 17:43:50 $
* @license http://www.mozilla.org/MPL/ MPL Vesion 1.1
* $Id: tera_wurfl_updatedb.php,v 1.1.2.4.2.8 2007/04/27 17:43:50 kamermans Exp $
* $RCSfile: tera_wurfl_updatedb.php,v $
* Based On: WURFL PHP Tools by Andrea Trasatti ( atrasatti AT users DOT sourceforge DOT net )
$source = (isset ($_GET['source']))? $_GET['source']: "local";
$type = (isset ($_GET['type']))? $_GET['type']: "main";
require_once('../tera_wurfl_config.php');
require_once(WURFL_PARSER_FILE);
// check main device tables (devices,patch,hybrid)
foreach($required_tables as $req_table){
echo "Required table '$req_table' was missing in database (". print_r($tables,true). "), creating...<br />";
// check for cache table and create it if necessary
// if this is a patch update, these stats don't really make sense, although they ARE correct
echo "<strong>Database Update</strong><hr />";
echo "Total Update Time: ". ($end- $start). "<br />";
echo "Total Devices in WURFL: ". $results['total']. "<br />";
echo "Total Devices inserted in DB: ". $results['inserted']. "<br />";
echo "Total Queries: ". $results['queries']. "<br />";
echo "Largest Query: ". (ceil($results['maxquerysize']/ 1024)). "KB<br />";
echo "Total Errors: ". count($results['errors']). "<br /><br />";
if(count($results['errors']) == 0){
echo "<strong>Applying Patch</strong><hr />";
echo "<strong>ERROR:</strong> You have the 'WURFL_PATCH_ENABLE' option turned on in the
is missing or I can't read it. To fix this problem either turn the patch option off or make sure the file is
in the correct location.";
echo "Total Update Time: ". ($end- $start). "<br />";
echo "Total Devices in Patch File: ". $results['total']. "<br />";
echo "New Devices Added: ". $results['new']. "<br />";
echo "Merged Devices: ". $results['merged']. "<br />";
echo "Total Queries: ". $results['queries']. "<br />";
echo "Total Errors: ". count($results['errors']). "<br /><br />";
echo "<strong>Patch Disabled in Configuration</strong><br />";
echo "<br /><br />Update Complete!<br />";
echo "Did not attept to apply the patch since there were errors while updating.";
echo "<a href=\"index.php\">Return to administration tool.</a>";
function utime($time = false){
if(!$time)$time = time();
$out = ((float) $usec + (float) $sec);
if(isset ($redirectDelay))$seconds += $redirectDelay;
if($seconds == 0 && !$sent){
//headers have not been sent and instant redir was requested - do it!
// die("JavaScript, ($sent)output started on line $line in $file");
echo "<br><br>You will be redirected to <a href='$page'>$page</a> in $seconds seconds...";
echo '<script language="javascript">'. "\n". 'setTimeout('. "'". 'window.location.href = "'. $page. '"'. "'". ', '. $time. ');'. '</script>';
echo '<noscript><meta http-equiv="refresh" content="'. $time. ';url='. $page. '" /></noscript>';
|