/** * モジュール使用テーブル名データを取得する。 * * @param string $dirname モジュールのディレクリ名称 * @param boolean $needPrefix テーブル名のプレフィックス有無 * @return array テーブル名の配列 * @access public */ function &getTableList($directory, $needPrefix = true) { $tableNames = array(); $databaseDriver = _DEFAULT_SQL_KIND; $configView =& $this->_container->getComponent('configView'); $config = $configView->getConfigByConfname(_SYS_CONF_MODID, 'db_kind'); if (!empty($config)) { $databaseDriver = $config['conf_value']; } $sqlFilePathName = MODULE_DIR . '/' . $directory . '/sql/' . $databaseDriver . '/' . _SYS_TABLE_INI; if (!file_exists($sqlFilePathName)) { return $tableNames; } $sqlFileSize = filesize($sqlFilePathName); if (empty($sqlFileSize)) { return $tableNames; } $handle = fopen($sqlFilePathName, 'r'); $sqlContent = fread($handle, $sqlFileSize); fclose($handle); $this->splitMySqlFile($sqls, $sqlContent); $tablePrefix = $this->_db->getPrefix(); foreach ($sqls as $sql) { $dividedSqls = $this->prefixQuery($sql, $tablePrefix); if (!$dividedSqls) { return $dividedSqls; } $tableName = $dividedSqls[4]; if ($needPrefix) { $tableName = $tablePrefix . $tableName; } if (in_array($tableName, $tableNames)) { continue; } $tableNames[] = $tableName; } return $tableNames; }
/** * コンストラクター * * @access public */ function Database_Backup() { $this->_container =& DIContainerFactory::getContainer(); $this->_db =& $this->_container->getComponent("DbObject"); }