r1530: Adding an installer check in install/install.php to prevent people from attemp...
authorRobert Sesek <rsesek@bluestatic.org>
Tue, 3 Apr 2007 03:50:36 +0000 (03:50 +0000)
committerRobert Sesek <rsesek@bluestatic.org>
Tue, 3 Apr 2007 03:50:36 +0000 (03:50 +0000)
docs/changes.txt
install/install.php

index 431e0a71d1fe2d2255f44e4ae4d33e8975163209..898bfeff809b7ced7b7ab39721a754a7b486fcdd 100644 (file)
@@ -7,6 +7,7 @@
 - Change: When clicking the "[Run Search]" link in the "Saved Searches" section of the "Options" tab, force the search to rerun
 - Fixed: Some email roles would not get notified under certain circumstances because the list of users to notify was reset
 - Fixed: Errors would occurr on installation due to a problem with not loading all the data at the right time
+- Enhancement: The installer will now check to ensure that all the proper MySQL permissions are enabled
 
 1.2.0 Beta 2
 ===============================
index 18cc8d337d16fc9e24bbf751a91eddf76385e041..6f223d3d0db71d9d7d500424533d2d2b14578d4e 100644 (file)
@@ -19,7 +19,7 @@
 || ###################################################################
 \*=====================================================================*/
 
-define('STOP_MARK', 7);
+define('STOP_MARK', 8);
 define('ACTIVE_SITE', 'install.php');
 
 require_once('./global.php');
