Example #1
0
 public function testMinServer()
 {
     $db = Database::mDataConnect();
     $errors = InstallUtilities::createMinServer($db, CoreLocal::get('mDatabase'));
     $this->assertInternalType('array', $errors);
     $this->assertInternalType('array', $errors);
     foreach ($errors as $error) {
         $this->assertInternalType('array', $error, 'Invalid status entry');
         $this->assertArrayHasKey('error', $error, 'Status entry missing key: error');
         $this->assertEquals(0, $error['error'], 'Error creating ' . $error['struct'] . ', ' . print_r($error, true));
         if (isset($error['query']) && stristr($error['query'], 'DROP VIEW')) {
             // don't check for existence on DROP VIEW queries
             continue;
         }
         $exists = $db->table_exists($error['struct']);
         $this->assertEquals(true, $exists, 'Failed to create ' . $error['struct'] . ', ' . print_r($error, true));
     }
 }
Example #2
0
    echo "<span class='fail'>Failed</span>";
    echo '<div class="db_hints" style="margin-left:25px;width:350px;">';
    if (!function_exists('socket_create')) {
        echo '<i>Try enabling PHP\'s socket extension in php.ini for better diagnostics</i>';
    } elseif (@MiscLib::pingport(CoreLocal::get('mServer'), CoreLocal::get('DBMS'))) {
        echo '<i>Database found at ' . CoreLocal::get('mServer') . '. Verify username and password
            and/or database account permissions.</i>';
    } else {
        echo '<i>Database does not appear to be listening for connections on ' . CoreLocal::get('mServer') . '. Verify host is correct, database is running and
            firewall is allowing connections.</i>';
    }
    echo '</div>';
} else {
    echo "<span class='success'>Succeeded</span><br />";
    //echo "<textarea rows=3 cols=80>";
    $sErrors = InstallUtilities::createMinServer($sql, CoreLocal::get('mDatabase'));
    $sErrors = array_filter($sErrors, function ($x) {
        return $x['error'] != 0;
    });
    if (!empty($sErrors)) {
        echo '<div class="db_create_errors" style="border: solid 1px red;padding:5px;">';
        echo 'There were some errors creating transactional DB structure';
        echo '<ul style="margin-top:2px;">';
        foreach ($sErrors as $error) {
            if ($error['error'] == 0) {
                continue;
                // no error occurred
            }
            echo '<li>';
            echo 'Error on structure <b>' . $error['struct'] . '</b>. ';
            printf('<a href="" onclick="$(\'#eDetails%s\').toggle();return false;">Details</a>', $error['struct']);