Exemple #1
0
 protected function _checkDbTable()
 {
     if (null !== $this->_dbRessource) {
         $tablesToCheck = array();
         $tablesNotFound = array();
         $tablesToCheck[] = 'auth_belong';
         $tablesToCheck[] = 'auth_group';
         $tablesToCheck[] = 'auth_group_permission';
         $tablesToCheck[] = 'auth_permission';
         $tablesToCheck[] = 'auth_user';
         $tablesToCheck[] = 'auth_user_permission';
         $tablesToCheck[] = 'centurion_content_type';
         $tablesToCheck[] = 'centurion_navigation';
         $tablesToCheck[] = 'centurion_site';
         $tablesToCheck[] = 'cms_flatpage';
         $tablesToCheck[] = 'cms_flatpage_template';
         $tablesToCheck[] = 'media_duplicate';
         $tablesToCheck[] = 'media_file';
         $tablesToCheck[] = 'media_image';
         $tablesToCheck[] = 'media_multiupload_ticket';
         $tablesToCheck[] = 'media_video';
         $tablesToCheck[] = 'translation_language';
         $tablesToCheck[] = 'translation_tag';
         $tablesToCheck[] = 'translation_tag_uid';
         $tablesToCheck[] = 'translation_translation';
         $tablesToCheck[] = 'translation_uid';
         $tablesToCheck[] = 'user_profile';
         foreach ($tablesToCheck as $tableName) {
             try {
                 $this->_dbRessource->getDbAdapter()->describeTable($tableName);
             } catch (Exception $e) {
                 if ($e->getCode() == '42') {
                     $tablesNotFound[] = $tableName;
                 } else {
                     throw $e;
                 }
             }
         }
         if (count($tablesNotFound) > 0) {
             if (count($tablesNotFound) == count($tablesToCheck)) {
                 //TODO: zf db install
                 $this->_checklist[] = array('code' => -1, 'canBeBetter' => true, 'isNotSecure' => false, 'text' => 'All table are missing.', 'alt' => 'Have you forget a "zf db install" ?');
             } else {
                 $this->_checklist[] = array('code' => 0, 'canBeBetter' => true, 'isNotSecure' => false, 'text' => 'Some table are missing', 'alt' => 'Some table are missing: <br /> - ' . implode('<br />- ', $tablesNotFound));
             }
         }
     } else {
         $this->_checklist[] = array('code' => -1, 'canBeBetter' => true, 'isNotSecure' => true, 'text' => 'Can\'t check table; no connection to bdd', 'alt' => '');
     }
 }
Exemple #2
0
 public function testInitShouldInitializeDbAdapter()
 {
     // require_once 'Zend/Application/Resource/Db.php';
     $config = array('adapter' => 'Pdo_Sqlite', 'params' => array('dbname' => ':memory:'), 'isDefaultTableAdapter' => false);
     $resource = new Zend_Application_Resource_Db($config);
     $resource->init();
     $db = $resource->getDbAdapter();
     $this->assertTrue($db instanceof Zend_Db_Adapter_Pdo_Sqlite);
 }
Exemple #3
0
 public function getDbAdapter()
 {
     if (self::$_cachedAdapter instanceof Zend_Db_Adapter_Abstract) {
         $adapter = self::$_cachedAdapter;
     } else {
         $adapter = parent::getDbAdapter();
     }
     return $adapter;
 }