@@ -46,6 +46,75 @@ if ($bugsys->in['mark'] == 0)
 if ($bugsys->in['mark'] == 1)
 {
 ?>
+<h1>Installation Check</h1>
+
+<style type="text/css" media="screen">
+<!--
+       .fail
+       {
+               font-weight: bold;
+               color: rgb(255, 0, 0);
+       }
+       .pass
+       {
+               color: rgb(0, 150, 0);
+       }
+//-->
+</style>
+
+<p>This step will ensure that Bugdar can install and run properly. In all of these tests, <span class="pass">green means the test succeeded</span> and <span class="fail">red means it didn't</span>.</p>
+
+<strong>MySQL Privileges:</strong>
+<ul>
+<?php
+       
+       $db->showerrors = false;
+       
+       $pf = $tests[] = ($db->query("CREATE TABLE install_check (col1 VARCHAR(255) NULL);") ? 'pass' : 'fail');
+       echo "\n\t<li class=\"$pf\">CREATE TABLE</li>";
+       
+       $pf = $tests[] = ($db->query("INSERT INTO install_check (col1) VALUES ('example')") ? 'pass' : 'fail');
+       echo "\n\t<li class=\"$pf\">INSERT</li>";
+       
+       $pf = $tests[] = ($db->query("UPDATE install_check SET col1 = 'example2'") ? 'pass' : 'fail');
+       echo "\n\t<li class=\"$pf\">UPDATE</li>";
+       
+       $pf = $tests[] = ($db->query("SELECT * FROM install_check") ? 'pass' : 'fail');
+       echo "\n\t<li class=\"$pf\">SELECT</li>";
+       
+       $pf = $tests[] = ($db->query("DELETE FROM install_check WHERE col1 = 'example2'") ? 'pass' : 'fail');
+       echo "\n\t<li class=\"$pf\">DELETE</li>";
+       
+       $pf = $tests[] = ($db->query("ALTER TABLE install_check ADD col3 BOOL") ? 'pass' : 'fail');
+       echo "\n\t<li class=\"$pf\">ALTER</li>";
+       
+       $pf = $tests[] = ($db->query("ALTER TABLE install_check ADD INDEX (col1)") ? 'pass' : 'fail');
+       echo "\n\t<li class=\"$pf\">ALTER ADD INDEX</li>";
+       
+       $pf = $tests[] = ($db->query("REPLACE INTO install_check (col1) VALUES ('example3')") ? 'pass' : 'fail');
+       echo "\n\t<li class=\"$pf\">REPLACE</li>";
+       
+       $pf = $tests[] = ($db->query("OPTIMIZE TABLE install_check") ? 'pass' : 'fail');
+       echo "\n\t<li class=\"$pf\">OPTIMIZE</li>";
+       
+       $pf = $tests[] = ($db->query("DROP TABLE install_check") ? 'pass' : 'fail');
+       echo "\n\t<li class=\"$pf\">DROP TABLE</li>";
+       
+       echo "\n</ul>";
+       
+       $valcount = array_count_values($tests);
+       if ($valcount['fail'] > 0)
+       {
+               echo "<p>Please adjust your MySQL setup and refresh this page to ensure that Bugdar can operate properly. If you do not do so, Bugdar cannot be installed.</p>";
+               page_end(false);
+       }
+}
+
+// ###################################################################
+
+if ($bugsys->in['mark'] == 2)
+{
+?>
 <h1>Initializing Database</h1>
 
 <p>This step will load the tables into your database so the rest of the installation can proceed forward.</p>
@@ -63,7 +132,7 @@ if ($bugsys->in['mark'] == 1)
 
 // ###################################################################
 
-if ($bugsys->in['mark'] == 2)
+if ($bugsys->in['mark'] == 3)
 {
 ?>
 <h1>Loading Default Data</h1>
@@ -97,7 +166,7 @@ if ($bugsys->in['mark'] == 2)
 
 // ###################################################################
 
-if ($bugsys->in['mark'] == 3)
+if ($bugsys->in['mark'] == 4)
 {
 ?>
 <h1>Loading Settings</h1>
@@ -119,7 +188,7 @@ if ($bugsys->in['mark'] == 3)
 
 // ###################################################################
 
-if ($bugsys->in['mark'] == 4)
+if ($bugsys->in['mark'] == 5)
 {
 ?>
 <h1>Cache Data</h1>
@@ -165,7 +234,7 @@ if ($bugsys->in['mark'] == 4)
 
 // ###################################################################
 
-if ($bugsys->in['mark'] == 5)
+if ($bugsys->in['mark'] == 6)
 {
        $value = 'http' . ($_SERVER['HTTPS'] == 'on' ? 's' : '') . '://' . $_SERVER['SERVER_NAME'] . ($_SERVER['SERVER_PORT'] != '80' ? ':' . $_SERVER['SERVER_PORT'] : '') . str_replace('/install/install.php', '', $_SERVER['SCRIPT_NAME']);
 ?>
@@ -174,7 +243,7 @@ if ($bugsys->in['mark'] == 5)
 <p>These three settings are fundamental in setting up your bug tracking system. Please fill them in to proceed with the installation.</p>
 
 <form name="settings-do" action="install.php" method="post">
-<input type="hidden" name="mark" value="6" />
+<input type="hidden" name="mark" value="7" />
 
 <div><strong>Tracker Name (the name of the entire tracking system, for instance "Acme Inc. Bug Tracker"):</strong> <input type="text" name="trackertitle" size="50" /></div>
 <div><strong>Tracker URL (the root URL of your tracker, we have tried to guess this for you; <em>it does not end with a trailing slash!</em>):</strong> <input type="text" name="trackerurl" size="50" value="<?php echo $value; ?>" /></div>
@@ -191,7 +260,7 @@ if ($bugsys->in['mark'] == 5)
 
 // ###################################################################
 
-if ($bugsys->in['mark'] == 6)
+if ($bugsys->in['mark'] == 7)
 {
 ?>
 <h1>New Administrator</h1>
@@ -199,7 +268,7 @@ if ($bugsys->in['mark'] == 6)
 <p>Your settings have been saved. Now you must create a new administrative account for yourself. This account will have complete control over the system.</p>
 
 <form name="user-do" action="install.php" method="post">
-<input type="hidden" name="mark" value="7" />
+<input type="hidden" name="mark" value="8" />
 
 <div><strong>Display Name:</strong> <input type="text" name="displayname" size="50" /></div>
 <div><strong>Email Address:</strong> <input type="text" name="email" size="50" /></div>
@@ -219,7 +288,7 @@ if ($bugsys->in['mark'] == 6)
 
 // ###################################################################
 
-if ($bugsys->in['mark'] == 7)
+if ($bugsys->in['mark'] == 8)
 {
 ?>
 <h1>User Added</h1>