Beispiel #1
0
 public function testOpdata()
 {
     $db = Database::pDataConnect();
     $errors = InstallUtilities::createOpDBs($db, CoreLocal::get('pDatabase'));
     $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'] . ', ' . (isset($error['details']) ? $error['details'] : ''));
         $exists = $db->table_exists($error['struct']);
         $this->assertEquals(true, $exists, 'Failed to create ' . $error['struct']);
     }
 }
Beispiel #2
0
     echo "<span class='fail'>Failed</span>";
     echo '<div class="db_hints" style="margin-left:25px;">';
     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('localhost'), CoreLocal::get('DBMS'))) {
         echo '<i>Database found at ' . CoreLocal::get('localhost') . '. 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('localhost') . '. 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>";
     $opErrors = InstallUtilities::createOpDBs($sql, CoreLocal::get('pDatabase'));
     $opErrors = array_filter($opErrors, function ($x) {
         return $x['error'] != 0;
     });
     $gotDBs++;
     if (!empty($opErrors)) {
         echo '<div class="db_create_errors" style="border: solid 1px red;padding:5px;">';
         echo 'There were some errors creating operational DB structure';
         echo '<ul style="margin-top:2px;">';
         foreach ($opErrors as $error) {
             if ($error['error'] == 0) {
                 continue;
                 // no error occurred
             }
             echo '<li>';
             echo 'Error on structure <b>' . $error['struct'] . '</b>. ';