PHP Class N98\Util\Console\Helper\DatabaseHelper

Inheritance: extends Symfony\Component\Console\Helper\Helper
Afficher le fichier Open project: netz98/n98-magerun Class Usage Examples

Protected Properties

Свойство Type Description
$_connection PDO
$_tables array
$dbSettings array | N98\Magento\DbSettings
$isSocketConnect boolean

Méthodes publiques

Méthode Description
createDatabase ( Symfony\Component\Console\Output\OutputInterface $output )
detectDbSettings ( Symfony\Component\Console\Output\OutputInterface $output )
dropDatabase ( Symfony\Component\Console\Output\OutputInterface $output )
dropTables ( Symfony\Component\Console\Output\OutputInterface $output )
dsn ( ) : string Creates a PDO DSN for the adapter from $this->_config settings.
getConnection ( Symfony\Component\Console\Output\OutputInterface $output = null ) : PDO Connects to the database without initializing magento
getDbSettings ( Symfony\Component\Console\Output\OutputInterface $output = null ) : array | DbSettings
getGlobalStatus ( string | null $variable = null ) : array
getGlobalVariables ( string | null $variable = null ) : array
getIsSocketConnect ( ) : boolean
getMysqlClientToolConnectionString ( ) : string
getMysqlVariable ( string $name, string $type = null ) : string obtain mysql variable value from the database connection.
getMysqlVariableValue ( string $variable ) : boolean | array Get mysql variable value
getName ( ) : string Returns the canonical name of this helper.
getTableDefinitions ( array $commandConfig ) : array
getTables ( boolean $withoutPrefix = null ) : array Get list of database tables
getTablesStatus ( boolean $withoutPrefix = false ) : array Get list of db tables status
mysqlUserHasPrivilege ( string $privilege ) : boolean Check whether current mysql user has $privilege privilege
resolveTables ( array $list, array $definitions = [], array $resolved = [] ) : array

Private Methods

Méthode Description
fallbackOutput ( Symfony\Component\Console\Output\OutputInterface $output = null ) : Symfony\Component\Console\Output\OutputInterface small helper method to obtain an object of type OutputInterface
getApplication ( ) : Application | Application
quoteLike ( string $string, string $escape = '=' ) : string quote a string so that it is safe to use in a LIKE
runShowCommand ( string $command, string | null $variable = null ) : array
throwRuntimeException ( PDOStatement $statement, string $message = "" ) throw a runtime exception and provide error info for the statement if available

Method Details

createDatabase() public méthode

public createDatabase ( Symfony\Component\Console\Output\OutputInterface $output )
$output Symfony\Component\Console\Output\OutputInterface

detectDbSettings() public méthode

public detectDbSettings ( Symfony\Component\Console\Output\OutputInterface $output )
$output Symfony\Component\Console\Output\OutputInterface

dropDatabase() public méthode

public dropDatabase ( Symfony\Component\Console\Output\OutputInterface $output )
$output Symfony\Component\Console\Output\OutputInterface

dropTables() public méthode

public dropTables ( Symfony\Component\Console\Output\OutputInterface $output )
$output Symfony\Component\Console\Output\OutputInterface

dsn() public méthode

Creates a PDO DSN for the adapter from $this->_config settings.
See also: Zend_Db_Adapter_Pdo_Abstract
public dsn ( ) : string
Résultat string

getConnection() public méthode

Connects to the database without initializing magento
public getConnection ( Symfony\Component\Console\Output\OutputInterface $output = null ) : PDO
$output Symfony\Component\Console\Output\OutputInterface = null
Résultat PDO

getDbSettings() public méthode

public getDbSettings ( Symfony\Component\Console\Output\OutputInterface $output = null ) : array | DbSettings
$output Symfony\Component\Console\Output\OutputInterface [optional]
Résultat array | N98\Magento\DbSettings

getGlobalStatus() public méthode

public getGlobalStatus ( string | null $variable = null ) : array
$variable string | null [optional]
Résultat array

getGlobalVariables() public méthode

public getGlobalVariables ( string | null $variable = null ) : array
$variable string | null [optional]
Résultat array

getIsSocketConnect() public méthode

public getIsSocketConnect ( ) : boolean
Résultat boolean

getMysqlClientToolConnectionString() public méthode

getMysqlVariable() public méthode

in difference to @see getMysqlVariableValue(), this method allows to specify the type of the variable as well as to use any variable identifier even such that need quoting.
public getMysqlVariable ( string $name, string $type = null ) : string
$name string mysql variable name
$type string [optional] variable type, can be a system variable ("@@", default) or a session variable ("@").
Résultat string variable value, null if variable was not defined

getMysqlVariableValue() public méthode

Get mysql variable value
public getMysqlVariableValue ( string $variable ) : boolean | array
$variable string
Résultat boolean | array returns array on success, false on failure

getName() public méthode

Returns the canonical name of this helper.
public getName ( ) : string
Résultat string The canonical name

getTableDefinitions() public méthode

public getTableDefinitions ( array $commandConfig ) : array
$commandConfig array
Résultat array

getTables() public méthode

Get list of database tables
public getTables ( boolean $withoutPrefix = null ) : array
$withoutPrefix boolean [optional] remove prefix from the returned table names. prefix is obtained from magento database configuration. defaults to false.
Résultat array

getTablesStatus() public méthode

Get list of db tables status
public getTablesStatus ( boolean $withoutPrefix = false ) : array
$withoutPrefix boolean
Résultat array

mysqlUserHasPrivilege() public méthode

Check whether current mysql user has $privilege privilege
public mysqlUserHasPrivilege ( string $privilege ) : boolean
$privilege string
Résultat boolean

resolveTables() public méthode

public resolveTables ( array $list, array $definitions = [], array $resolved = [] ) : array
$list array
$definitions array
$resolved array Which definitions where already resolved -> prevent endless loops
Résultat array

Property Details

$_connection protected_oe property

protected PDO $_connection
Résultat PDO

$_tables protected_oe property

protected array $_tables
Résultat array

$dbSettings protected_oe property

protected array|DbSettings,N98\Magento $dbSettings
Résultat array | N98\Magento\DbSettings

$isSocketConnect protected_oe property

Deprecation: since 1.97.9, use $dbSettings->isSocketConnect()
protected bool $isSocketConnect
Résultat boolean