Checks if the source is connected to the database.
public isConnected ( ) : boolean | ||
return | boolean | True if the database is connected, else false |
/** * Test isConnected * * @return void */ public function testIsConnected() { $this->Dbo->disconnect(); $this->assertFalse($this->Dbo->isConnected(), 'Not connected now.'); $this->Dbo->connect(); $this->assertTrue($this->Dbo->isConnected(), 'Should be connected.'); }
/** * Check the database status before installation. * * @return bool */ public function checkStatus() { if (!$this->db->isConnected()) { $this->out(sprintf('<error>Database connection for %s failed!</error>', FORUM_DATABASE)); return false; } // Check the required tables $tables = $this->db->listSources(); $checkFor = array($this->install['table'], 'aros', 'acos', 'aros_acos'); $this->out(sprintf('The following tables are required: %s', implode(', ', $checkFor))); $this->out('<info>Checking tables...</info>'); foreach ($checkFor as $table) { if (!in_array($table, $tables)) { $this->out(sprintf('<error>No %s table was found in %s</error>', $table, FORUM_DATABASE)); return false; } } $this->out('<info>Installation status good, proceeding...</info>'); return true; }