TeraWurflAdmin
[ class tree: TeraWurflAdmin ] [ index: TeraWurflAdmin ] [ all elements ]

Source for file install.php

Documentation is available at install.php

  1. <?php
  2. /**
  3.  * Tera_WURFL - PHP MySQL driven WURFL
  4.  * 
  5.  * Tera-WURFL was written by Steve Kamerman, and is based on the
  6.  * Java WURFL Evolution package by Luca Passani and WURFL PHP Tools by Andrea Trassati.
  7.  * This version uses a MySQL database to store the entire WURFL file, multiple patch
  8.  * files, and a persistent caching mechanism to provide extreme performance increases.
  9.  * 
  10.  * @package TeraWurflAdmin
  11.  * @author Steve Kamerman <stevekamerman AT gmail.com>
  12.  * @version Stable 2.1.3 $Date: 2010/09/18 15:43:21
  13.  * @license http://www.mozilla.org/MPL/ MPL Vesion 1.1
  14.  */
  15. require_once realpath(dirname(__FILE__).'/../TeraWurfl.php');
  16. error_reporting(E_ERROR);
  17. @$tw new TeraWurfl();
  18.  
  19. $dir $tw->rootdir.TeraWurflConfig::$DATADIR;
  20. $logfile TeraWurflConfig::$LOG_FILE;
  21. ?>
  22. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  23. <html xmlns="http://www.w3.org/1999/xhtml">
  24. <head>
  25. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  26. <title>Tera-WURFL Installation</title>
  27. <link href="style.css" rel="stylesheet" type="text/css" />
  28. </head>
  29.  
  30. <body>
  31. <table width="800">
  32.     <tr><td>
  33. <div align="center" class="titlediv">
  34.     <p>        Tera-WURFL <?php echo $tw->release_version?> Administration<br />
  35.         </p>
  36. </div>
  37. </td></tr><tr><td>
  38.     <p>&nbsp;</p>
  39.     <table width="800" border="0" cellspacing="0" cellpadding="0">
  40.         <tr>
  41.             <th colspan="2" scope="col">Checking Installation </th>
  42.         </tr>
  43.         <tr>
  44.             <td colspan="2" valign="bottom" class="darkrow"><p><strong><u>PHP Configuration</u></strong>
  45. <br />
  46. </p>            </td>
  47.         </tr>
  48.         <tr>
  49.             <td width="17" class="lightrow"><img src="triangle.gif" width="10" height="11" /></td>
  50.             <td width="783" class="lightrow"><strong>PHP Version</strong>:
  51. <?php
  52. if(version_compare(PHP_VERSION,TeraWurfl::$required_php_version=== 1){
  53.     echo PHP_VERSION."... OK";
  54. }else{
  55.     echo "<span class=\"error\">ERROR:</span> PHP ".TeraWurfl::$required_php_version." is required but you have ".PHP_VERSION;
  56. }
  57. ?></td>
  58.         </tr>
  59.         <tr>
  60.             <td class="darkrow"><img src="triangle.gif" width="10" height="11" /></td>
  61.             <td class="darkrow"><strong>ZipArchive Support</strong>              <?php
  62. if(class_exists("ZipArchive")){
  63.     echo "... OK";
  64. }else{
  65.     echo "... <span class=\"error\">WARNING</span><br/> In order to update the WURFL File from the Internet, you must have support for the <strong>ZipArchive module</strong>.
  66.     This module is included with PHP since 5.2.0.  You can get the ZipArchive class from the <a href=\"http://pecl.php.net/package/zip\" target=\"_blank\">PECL Zip package</a>.
  67.     Note: you can still use Tera-WURFL without ZipArchive, Tera-WURFL will attempt to call the gunzip program from your system to unzip the compressed WURFL archive.
  68.     If this fails, you must download the archive manually and extract wurfl.xml to your data/ directory.";
  69. }
  70. ?></td>
  71.         </tr>
  72.         <tr>
  73.             <td class="lightrow"><img src="triangle.gif" width="10" height="11" /></td>
  74.             <td class="lightrow"><strong>MySQLi Support</strong>              <?php
  75. if(class_exists("MySQLi"))// SQL Driver for PHP: function_exists("sqlsrv_connect")
  76.     echo "... OK";
  77. }else{
  78.     echo "... <span class=\"error\">WARNING</span><br/>Since version 2.0, Tera-WURFL requires the <strong>MySQLi</strong> module to use MySQL.  More information about obtaining MySQLi is available at <a href=\"http://www.php.net/manual/en/book.mysqli.php\" target=\"_blank\">www.php.net</a>.<br/><br/>
  79.     
  80.     If you are using the <i>EXPERIMENTAL</i> Microsoft SQL Server DatabaseConnector you can ignore this error message, however, you will need the <a href=\"http://msdn.microsoft.com/en-us/library/ms131321.aspx\" target=\"_blank\">SQL Server Native Client</a> and <a href=\"http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=ccdf728b-1ea0-48a8-a84a-5052214caad9\" target=\"_blank\">SQL Server Driver for PHP 1.1</a> installed.";
  81. }
  82. ?></td>
  83.         </tr>
  84.         <tr>
  85.             <td class="darkrow"><img src="triangle.gif" width="10" height="11" /></td>
  86.             <td class="darkrow"><strong>PHP Memory Limit</strong>:
  87. <?php
  88. if(TeraWurflConfig::$OVERRIDE_MEMORY_LIMIT){
  89.     echo TeraWurflConfig::$MEMORY_LIMIT." (via TeraWurflConfig::\$MEMORY_LIMIT)";
  90. }else{
  91.     echo ini_get("memory_limit")." (via php.ini)";
  92. }
  93. ?><br/><strong>When you update the WURFL, PHP may consume over 200MB of RAM while parsing, sorting and indexing the data.</strong></td>
  94.         </tr>
  95.         <tr>
  96.             <td colspan="2" valign="bottom" class="darkrow"><p><strong><u>File Permissions</u></strong>
  97. <br />
  98. </p>            </td>
  99. </tr>
  100.         <tr>
  101.             <td class="darkrow"><img src="triangle.gif" width="10" height="11" /></td>
  102.             <td class="darkrow"><strong>WURFL File</strong>: <?php echo $dir.TeraWurflConfig::$WURFL_FILE?>...
  103.                 <?php
  104. if(is_file($dir.TeraWurflConfig::$WURFL_FILE&& is_readable($dir.TeraWurflConfig::$WURFL_FILE))
  105. echo "OK";
  106. else
  107. echo "<span class=\"error\">WARNING:</span> File doesn't exist or isn't readable.  You can continue like this, you just can't update the database from your local wurfl.xml.";
  108. ?></td>
  109.         </tr>
  110.         <tr>
  111.             <td class="lightrow"><img src="triangle.gif" width="10" height="11" /></td>
  112.             <td class="lightrow"><strong>PATCH Files</strong>:<br/>
  113.                 <?php
  114. $files explode(';',TeraWurflConfig::$PATCH_FILE);
  115. foreach($files as $thisfile){
  116.     echo "$dir$thisfile...";
  117.     if(is_file($dir.$thisfile&& is_readable($dir.$thisfile))
  118.         echo "OK<br/>";
  119.     else
  120.         echo "<span class=\"error\">WARNING:</span> File doesn't exist or isn't readable.  You may ignore this error if patching is disabled.<br/>";
  121. }
  122. ?></td>
  123.         </tr>
  124.         <tr>
  125.             <td class="darkrow"><img src="triangle.gif" width="10" height="11" /></td>
  126.             <td class="darkrow"><strong>DATA Directory</strong>: <?php echo $dir?>...
  127.                 <?php
  128. if(is_dir($dir&& is_readable($dir&& is_writable($dir))
  129. echo "OK";
  130. else
  131. echo "<span class=\"error\">ERROR:</span> Directory doesn't exist or isn't writeable.  This directory should be owned by the webserver user or chmoded to 777 for the log file and the online updates to work. </br>Here's the best way to do it in Ubuntu:<br/><pre>sudo chgrp -R www-data data/
  132. sudo chmod -R g+rw data/</pre>";
  133. ?></td>
  134.         </tr>
  135.         <tr>
  136. <td colspan="2" valign="bottom" class="darkrow"><p><strong><u>Database Settings</u></strong></p></td>
  137.         </tr>
  138.         <tr>
  139.             <td class="lightrow"><img src="triangle.gif" width="10" height="11" /></td>
  140.             <td class="lightrow"><strong>Host</strong>: <?php echo TeraWurflConfig::$DB_HOST?></td>
  141.         </tr>
  142.         <tr>
  143.             <td class="darkrow"><img src="triangle.gif" width="10" height="11" /></td>
  144.             <td class="darkrow"><strong>Username</strong>: <?php echo TeraWurflConfig::$DB_USER?></td>
  145.         </tr>
  146.         <tr>
  147.             <td class="lightrow"><span class="lightrow"><img src="triangle.gif" width="10" height="11" /></span></td>
  148.             <td class="lightrow"><strong>Connecting to DB server</strong>...
  149. <?php
  150. if(!class_exists('MySQLi')){
  151.     echo "<span class=\"error\">ERROR:</span> MySQLi is not installed or enabled, see errors above.";
  152. }elseif(function_exists('mysqli_connect_errno'&& mysqli_connect_errno()){
  153.     echo "<span class=\"error\">ERROR:</span> ".mysqli_connect_error();
  154. }else{
  155.     echo "OK";
  156. }
  157. $errors $tw->db->verifyConfig();
  158. if(!empty($errors)){
  159.     foreach($errors as $error){
  160.         echo "<br/><span class=\"error\">ERROR:</span> $error";
  161.     }
  162. }
  163. ?></td>
  164.         </tr>
  165.         <tr>
  166.             <td class="darkrow"><img src="triangle.gif" width="10" height="11" /></td>
  167.             <td class="darkrow"><strong>DB Server Version</strong>: 
  168. <?php
  169. if(!$tw->db->connected){
  170.     echo "<span class=\"error\">ERROR:</span> The version number cannot be determined because you are not connected.";
  171. }else{
  172.     $mysql_raw_version $tw->db->getServerVersion();
  173.     if($mysql_raw_version !== false){
  174.         $mysql_version = (int)$mysql_raw_version[0];
  175.         echo $mysql_raw_version."<br/>";
  176.         if(TeraWurflConfig::$DB_CONNECTOR == "MySQL4" && $mysql_version 4){
  177.             echo "<span class=\"error\">NOTICE:</span> You are using the MySQL4 connector with MySQL5.  Although this will work, the MySQL5 connector provides much better performance. 
  178.             Since the MySQL4 connector does not use Stored Procedures, you can also use it if you want to use MySQL5 without Stored Procedures.";
  179.         }elseif(TeraWurflConfig::$DB_CONNECTOR == "MySQL5" && $mysql_version 5){
  180.             echo "<span class=\"error\">ERROR:</span> You are using the MySQL5 connector with MySQL4.  Please change the DatabaseConnector to MySQL4.";
  181.         }
  182.     }
  183. }
  184. ?>
  185.             </td>
  186.         </tr>
  187.            <tr>
  188.             <td class="lightrow"><img src="triangle.gif" width="10" height="11" /></td>
  189.             <td class="lightrow"><strong>DB Name</strong> (schema): <?php echo TeraWurflConfig::$DB_SCHEMA?></td>
  190.         </tr>
  191.         <tr>
  192.             <td>&nbsp;</td>
  193.             <td><div align="left" style="padding-left:15px;"><br />
  194.                  If everything looks ok, <strong>delete <?php echo $tw->rootdir?>admin/install.php</strong>, then update your database from one of the following sources:
  195.                  <ul><li><a href="updatedb.php?source=local">Your local WURFL file</a> (<?php echo TeraWurflConfig::$WURFL_FILE?>)</li>
  196.                  <li><a href="updatedb.php?source=remote">The current released WURFL</a> (<?php echo TeraWurflConfig::$WURFL_DL_URL?>)</li>
  197.                  <!-- <li><a href="updatedb.php?source=remote_cvs">The current CVS WURFL</a> (<?php echo TeraWurflConfig::$WURFL_CVS_URL?>)</li> -->
  198.                  </ul>
  199.             </div></td>
  200.         </tr>
  201.     </table>
  202.     </td>
  203. </tr></table>
  204. </body>
  205. </html>

Documentation generated on Sun, 19 Sep 2010 00:15:50 +0000 by phpDocumentor 1.4.3