1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 22:10:45 +02:00

[task/config-class] Implemented a config class to replace the global array.

There is a phpbb_config class which simply holds an array and does not persist
any data. It implements ArrayAccess, Countable and IteratorAggregate to allow
regular use of configuration as if it was still an array. The phpbb_config_db
class depends on an instance of the dbal and a cache driver. It obtains the
configuration data from cache and database as necessary and persists data to
the database.

The functions set_config and set_config_count remain for backward compatability
but they only call methods on the new config class now instead of directly
manipulating the database and cache.

PHPBB3-9988
This commit is contained in:
Nils Adermann
2011-01-10 02:27:18 +01:00
parent 5ea59ba322
commit fb2642bbc6
20 changed files with 703 additions and 154 deletions

View File

@@ -447,6 +447,28 @@ class dbal
return $column_name . ' | ' . (1 << $bit) . (($compare) ? ' ' . $compare : '');
}
/**
* Returns SQL string to cast a string expression to an int.
*
* @param string $expression An expression evaluating to string
* @return string Expression returning an int
*/
function cast_expr_to_bigint($expression)
{
return $expression;
}
/**
* Returns SQL string to cast an integer expression to a string.
*
* @param string $expression An expression evaluating to int
* @return string Expression returning a string
*/
function cast_expr_to_string($expression)
{
return $expression;
}
/**
* Run more than one insert statement.
*

View File

@@ -465,6 +465,22 @@ class dbal_firebird extends dbal
return 'BIN_OR(' . $column_name . ', ' . (1 << $bit) . ')' . (($compare) ? ' ' . $compare : '');
}
/**
* @inheritdoc
*/
function cast_expr_to_bigint($expression)
{
return 'CAST(' . $expression . ' as DECIMAL(255, 0))';
}
/**
* @inheritdoc
*/
function cast_expr_to_string($expression)
{
return 'CAST(' . $expression . ' as VARCHAR(255))';
}
/**
* return sql error array
* @access private

View File

@@ -365,6 +365,22 @@ class dbal_postgres extends dbal
return $expression;
}
/**
* @inheritdoc
*/
function cast_expr_to_bigint($expression)
{
return 'CAST(' . $expression . ' as DECIMAL(255, 0))';
}
/**
* @inheritdoc
*/
function cast_expr_to_string($expression)
{
return 'CAST(' . $expression . ' as VARCHAR(255))';
}
/**
* return sql error array
* @access private