"Fossies" - the Fresh Open Source Software Archive

Member "node-runner-0.6.0/sql/update-nr-to-v0.2.php" (22 Dec 2004, 1970 Bytes) of package /linux/www/old/node-runner-0.6.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 <?php
    2 
    3 // This file is used to upgrade the database tables from Node Runner
    4 // v0.1 to v0.2.  If you need to upgrade from an older version, you
    5 // MUST run each of the older update files first.  It is HIGHLY
    6 // recommended that you just use the install script (select UPGRADE),
    7 // but if you absolutely *need* to update the database manually,
    8 // you can fill in the values below can call the script from the
    9 // php interpreter.  Otherwise, leave them blank.
   10 
   11 $database_host = '';
   12 $database_name = '';
   13 $database_user = '';
   14 $database_pass = '';
   15 
   16 if (!$dbhost) { $dbhost = $database_host; }
   17 if (!$db) { $db = $database_name; }
   18 if (!$dbuser) { $dbhost = $database_user; }
   19 if (!$dbpass) { $dbhost = $database_pass; }
   20 
   21 if ($database_host && $database_name && $database_user && $database_pass) {
   22   unset($err_msg);
   23   $connect = mysql_connect($database_host,$database_user,$database_pass);
   24   if (!$connect) { $err_msg .= mysql_error()."\n"; }
   25 }
   26 
   27 
   28 # DATABASE CHANGELOG:
   29 # 1) Adds downtime column to alert_log table
   30 # 2) Adds lastnotif column to alert_log table
   31 # 3) Inserts 0 into all downtime and lastnotif columns
   32 
   33 $query1 = "ALTER TABLE alert_log ADD downtime int NOT NULL";
   34 $result1 = mysql_db_query($db, $query1);
   35 if (!$result1) {
   36     $err_msg .= mysql_error()."\n";
   37 }
   38 
   39 $query2 = "ALTER TABLE alert_log ADD lastnotif char(30) NOT NULL";
   40 $result2 = mysql_db_query($db, $query2);
   41 if (!$result2) {
   42     $err_msg .= mysql_error()."\n";
   43 }
   44 
   45 $query3 = "UPDATE alert_log SET downtime=0";
   46 $result3 = mysql_db_query($db, $query3);
   47 if (!$result3) {
   48     $err_msg .= mysql_error()."\n";
   49 }
   50 
   51 $query4 = "UPDATE alert_log SET lastnotif=1";
   52 $result4 = mysql_db_query($db, $query4);
   53 if (!$result4) {
   54     $err_msg .= mysql_error()."\n";
   55 }
   56 
   57 
   58 # Generate some output if this files is run by itself.
   59 if ($database_host && $database_name && $database_user && $database_pass) {
   60   if ($err_msg) {
   61     echo "\nMySQL ERROR:\n\n".$err_msg."\n\n";
   62   } else {
   63     echo "\nDatabase populated successfully.\n\n";
   64   }
   65 }
   66 
   67 ?>