Fixed icon path after saving configuration.
Dieser Commit ist enthalten in:
Ursprung
4f36119278
Commit
88791f1a9c
9 geänderte Dateien mit 235 neuen und 124 gelöschten Zeilen
|
|
@ -3,17 +3,16 @@
|
|||
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||
* http://www.mysqldumper.net
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage Config
|
||||
* @version SVN: $Rev$
|
||||
* @author $Author$
|
||||
* @package MySQLDumper
|
||||
* @subpackage Config
|
||||
* @version SVN: $Rev$
|
||||
* @author $Author$
|
||||
*/
|
||||
/**
|
||||
* Class to handle the configuration
|
||||
* Class to handle the configuration.
|
||||
*
|
||||
* @throws Msd_Config_Exception
|
||||
* @package MySQLDumper
|
||||
* @subpackage Config
|
||||
* @package MySQLDumper
|
||||
* @subpackage Config
|
||||
*/
|
||||
class Msd_Config
|
||||
{
|
||||
|
|
@ -46,6 +45,8 @@ class Msd_Config
|
|||
* @param array $handlerOptions Options for the IO-Handler.
|
||||
*
|
||||
* @throws Msd_Config_Exception
|
||||
*
|
||||
* @return Msd_Config
|
||||
*/
|
||||
public function __construct($ioHandler, $handlerOptions = array())
|
||||
{
|
||||
|
|
@ -152,7 +153,6 @@ class Msd_Config
|
|||
if (strpos('paramName', '.') !== false) {
|
||||
list($section, $paramName) = explode('.', $paramName);
|
||||
$this->_config[$section][$paramName] = $paramValue;
|
||||
|
||||
} else {
|
||||
$this->_config[$paramName] = $paramValue;
|
||||
}
|
||||
|
|
@ -165,6 +165,8 @@ class Msd_Config
|
|||
/**
|
||||
* Class destructor.
|
||||
* If auto-save is enabled the configuration will be saved.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __destruct()
|
||||
{
|
||||
|
|
@ -178,13 +180,16 @@ class Msd_Config
|
|||
* If auto-save is enabled the configuration is also saved.
|
||||
*
|
||||
* @param array $config New configuration.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setConfig($config)
|
||||
{
|
||||
$this->_config = (array)$config;
|
||||
$this->_config = (array) $config;
|
||||
if ($this->_autosave) {
|
||||
$this->save();
|
||||
}
|
||||
$this->_setPaths();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -239,5 +244,4 @@ class Msd_Config
|
|||
$configData = parse_ini_file($this->getParam('paths.config') . '/' . $fileName . '.ini', true);
|
||||
return $configData['general']['title'];
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,10 +18,34 @@
|
|||
abstract class Msd_Db
|
||||
{
|
||||
// define result set types
|
||||
const ARRAY_NUMERIC = 0; // return resultset as numeric array
|
||||
const ARRAY_ASSOC = 1; // return resultset as associative array
|
||||
const ARRAY_OBJECT = 2; // return resultset as array of object
|
||||
const SIMPLE = 3; // return result as boolean
|
||||
/**
|
||||
* Return result-set as an numeric array.
|
||||
*
|
||||
* @const int
|
||||
*/
|
||||
const ARRAY_NUMERIC = 0;
|
||||
|
||||
/**
|
||||
* Return result-set as an associative array.
|
||||
*
|
||||
* @const int
|
||||
*/
|
||||
const ARRAY_ASSOC = 1;
|
||||
|
||||
/**
|
||||
* return result-set as an array of objects
|
||||
*
|
||||
* @const int
|
||||
*/
|
||||
const ARRAY_OBJECT = 2;
|
||||
|
||||
/**
|
||||
* Return the return value of the query function/method.
|
||||
*
|
||||
* @const int
|
||||
*/
|
||||
const SIMPLE = 3;
|
||||
|
||||
/**
|
||||
* SQL-Server
|
||||
*
|
||||
|
|
@ -59,6 +83,7 @@ abstract class Msd_Db
|
|||
|
||||
/**
|
||||
* List of databases adn default settings
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_databases = null;
|
||||
|
|
@ -103,33 +128,34 @@ abstract class Msd_Db
|
|||
*
|
||||
* @param array $options Array containing connection options
|
||||
*
|
||||
* @return void
|
||||
* @return Msd_Db
|
||||
*/
|
||||
protected function __construct ($options)
|
||||
protected function __construct($options)
|
||||
{
|
||||
$this->_server = $options['host'];
|
||||
$this->_user = $options['user'];
|
||||
$this->_server = $options['host'];
|
||||
$this->_user = $options['user'];
|
||||
$this->_password = $options['pass'];
|
||||
$this->_port = (int) $options['port'];
|
||||
$this->_socket = $options['socket'];
|
||||
$this->_port = (int) $options['port'];
|
||||
$this->_socket = $options['socket'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Create database adapter
|
||||
*
|
||||
* @param array $options Connection options
|
||||
* @param boolean $forceMysql Whether to force the use of MySQL
|
||||
*
|
||||
* @return MsdDbFactory
|
||||
* @return Msd_Db_MysqlCommon
|
||||
*/
|
||||
public static function getAdapter($options = null, $forceMysql = false)
|
||||
{
|
||||
if ($options === null) {
|
||||
$config = Msd_Registry::getConfig();
|
||||
$config = Msd_Registry::getConfig();
|
||||
$options = array(
|
||||
'host' => $config->getParam('dbuser.host'),
|
||||
'user' => $config->getParam('dbuser.user'),
|
||||
'pass' => $config->getParam('dbuser.pass'),
|
||||
'port' => (int) $config->getParam('dbuser.port'),
|
||||
'host' => $config->getParam('dbuser.host'),
|
||||
'user' => $config->getParam('dbuser.user'),
|
||||
'pass' => $config->getParam('dbuser.pass'),
|
||||
'port' => (int) $config->getParam('dbuser.port'),
|
||||
'socket' => $config->getParam('dbuser.socket'),
|
||||
);
|
||||
}
|
||||
|
|
@ -147,31 +173,36 @@ abstract class Msd_Db
|
|||
*
|
||||
* @return bool if connection is successfull
|
||||
* */
|
||||
abstract protected function _dbConnect ();
|
||||
abstract protected function _dbConnect();
|
||||
|
||||
/**
|
||||
* Get selected database
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
abstract public function getSelectedDb ();
|
||||
abstract public function getSelectedDb();
|
||||
|
||||
/**
|
||||
* Get version nr of sql server
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
abstract public function getServerInfo ();
|
||||
abstract public function getServerInfo();
|
||||
|
||||
/**
|
||||
* Get version nr of sql client
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
abstract public function getClientInfo ();
|
||||
abstract public function getClientInfo();
|
||||
|
||||
/**
|
||||
* Get all known character sets of this SQL-Server.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
abstract public function getCharsets ();
|
||||
abstract public function getCharsets();
|
||||
|
||||
/**
|
||||
* Set character set of the MySQL-connection.
|
||||
*
|
||||
|
|
@ -179,12 +210,14 @@ abstract class Msd_Db
|
|||
* Throw Exception on failure.
|
||||
*
|
||||
* @param string $charset
|
||||
*
|
||||
* @throws Exception
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
abstract public function setConnectionCharset (
|
||||
$charset = 'utf8');
|
||||
abstract public function setConnectionCharset(
|
||||
$charset = 'utf8');
|
||||
|
||||
/**
|
||||
* Get list of databases
|
||||
*
|
||||
|
|
@ -194,36 +227,39 @@ abstract class Msd_Db
|
|||
*
|
||||
* @return array
|
||||
*/
|
||||
abstract public function getDatabases ();
|
||||
abstract public function getDatabases();
|
||||
|
||||
/**
|
||||
* Select the given database to use it as the target for following queries.
|
||||
*
|
||||
* Returns true if selection was succesfull otherwise false.
|
||||
*
|
||||
* @throws Exception
|
||||
*
|
||||
* @param string $database
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
abstract public function selectDb ($database);
|
||||
abstract public function selectDb($database);
|
||||
|
||||
/**
|
||||
* Execute a query and set _resultHandle
|
||||
*
|
||||
* If $getRows is true alls rows are fetched and returned
|
||||
*
|
||||
* @param string $query The query to execute
|
||||
* @param const $kind Type of result set
|
||||
* @param int $kind Type of result set
|
||||
* @param boolean $getRows Whether to fetch all rows and return them
|
||||
*
|
||||
* @return boolean|array
|
||||
*/
|
||||
abstract public function query ($query,
|
||||
$kind = self::ARRAY_OBJECT, $getRows = true);
|
||||
abstract public function query($query,
|
||||
$kind = self::ARRAY_OBJECT, $getRows = true);
|
||||
|
||||
/**
|
||||
* Get next row from result set
|
||||
*
|
||||
* @param const $kind
|
||||
* @param int $kind
|
||||
*
|
||||
* @return array|object
|
||||
*/
|
||||
|
|
@ -236,7 +272,8 @@ abstract class Msd_Db
|
|||
*
|
||||
* @return array
|
||||
*/
|
||||
abstract public function getTables ($dbName);
|
||||
abstract public function getTables($dbName);
|
||||
|
||||
/**
|
||||
* Gets extended table information for one or all tables
|
||||
*
|
||||
|
|
@ -244,16 +281,19 @@ abstract class Msd_Db
|
|||
*
|
||||
* @return array
|
||||
*/
|
||||
abstract public function getTableStatus ($table = false);
|
||||
abstract public function getTableStatus($table = false);
|
||||
|
||||
/**
|
||||
* Returns the CREATE Statement of a table.
|
||||
*
|
||||
* @throws Exception
|
||||
*
|
||||
* @param string $table Get CREATE-Statement for this table
|
||||
*
|
||||
* @return string Create statement
|
||||
*/
|
||||
abstract public function getTableCreate ($table);
|
||||
abstract public function getTableCreate($table);
|
||||
|
||||
/**
|
||||
* Gets the full description of all columns of a table
|
||||
*
|
||||
|
|
@ -263,19 +303,23 @@ abstract class Msd_Db
|
|||
*
|
||||
* @return array
|
||||
*/
|
||||
abstract public function getTableColumns ($table);
|
||||
abstract public function getTableColumns($table);
|
||||
|
||||
/**
|
||||
* Gets the number of affected rows of the last query
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
abstract public function getAffectedRows ();
|
||||
abstract public function getAffectedRows();
|
||||
|
||||
/**
|
||||
* Gets the servers variables
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
abstract public function getVariables ();
|
||||
|
||||
abstract public function getVariables();
|
||||
|
||||
/**
|
||||
* Escape a value for inserting it in query
|
||||
*
|
||||
|
|
@ -283,7 +327,8 @@ abstract class Msd_Db
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
abstract public function escape ($val);
|
||||
abstract public function escape($val);
|
||||
|
||||
/**
|
||||
* Optimize a table. Returns true on success or MySQL-Error.
|
||||
*
|
||||
|
|
@ -291,7 +336,9 @@ abstract class Msd_Db
|
|||
*
|
||||
* @return string|bool Returned optimize message or false on error
|
||||
*/
|
||||
abstract public function optimizeTable ($table);
|
||||
|
||||
abstract public function optimizeTable($table);
|
||||
|
||||
/**
|
||||
* Creates a new database with the given name, charackter set and collation.
|
||||
*
|
||||
|
|
@ -308,6 +355,7 @@ abstract class Msd_Db
|
|||
$databaseCharset = '',
|
||||
$databaseCollation = ''
|
||||
);
|
||||
|
||||
/**
|
||||
* Retrieves the collations from information schema.
|
||||
*
|
||||
|
|
@ -316,6 +364,7 @@ abstract class Msd_Db
|
|||
* @return array
|
||||
*/
|
||||
abstract public function getCollations($charsetName = null);
|
||||
|
||||
/**
|
||||
* Retrieves the default collation for the charset or the given charset.
|
||||
*
|
||||
|
|
@ -324,22 +373,25 @@ abstract class Msd_Db
|
|||
* @return array|string
|
||||
*/
|
||||
abstract public function getDefaultCollations($charsetName = null);
|
||||
|
||||
/**
|
||||
* Retrieves the last MySQL error.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
abstract public function getLastError();
|
||||
|
||||
/**
|
||||
* Handles a SQL-Error
|
||||
*
|
||||
* @param string $errmsg
|
||||
* @param int $errno
|
||||
* @throws MsdEception
|
||||
*
|
||||
* @throws Msd_Exception
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function sqlError ($errmsg, $errno)
|
||||
public function sqlError($errmsg, $errno)
|
||||
{
|
||||
throw new Msd_Exception($errmsg, $errno);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ class Msd_Db_Mysql extends Msd_Db_MysqlCommon
|
|||
* is returned.
|
||||
*
|
||||
* @param string $query The query to execute
|
||||
* @param const $kind Type of result set
|
||||
* @param int $kind Type of result set
|
||||
* @param boolean $getRows Wether to fetch all rows and return them
|
||||
*
|
||||
* @return boolean|array
|
||||
|
|
@ -175,6 +175,8 @@ class Msd_Db_Mysql extends Msd_Db_MysqlCommon
|
|||
$this->_resultHandle = null;
|
||||
return $ret;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -182,7 +184,7 @@ class Msd_Db_Mysql extends Msd_Db_MysqlCommon
|
|||
*
|
||||
* Can be used to walk through result sets.
|
||||
*
|
||||
* @param const $kind
|
||||
* @param int $kind
|
||||
*
|
||||
* @return array|object
|
||||
*/
|
||||
|
|
@ -199,6 +201,8 @@ class Msd_Db_Mysql extends Msd_Db_MysqlCommon
|
|||
case self::ARRAY_ASSOC:
|
||||
return mysql_fetch_array($this->_resultHandle, MYSQL_ASSOC);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -228,7 +232,7 @@ class Msd_Db_Mysql extends Msd_Db_MysqlCommon
|
|||
/**
|
||||
* Retrieves the last MySQL error.
|
||||
*
|
||||
* @return void
|
||||
* @return array
|
||||
*/
|
||||
public function getLastError()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -161,8 +161,7 @@ class Msd_Db_Mysqli extends Msd_Db_MysqlCommon
|
|||
$this->_getHandle()->errno
|
||||
);
|
||||
}
|
||||
if (!$this->_resultHandle instanceof mysqli_result
|
||||
|| $kind === self::SIMPLE) {
|
||||
if (!$this->_resultHandle instanceof mysqli_result || $kind === self::SIMPLE) {
|
||||
return $this->_resultHandle;
|
||||
}
|
||||
// return result set?
|
||||
|
|
|
|||
|
|
@ -16,6 +16,27 @@
|
|||
*/
|
||||
class Msd_Registry extends Zend_Registry
|
||||
{
|
||||
/**
|
||||
* Key for the configuration filename. This is used inside the registry.
|
||||
*
|
||||
* @const string
|
||||
*/
|
||||
const CONFIG_FILENAME_KEY = '_configFilename';
|
||||
|
||||
/**
|
||||
* Key for the dynamic configuration. This is used inside the registry.
|
||||
*
|
||||
* @const string
|
||||
*/
|
||||
const DYNAMIC_CONFIG_KEY = '_dynamic';
|
||||
|
||||
/**
|
||||
* Key for the configuration. This is used inside the registry.
|
||||
*
|
||||
* @const string
|
||||
*/
|
||||
const CONFIG_KEY = '_config';
|
||||
|
||||
/**
|
||||
* Returns the config instance if it has been registered, returns null otherwise.
|
||||
*
|
||||
|
|
@ -23,8 +44,8 @@ class Msd_Registry extends Zend_Registry
|
|||
*/
|
||||
public static function getConfig()
|
||||
{
|
||||
if (self::isRegistered('_config')) {
|
||||
return self::get('_config');
|
||||
if (self::isRegistered(self::CONFIG_KEY)) {
|
||||
return self::get(self::CONFIG_KEY);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
@ -41,7 +62,7 @@ class Msd_Registry extends Zend_Registry
|
|||
*/
|
||||
public static function setConfig(Msd_Config $config)
|
||||
{
|
||||
self::set('_config', $config);
|
||||
self::set(self::CONFIG_KEY . '', $config);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -53,8 +74,8 @@ class Msd_Registry extends Zend_Registry
|
|||
*/
|
||||
public static function getDynamicConfig()
|
||||
{
|
||||
if (self::isRegistered('_dynamic')) {
|
||||
return self::get('_dynamic');
|
||||
if (self::isRegistered(self::DYNAMIC_CONFIG_KEY)) {
|
||||
return self::get(self::DYNAMIC_CONFIG_KEY);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
@ -71,6 +92,31 @@ class Msd_Registry extends Zend_Registry
|
|||
*/
|
||||
public static function setDynamicConfig(Msd_Config_Dynamic $config)
|
||||
{
|
||||
self::set('_dynamic', $config);
|
||||
self::set(self::DYNAMIC_CONFIG_KEY, $config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the name of the current configuration file.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getConfigFilename()
|
||||
{
|
||||
if (self::isRegistered(self::CONFIG_FILENAME_KEY)) {
|
||||
return self::get(self::CONFIG_FILENAME_KEY);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the name of the current configuration file.
|
||||
*
|
||||
* @param string $configFilename Name of configuration file.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function setConfigFilename($configFilename)
|
||||
{
|
||||
self::set(self::CONFIG_FILENAME_KEY, $configFilename);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Laden …
Tabelle hinzufügen
Einen Link hinzufügen
In neuem Issue referenzieren