Ejemplo n.º 1
0
                $results = $db->Query($tok);
                if ($results == false) {
                    $errors[] = 'Error: executing query: ' . $tok;
                    $errors[] = $db->Error();
                    $err++;
                }
            } else {
                $sqldump[] = "Execute query:\n---------------------------------------\n" . $tok . "\n---------------------------------------\n";
            }
        }
        if ($currently_in_sqltextdata) {
            echo "<pre>B0rked on query:\n" . $query_so_far . "\n---------------------------------\n";
            die;
        }
        if ($err == 0 && $do_upgrade) {
            $err = perform_upgrade($db, $log, $errors, $sqldump);
        }
        if ($err == 0) {
            $log[] = "Database structure and data successfully imported";
        }
        if ($cfg['IN_DEVELOPMENT_ENVIRONMENT'] && DUMP_QUERIES_N_STUFF_IN_DEVMODE) {
            ?>
			<h2>Database Initialization</h2>
			<pre class="small"><?php 
            foreach ($sqldump as $line) {
                echo htmlspecialchars($line, ENT_COMPAT, 'UTF-8');
            }
            ?>
</pre>
<?php 
        }
Ejemplo n.º 2
0
                     if ($retVal != 0) {
                         $error = "Failed to import seed data.  Error was: <br />" . str_replace("\n", "<br />", $output[count($output)]);
                     }
                 }
             }
         }
     }
 }
 // Create PDO connection to perform upgrades
 try {
     $dbConn = new PDO("mysql:host=" . $mysqlHostname . ";dbname=" . $mysqlDatabase, $mysqlUsername, $mysqlPassword);
 } catch (PDOException $e) {
     $error = "Failed to connect to MySQL server with " . $mysqlUsername . " user:"******"/includes/lilac-conf.php.dist");
     $conf = str_replace("%%DSN%%", "mysql:host=" . $mysqlHostname . ";dbname=" . $mysqlDatabase, $conf);
     $conf = str_replace("%%USERNAME%%", $mysqlUsername, $conf);
     $conf = str_replace("%%PASSWORD%%", $mysqlPassword, $conf);
     $conf = str_replace("%%DATABASE%%", $mysqlDatabase, $conf);
     // We have the new conf
     $ret = file_put_contents(dirname(__FILE__) . "/includes/lilac-conf.php", $conf);
     if ($ret == false) {
         $error = "Failed to write to includes/lilac-conf.php.  Check that the web user can write to the includes directory and try again.";
     }