本文整理汇总了PHP中TYPO3\CMS\Core\Database\DatabaseConnection::admin_get_tables方法的典型用法代码示例。如果您正苦于以下问题:PHP DatabaseConnection::admin_get_tables方法的具体用法?PHP DatabaseConnection::admin_get_tables怎么用?PHP DatabaseConnection::admin_get_tables使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Core\Database\DatabaseConnection
的用法示例。
在下文中一共展示了DatabaseConnection::admin_get_tables方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tables
/**
* @return array
*/
protected function tables()
{
if (!isset($this->_tables)) {
$this->_tables = array_keys($this->db->admin_get_tables());
}
return $this->_tables;
}
示例2: forceFlushCoreFileAndDatabaseCaches
/**
* Recursively delete cache directory and truncate all DB tables prefixed with 'cf_'
*/
protected function forceFlushCoreFileAndDatabaseCaches()
{
// Delete typo3temp/Cache
GeneralUtility::rmdir(PATH_site . 'typo3temp/Cache', TRUE);
// Get all table names starting with 'cf_' and truncate them
$tables = $this->databaseConnection->admin_get_tables();
foreach ($tables as $table) {
$tableName = $table['Name'];
if (substr($tableName, 0, 3) === 'cf_') {
$this->databaseConnection->exec_TRUNCATEquery($tableName);
}
}
}
示例3: checkEuLdap
/**
* Returns TRUE if upgrade wizard for legacy EXT:eu_ldap records should be run.
*
* @return bool
*/
protected function checkEuLdap()
{
$table = 'tx_euldap_server';
$migrationField = 'tx_igldapssoauth_migrated';
// We check the database table itself and not whether EXT:eu_ldap is loaded
// because it may have been deactivated since it is not incompatible
$existingTables = $this->databaseConnection->admin_get_tables();
if (!isset($existingTables[$table])) {
return FALSE;
}
// Ensure the column used to flag processed records is present
$fields = $this->databaseConnection->admin_get_fields($table);
if (!isset($fields[$migrationField])) {
$alterTableQuery = 'ALTER TABLE ' . $table . ' ADD ' . $migrationField . ' tinyint(4) NOT NULL default \'0\'';
// Method admin_query() will parse the query and make it compatible with DBAL, if needed
$this->databaseConnection->admin_query($alterTableQuery);
}
$euLdapConfigurationRecords = $this->databaseConnection->exec_SELECTcountRows('*', $table, $migrationField . '=0');
return $euLdapConfigurationRecords > 0;
}
示例4: getDatabaseList
/**
* Returns list of available databases (with access-check based on username/password)
*
* @param bool $initialInstallation TRUE if first installation is in progress, FALSE if upgrading or usual access
* @return array List of available databases
*/
protected function getDatabaseList($initialInstallation)
{
$this->initializeDatabaseConnection();
$databaseArray = $this->databaseConnection->admin_get_dbs();
// Remove mysql organizational tables from database list
$reservedDatabaseNames = array('mysql', 'information_schema', 'performance_schema');
$allPossibleDatabases = array_diff($databaseArray, $reservedDatabaseNames);
// If we are upgrading we show *all* databases the user has access to
if ($initialInstallation === false) {
return $allPossibleDatabases;
} else {
// In first installation we show all databases but disable not empty ones (with tables)
$databases = array();
foreach ($allPossibleDatabases as $database) {
$this->databaseConnection->setDatabaseName($database);
$this->databaseConnection->sql_select_db();
$existingTables = $this->databaseConnection->admin_get_tables();
$databases[] = array('name' => $database, 'tables' => count($existingTables));
}
return $databases;
}
}
示例5: renameDatabaseTable
/**
* Rename a DB table
*
* @param string $oldTableName old table name
* @param string $newTableName new table name
* @return boolean
*/
protected function renameDatabaseTable($oldTableName, $newTableName)
{
$title = 'Renaming "' . $oldTableName . '" to "' . $newTableName . '" ';
$tables = $this->databaseConnection->admin_get_tables();
if (isset($tables[$newTableName])) {
$message = 'Table ' . $newTableName . ' already exists';
$status = FlashMessage::OK;
} elseif (!isset($tables[$oldTableName])) {
$message = 'Table ' . $oldTableName . ' does not exist';
$status = FlashMessage::ERROR;
} else {
$sql = 'RENAME TABLE ' . $oldTableName . ' TO ' . $newTableName . ';';
if ($this->databaseConnection->admin_query($sql) === false) {
$message = ' SQL ERROR: ' . $this->databaseConnection->sql_error();
$status = FlashMessage::ERROR;
} else {
$message = 'OK!';
$status = FlashMessage::OK;
}
}
$this->messageArray[] = array($status, $title, $message);
return $status;
}
示例6: tableExists
/**
* Tests if a given table exists in current default database
*
* @param string $tablename Table name for which to check whether it exists
* @param array $info Additional info, will be displayed as debug message, if a key "message" exists this will be appended to the error message
*/
public static function tableExists($tablename, array $info = array())
{
self::initializeDbObj();
$tables = self::$dbObj->admin_get_tables();
return self::isArrayKey($tablename, $tables, $info);
}
示例7: isTableAvailable
/**
* check if given table exists in current database
* we can't check TCA or for installed extensions because dam and dam_ttcontent are not available for TYPO3 6.2
*
* @param $table
* @return bool
*/
protected function isTableAvailable($table)
{
$tables = $this->database->admin_get_tables();
return array_key_exists($table, $tables);
}
示例8: hasOldCacheTables
protected function hasOldCacheTables()
{
$tables = $this->databaseConnection->admin_get_tables();
return isset($tables['tx_realurl_pathcache']) || isset($tables['tx_realurl_urlcache']);
}
示例9: access
/**
* Called by the extension manager to determine if the update menu entry
* should by showed.
*
* @return bool
*/
public function access()
{
return array_key_exists($this->transferTable, $this->databaseConnection->admin_get_tables());
}
示例10: adminGetTablesReturnAllTablesFromDatabase
/**
* @test
*
* @return void
*/
public function adminGetTablesReturnAllTablesFromDatabase()
{
$result = $this->subject->admin_get_tables();
$this->assertArrayHasKey('tt_content', $result);
$this->assertArrayHasKey('pages', $result);
}