public function update()
 {
     if ($this->source == self::SOURCE_REMOTE) {
         $this->downloader->downloadUpdate();
     }
     $this->loader = new TeraWurflLoader($this->wurfl);
     return $this->loader->load();
 }
Ejemplo n.º 2
0
            throw new Exception("Error: Unable to extract wurfl.xml from downloaded archive: {$newfile}");
            exit(1);
        }
    } else {
        system("gunzip {$newfile}");
    }
    $size = WurflSupport::formatBytes(filesize($wurflfile)) . " [{$gzsize} compressed]";
    $download_rate = WurflSupport::formatBitrate(filesize($newfile), $download_time);
    $ok = true;
    echo "done ({$wurflfile}: {$size})<br />Downloaded in {$download_time} sec @ {$download_rate} <br/><br/>";
    usleep(50000);
    flush();
}
$loader = new TeraWurflLoader($base);
//$ok = $base->db->initializeDB();
$ok = $loader->load();
if ($ok) {
    echo "<strong>Database Update OK</strong><hr />";
    echo "Total Time: " . $loader->totalLoadTime() . "<br/>";
    echo "Parse Time: " . $loader->parseTime() . " (" . $loader->getParserName() . ")<br/>";
    echo "Validate Time: " . $loader->validateTime() . "<br/>";
    echo "Sort Time: " . $loader->sortTime() . "<br/>";
    echo "Patch Time: " . $loader->patchTime() . "<br/>";
    echo "Database Time: " . $loader->databaseTime() . "<br/>";
    echo "Cache Rebuild Time: " . $loader->cacheRebuildTime() . "<br/>";
    echo "Number of Queries: " . $base->db->numQueries . "<br/>";
    if (version_compare(PHP_VERSION, '5.2.0') === 1) {
        echo "PHP Memory Usage: " . WurflSupport::formatBytes(memory_get_usage()) . "<br/>";
    }
    echo "--------------------------------<br/>";
    echo "WURFL Version: " . $loader->version . " (" . $loader->last_updated . ")<br />";