mirror of
https://github.com/phpbb/phpbb.git
synced 2025-05-04 14:47:52 +02:00
Merge branch 'develop' of github.com:EXreaction/phpbb3 into ticket/11103
Conflicts: phpBB/install/database_update.php phpBB/styles/prosilver/template/ucp_prefs_personal.html phpBB/styles/subsilver2/template/ucp_prefs_personal.html
This commit is contained in:
commit
0042f07147
@ -35,7 +35,7 @@ class phpbb_Sniffs_Commenting_FileCommentSniff implements PHP_CodeSniffer_Sniff
|
||||
* @param int $stackPtr The position of the current token
|
||||
* in the stack passed in $tokens.
|
||||
*
|
||||
* @return void
|
||||
* @return null
|
||||
*/
|
||||
public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
|
||||
{
|
||||
@ -120,7 +120,7 @@ class phpbb_Sniffs_Commenting_FileCommentSniff implements PHP_CodeSniffer_Sniff
|
||||
* @param integer The stack pointer for the first comment token.
|
||||
* @param array(string=>array) $tags The found file doc comment tags.
|
||||
*
|
||||
* @return void
|
||||
* @return null
|
||||
*/
|
||||
protected function processPackage(PHP_CodeSniffer_File $phpcsFile, $ptr, $tags)
|
||||
{
|
||||
@ -143,7 +143,7 @@ class phpbb_Sniffs_Commenting_FileCommentSniff implements PHP_CodeSniffer_Sniff
|
||||
* @param integer The stack pointer for the first comment token.
|
||||
* @param array(string=>array) $tags The found file doc comment tags.
|
||||
*
|
||||
* @return void
|
||||
* @return null
|
||||
*/
|
||||
protected function processVersion(PHP_CodeSniffer_File $phpcsFile, $ptr, $tags)
|
||||
{
|
||||
@ -166,7 +166,7 @@ class phpbb_Sniffs_Commenting_FileCommentSniff implements PHP_CodeSniffer_Sniff
|
||||
* @param integer The stack pointer for the first comment token.
|
||||
* @param array(string=>array) $tags The found file doc comment tags.
|
||||
*
|
||||
* @return void
|
||||
* @return null
|
||||
*/
|
||||
protected function processCopyright(PHP_CodeSniffer_File $phpcsFile, $ptr, $tags)
|
||||
{
|
||||
@ -189,7 +189,7 @@ class phpbb_Sniffs_Commenting_FileCommentSniff implements PHP_CodeSniffer_Sniff
|
||||
* @param integer The stack pointer for the first comment token.
|
||||
* @param array(string=>array) $tags The found file doc comment tags.
|
||||
*
|
||||
* @return void
|
||||
* @return null
|
||||
*/
|
||||
protected function processLicense(PHP_CodeSniffer_File $phpcsFile, $ptr, $tags)
|
||||
{
|
||||
|
@ -36,7 +36,7 @@ phpbb.add_ajax_callback('row_down', function() {
|
||||
overlay: false
|
||||
});
|
||||
|
||||
tr_swap.find('.up').html(img_templates.up_disabled);
|
||||
tr_swap.find('.up').html(img_templates.up_disabled.clone());
|
||||
}
|
||||
|
||||
tr.insertAfter(tr_swap);
|
||||
@ -48,7 +48,7 @@ phpbb.add_ajax_callback('row_down', function() {
|
||||
*/
|
||||
if (tr.is(':last-child'))
|
||||
{
|
||||
tr.find('.down').html(img_templates.down_disabled);
|
||||
tr.find('.down').html(img_templates.down_disabled.clone());
|
||||
|
||||
var down_img = img_templates.down.clone().attr('href', tr_swap.attr('data-down'));
|
||||
tr_swap.find('.down').html(down_img);
|
||||
@ -82,7 +82,7 @@ phpbb.add_ajax_callback('row_up', function() {
|
||||
overlay: false
|
||||
});
|
||||
|
||||
tr_swap.find('.down').html(img_templates.down_disabled);
|
||||
tr_swap.find('.down').html(img_templates.down_disabled.clone());
|
||||
}
|
||||
|
||||
tr.insertBefore(tr_swap);
|
||||
@ -94,7 +94,7 @@ phpbb.add_ajax_callback('row_up', function() {
|
||||
*/
|
||||
if (tr.is(':first-child'))
|
||||
{
|
||||
tr.find('.up').html(img_templates.up_disabled);
|
||||
tr.find('.up').html(img_templates.up_disabled.clone());
|
||||
|
||||
var up_img = img_templates.up.clone().attr('href', tr_swap.attr('data-up'));
|
||||
tr_swap.find('.up').html(up_img);
|
||||
|
@ -9,6 +9,6 @@
|
||||
"symfony/yaml": "2.1.*"
|
||||
},
|
||||
"require-dev": {
|
||||
"fabpot/goutte": "1.0.x-dev"
|
||||
"fabpot/goutte": "v0.1.0"
|
||||
}
|
||||
}
|
||||
|
170
phpBB/composer.lock
generated
170
phpBB/composer.lock
generated
@ -1,5 +1,5 @@
|
||||
{
|
||||
"hash": "efb4768ba71d7cd2c84baa0610d84067",
|
||||
"hash": "c1a76530df6b9daa16b8033d61b76503",
|
||||
"packages": [
|
||||
{
|
||||
"name": "symfony/config",
|
||||
@ -381,29 +381,29 @@
|
||||
"packages-dev": [
|
||||
{
|
||||
"name": "fabpot/goutte",
|
||||
"version": "dev-master",
|
||||
"version": "v0.1.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/fabpot/Goutte",
|
||||
"reference": "f2940f9c7c1f409159f5e9f512e575946c5cff48"
|
||||
"reference": "v0.1.0"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://github.com/fabpot/Goutte/archive/f2940f9c7c1f409159f5e9f512e575946c5cff48.zip",
|
||||
"reference": "f2940f9c7c1f409159f5e9f512e575946c5cff48",
|
||||
"url": "https://github.com/fabpot/Goutte/archive/v0.1.0.zip",
|
||||
"reference": "v0.1.0",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0",
|
||||
"ext-curl": "*",
|
||||
"symfony/browser-kit": "2.1.*",
|
||||
"symfony/css-selector": "2.1.*",
|
||||
"symfony/dom-crawler": "2.1.*",
|
||||
"symfony/finder": "2.1.*",
|
||||
"symfony/process": "2.1.*",
|
||||
"ext-curl": "*",
|
||||
"guzzle/http": "2.8.*"
|
||||
"guzzle/guzzle": "3.0.*"
|
||||
},
|
||||
"time": "1351086217",
|
||||
"time": "2012-12-02 13:44:35",
|
||||
"type": "application",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
@ -432,126 +432,90 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "guzzle/common",
|
||||
"version": "v2.8.8",
|
||||
"target-dir": "Guzzle/Common",
|
||||
"name": "guzzle/guzzle",
|
||||
"version": "v3.0.5",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/guzzle/common.git",
|
||||
"reference": "v2.8.8"
|
||||
"url": "https://github.com/guzzle/guzzle",
|
||||
"reference": "v3.0.5"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://github.com/guzzle/common/zipball/v2.8.8",
|
||||
"reference": "v2.8.8",
|
||||
"url": "https://github.com/guzzle/guzzle/archive/v3.0.5.zip",
|
||||
"reference": "v3.0.5",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.2",
|
||||
"ext-curl": "*",
|
||||
"symfony/event-dispatcher": "2.1.*"
|
||||
},
|
||||
"time": "2012-10-15 17:42:47",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Guzzle\\Common": ""
|
||||
}
|
||||
},
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"description": "Common libraries used by Guzzle",
|
||||
"homepage": "http://guzzlephp.org/",
|
||||
"keywords": [
|
||||
"log",
|
||||
"event",
|
||||
"cache",
|
||||
"validation",
|
||||
"Socket",
|
||||
"common",
|
||||
"batch",
|
||||
"inflection"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "guzzle/http",
|
||||
"version": "v2.8.8",
|
||||
"target-dir": "Guzzle/Http",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/guzzle/http.git",
|
||||
"reference": "v2.8.8"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://github.com/guzzle/http/zipball/v2.8.8",
|
||||
"reference": "v2.8.8",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.2",
|
||||
"replace": {
|
||||
"guzzle/batch": "self.version",
|
||||
"guzzle/cache": "self.version",
|
||||
"guzzle/common": "self.version",
|
||||
"guzzle/parser": "self.version"
|
||||
"guzzle/http": "self.version",
|
||||
"guzzle/inflection": "self.version",
|
||||
"guzzle/iterator": "self.version",
|
||||
"guzzle/log": "self.version",
|
||||
"guzzle/parser": "self.version",
|
||||
"guzzle/plugin": "self.version",
|
||||
"guzzle/plugin-async": "self.version",
|
||||
"guzzle/plugin-backoff": "self.version",
|
||||
"guzzle/plugin-cache": "self.version",
|
||||
"guzzle/plugin-cookie": "self.version",
|
||||
"guzzle/plugin-curlauth": "self.version",
|
||||
"guzzle/plugin-history": "self.version",
|
||||
"guzzle/plugin-log": "self.version",
|
||||
"guzzle/plugin-md5": "self.version",
|
||||
"guzzle/plugin-mock": "self.version",
|
||||
"guzzle/plugin-oauth": "self.version",
|
||||
"guzzle/service": "self.version",
|
||||
"guzzle/stream": "self.version"
|
||||
},
|
||||
"time": "2012-10-15 17:42:47",
|
||||
"require-dev": {
|
||||
"doctrine/common": "*",
|
||||
"symfony/class-loader": "*",
|
||||
"monolog/monolog": "1.*",
|
||||
"zendframework/zend-cache": "2.0.*",
|
||||
"zendframework/zend-log": "2.0.*",
|
||||
"zend/zend-log1": "1.12",
|
||||
"zend/zend-cache1": "1.12",
|
||||
"phpunit/phpunit": "3.7.*"
|
||||
},
|
||||
"time": "2012-11-19 00:15:33",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Guzzle\\Http": ""
|
||||
"Guzzle\\Tests": "tests/",
|
||||
"Guzzle": "src/"
|
||||
}
|
||||
},
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"description": "HTTP libraries used by Guzzle",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Michael Dowling",
|
||||
"email": "mtdowling@gmail.com",
|
||||
"homepage": "https://github.com/mtdowling"
|
||||
},
|
||||
{
|
||||
"name": "Guzzle Community",
|
||||
"homepage": "https://github.com/guzzle/guzzle/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Guzzle is a PHP HTTP client library and framework for building RESTful web service clients",
|
||||
"homepage": "http://guzzlephp.org/",
|
||||
"keywords": [
|
||||
"framework",
|
||||
"curl",
|
||||
"http",
|
||||
"rest",
|
||||
"http client",
|
||||
"client",
|
||||
"Guzzle"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "guzzle/parser",
|
||||
"version": "v2.8.8",
|
||||
"target-dir": "Guzzle/Parser",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/guzzle/parser.git",
|
||||
"reference": "v2.8.8"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://github.com/guzzle/parser/zipball/v2.8.8",
|
||||
"reference": "v2.8.8",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.2"
|
||||
},
|
||||
"time": "2012-09-20 13:28:06",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Guzzle\\Parser": ""
|
||||
}
|
||||
},
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"description": "Interchangeable parsers used by Guzzle",
|
||||
"homepage": "http://guzzlephp.org/",
|
||||
"keywords": [
|
||||
"http",
|
||||
"url",
|
||||
"message",
|
||||
"cookie",
|
||||
"URI Template"
|
||||
"web service"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -808,7 +772,7 @@
|
||||
|
||||
],
|
||||
"minimum-stability": "beta",
|
||||
"stability-flags": {
|
||||
"fabpot/goutte": 20
|
||||
}
|
||||
"stability-flags": [
|
||||
|
||||
]
|
||||
}
|
||||
|
@ -60,15 +60,6 @@ services:
|
||||
- @service_container
|
||||
- @ext.finder
|
||||
|
||||
controller.route_collection:
|
||||
class: phpbb_controller_route_collection
|
||||
arguments:
|
||||
- @ext.finder
|
||||
- @controller.provider
|
||||
|
||||
controller.provider:
|
||||
class: phpbb_controller_provider
|
||||
|
||||
cron.task_collection:
|
||||
class: phpbb_di_service_collection
|
||||
arguments:
|
||||
|
@ -111,7 +111,7 @@ function my_var_export($var)
|
||||
* Download a file to the develop/ dir
|
||||
*
|
||||
* @param string $url URL of the file to download
|
||||
* @return void
|
||||
* @return null
|
||||
*/
|
||||
function download($url)
|
||||
{
|
||||
|
@ -199,7 +199,7 @@ function my_var_export($var)
|
||||
* Download a file to the develop/ dir
|
||||
*
|
||||
* @param string $url URL of the file to download
|
||||
* @return void
|
||||
* @return null
|
||||
*/
|
||||
function download($url)
|
||||
{
|
||||
|
@ -481,7 +481,7 @@ function my_var_export($var)
|
||||
* Download a file to the develop/ dir
|
||||
*
|
||||
* @param string $url URL of the file to download
|
||||
* @return void
|
||||
* @return null
|
||||
*/
|
||||
function download($url)
|
||||
{
|
||||
|
@ -222,7 +222,7 @@ die("\n\nALL TESTS PASSED SUCCESSFULLY\n");
|
||||
* Download a file to the develop/ dir
|
||||
*
|
||||
* @param string $url URL of the file to download
|
||||
* @return void
|
||||
* @return null
|
||||
*/
|
||||
function download($url)
|
||||
{
|
||||
|
@ -132,7 +132,7 @@
|
||||
<li>A SQL database system, <strong>one of</strong>:
|
||||
<ul>
|
||||
<li>MySQL 3.23 or above (MySQLi supported)</li>
|
||||
<li>PostgreSQL 7.3+</li>
|
||||
<li>PostgreSQL 8.3+</li>
|
||||
<li>SQLite 2.8.2+ (SQLite 3 is not supported)</li>
|
||||
<li>Firebird 2.1+</li>
|
||||
<li>MS SQL Server 2000 or above (directly or via ODBC or the native adapter)</li>
|
||||
|
@ -193,7 +193,7 @@ $user_id = 2;
|
||||
$auth->acl_clear_prefetch($user_id);
|
||||
</pre></div>
|
||||
|
||||
<p>This method returns void.</p>
|
||||
<p>This method returns null.</p>
|
||||
|
||||
<a name="acl_get_list"></a><h3>2.viii. acl_get_list</h3>
|
||||
|
||||
|
@ -740,7 +740,7 @@ static private function f()
|
||||
<a name="sql"></a><h3>2.iii. SQL/SQL Layout</h3>
|
||||
|
||||
<h4>Common SQL Guidelines: </h4>
|
||||
<p>All SQL should be cross-DB compatible, if DB specific SQL is used alternatives must be provided which work on all supported DB's (MySQL3/4/5, MSSQL (7.0 and 2000), PostgreSQL (7.0+), Firebird, SQLite, Oracle8, ODBC (generalised if possible)).</p>
|
||||
<p>All SQL should be cross-DB compatible, if DB specific SQL is used alternatives must be provided which work on all supported DB's (MySQL3/4/5, MSSQL (7.0 and 2000), PostgreSQL (8.3+), Firebird, SQLite, Oracle8, ODBC (generalised if possible)).</p>
|
||||
<p>All SQL commands should utilise the DataBase Abstraction Layer (DBAL)</p>
|
||||
|
||||
<h4>SQL code layout:</h4>
|
||||
|
2
phpBB/includes/cache/driver/apc.php
vendored
2
phpBB/includes/cache/driver/apc.php
vendored
@ -26,7 +26,7 @@ class phpbb_cache_driver_apc extends phpbb_cache_driver_memory
|
||||
/**
|
||||
* Purge cache data
|
||||
*
|
||||
* @return void
|
||||
* @return null
|
||||
*/
|
||||
function purge()
|
||||
{
|
||||
|
4
phpBB/includes/cache/driver/eaccelerator.php
vendored
4
phpBB/includes/cache/driver/eaccelerator.php
vendored
@ -30,7 +30,7 @@ class phpbb_cache_driver_eaccelerator extends phpbb_cache_driver_memory
|
||||
/**
|
||||
* Purge cache data
|
||||
*
|
||||
* @return void
|
||||
* @return null
|
||||
*/
|
||||
function purge()
|
||||
{
|
||||
@ -47,7 +47,7 @@ class phpbb_cache_driver_eaccelerator extends phpbb_cache_driver_memory
|
||||
/**
|
||||
* Perform cache garbage collection
|
||||
*
|
||||
* @return void
|
||||
* @return null
|
||||
*/
|
||||
function tidy()
|
||||
{
|
||||
|
20
phpBB/includes/cache/driver/file.php
vendored
20
phpBB/includes/cache/driver/file.php
vendored
@ -388,10 +388,10 @@ class phpbb_cache_driver_file extends phpbb_cache_driver_base
|
||||
|
||||
if ($this->_write('sql_' . md5($query), $this->sql_rowset[$query_id], $ttl + time(), $query))
|
||||
{
|
||||
$query_result = $query_id;
|
||||
return $query_id;
|
||||
}
|
||||
|
||||
return $query_id;
|
||||
return $query_result;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -653,10 +653,11 @@ class phpbb_cache_driver_file extends phpbb_cache_driver_base
|
||||
|
||||
$file = "{$this->cache_dir}$filename.$phpEx";
|
||||
|
||||
$lock = new phpbb_lock_flock($file);
|
||||
$lock->acquire();
|
||||
|
||||
if ($handle = @fopen($file, 'wb'))
|
||||
{
|
||||
@flock($handle, LOCK_EX);
|
||||
|
||||
// File header
|
||||
fwrite($handle, '<' . '?php exit; ?' . '>');
|
||||
|
||||
@ -697,7 +698,6 @@ class phpbb_cache_driver_file extends phpbb_cache_driver_base
|
||||
fwrite($handle, $data);
|
||||
}
|
||||
|
||||
@flock($handle, LOCK_UN);
|
||||
fclose($handle);
|
||||
|
||||
if (!function_exists('phpbb_chmod'))
|
||||
@ -708,10 +708,16 @@ class phpbb_cache_driver_file extends phpbb_cache_driver_base
|
||||
|
||||
phpbb_chmod($file, CHMOD_READ | CHMOD_WRITE);
|
||||
|
||||
return true;
|
||||
$return_value = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$return_value = false;
|
||||
}
|
||||
|
||||
return false;
|
||||
$lock->release();
|
||||
|
||||
return $return_value;
|
||||
}
|
||||
|
||||
/**
|
||||
|
47
phpBB/includes/cache/driver/interface.php
vendored
47
phpBB/includes/cache/driver/interface.php
vendored
@ -63,42 +63,81 @@ interface phpbb_cache_driver_interface
|
||||
public function destroy($var_name, $table = '');
|
||||
|
||||
/**
|
||||
* Check if a given cache entry exist
|
||||
* Check if a given cache entry exists
|
||||
*/
|
||||
public function _exists($var_name);
|
||||
|
||||
/**
|
||||
* Load cached sql query
|
||||
* Load result of an SQL query from cache.
|
||||
*
|
||||
* @param string $query SQL query
|
||||
*
|
||||
* @return int|bool Query ID (integer) if cache contains a rowset
|
||||
* for the specified query.
|
||||
* False otherwise.
|
||||
*/
|
||||
public function sql_load($query);
|
||||
|
||||
/**
|
||||
* Save sql query
|
||||
* Save result of an SQL query in cache.
|
||||
*
|
||||
* In persistent cache stores, this function stores the query
|
||||
* result to persistent storage. In other words, there is no need
|
||||
* to call save() afterwards.
|
||||
*
|
||||
* @param string $query SQL query, should be used for generating storage key
|
||||
* @param mixed $query_result The result from dbal::sql_query, to be passed to
|
||||
* dbal::sql_fetchrow to get all rows and store them
|
||||
* in cache.
|
||||
* @param int $ttl Time to live, after this timeout the query should
|
||||
* expire from the cache.
|
||||
* @return int|mixed If storing in cache succeeded, an integer $query_id
|
||||
* representing the query should be returned. Otherwise
|
||||
* the original $query_result should be returned.
|
||||
*/
|
||||
public function sql_save($query, $query_result, $ttl);
|
||||
|
||||
/**
|
||||
* Ceck if a given sql query exist in cache
|
||||
* Check if result for a given SQL query exists in cache.
|
||||
*
|
||||
* @param int $query_id
|
||||
* @return bool
|
||||
*/
|
||||
public function sql_exists($query_id);
|
||||
|
||||
/**
|
||||
* Fetch row from cache (database)
|
||||
*
|
||||
* @param int $query_id
|
||||
* @return array|bool The query result if found in the cache, otherwise
|
||||
* false.
|
||||
*/
|
||||
public function sql_fetchrow($query_id);
|
||||
|
||||
/**
|
||||
* Fetch a field from the current row of a cached database result (database)
|
||||
*
|
||||
* @param int $query_id
|
||||
* @param $field The name of the column.
|
||||
* @return string|bool The field of the query result if found in the cache,
|
||||
* otherwise false.
|
||||
*/
|
||||
public function sql_fetchfield($query_id, $field);
|
||||
|
||||
/**
|
||||
* Seek a specific row in an a cached database result (database)
|
||||
*
|
||||
* @param int $rownum Row to seek to.
|
||||
* @param int $query_id
|
||||
* @return bool
|
||||
*/
|
||||
public function sql_rowseek($rownum, $query_id);
|
||||
|
||||
/**
|
||||
* Free memory used for a cached database result (database)
|
||||
*
|
||||
* @param int $query_id
|
||||
* @return bool
|
||||
*/
|
||||
public function sql_freeresult($query_id);
|
||||
}
|
||||
|
4
phpBB/includes/cache/driver/memcache.php
vendored
4
phpBB/includes/cache/driver/memcache.php
vendored
@ -64,7 +64,7 @@ class phpbb_cache_driver_memcache extends phpbb_cache_driver_memory
|
||||
/**
|
||||
* Unload the cache resources
|
||||
*
|
||||
* @return void
|
||||
* @return null
|
||||
*/
|
||||
function unload()
|
||||
{
|
||||
@ -76,7 +76,7 @@ class phpbb_cache_driver_memcache extends phpbb_cache_driver_memory
|
||||
/**
|
||||
* Purge cache data
|
||||
*
|
||||
* @return void
|
||||
* @return null
|
||||
*/
|
||||
function purge()
|
||||
{
|
||||
|
4
phpBB/includes/cache/driver/memory.php
vendored
4
phpBB/includes/cache/driver/memory.php
vendored
@ -299,7 +299,7 @@ abstract class phpbb_cache_driver_memory extends phpbb_cache_driver_base
|
||||
if (!preg_match('/FROM \\(?(`?\\w+`?(?: \\w+)?(?:, ?`?\\w+`?(?: \\w+)?)*)\\)?/', $query, $regs))
|
||||
{
|
||||
// Bail out if the match fails.
|
||||
return;
|
||||
return $query_result;
|
||||
}
|
||||
$tables = array_map('trim', explode(',', $regs[1]));
|
||||
|
||||
@ -339,8 +339,6 @@ abstract class phpbb_cache_driver_memory extends phpbb_cache_driver_base
|
||||
|
||||
$this->_write('sql_' . $hash, $this->sql_rowset[$query_id], $ttl);
|
||||
|
||||
$query_result = $query_id;
|
||||
|
||||
return $query_id;
|
||||
}
|
||||
|
||||
|
1
phpBB/includes/cache/driver/null.php
vendored
1
phpBB/includes/cache/driver/null.php
vendored
@ -109,6 +109,7 @@ class phpbb_cache_driver_null extends phpbb_cache_driver_base
|
||||
*/
|
||||
function sql_save($query, $query_result, $ttl)
|
||||
{
|
||||
return $query_result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
32
phpBB/includes/cache/driver/redis.php
vendored
32
phpBB/includes/cache/driver/redis.php
vendored
@ -39,13 +39,39 @@ class phpbb_cache_driver_redis extends phpbb_cache_driver_memory
|
||||
|
||||
var $redis;
|
||||
|
||||
/**
|
||||
* Creates a redis cache driver.
|
||||
*
|
||||
* The following global constants affect operation:
|
||||
*
|
||||
* PHPBB_ACM_REDIS_HOST
|
||||
* PHPBB_ACM_REDIS_PORT
|
||||
* PHPBB_ACM_REDIS_PASSWORD
|
||||
* PHPBB_ACM_REDIS_DB
|
||||
*
|
||||
* There are no publicly documented constructor parameters.
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
// Call the parent constructor
|
||||
parent::__construct();
|
||||
|
||||
$this->redis = new Redis();
|
||||
$this->redis->connect(PHPBB_ACM_REDIS_HOST, PHPBB_ACM_REDIS_PORT);
|
||||
|
||||
$args = func_get_args();
|
||||
if (!empty($args))
|
||||
{
|
||||
$ok = call_user_func_array(array($this->redis, 'connect'), $args);
|
||||
}
|
||||
else
|
||||
{
|
||||
$ok = $this->redis->connect(PHPBB_ACM_REDIS_HOST, PHPBB_ACM_REDIS_PORT);
|
||||
}
|
||||
|
||||
if (!$ok)
|
||||
{
|
||||
trigger_error('Could not connect to redis server');
|
||||
}
|
||||
|
||||
if (defined('PHPBB_ACM_REDIS_PASSWORD'))
|
||||
{
|
||||
@ -74,7 +100,7 @@ class phpbb_cache_driver_redis extends phpbb_cache_driver_memory
|
||||
/**
|
||||
* Unload the cache resources
|
||||
*
|
||||
* @return void
|
||||
* @return null
|
||||
*/
|
||||
function unload()
|
||||
{
|
||||
@ -86,7 +112,7 @@ class phpbb_cache_driver_redis extends phpbb_cache_driver_memory
|
||||
/**
|
||||
* Purge cache data
|
||||
*
|
||||
* @return void
|
||||
* @return null
|
||||
*/
|
||||
function purge()
|
||||
{
|
||||
|
2
phpBB/includes/cache/driver/wincache.php
vendored
2
phpBB/includes/cache/driver/wincache.php
vendored
@ -26,7 +26,7 @@ class phpbb_cache_driver_wincache extends phpbb_cache_driver_memory
|
||||
/**
|
||||
* Purge cache data
|
||||
*
|
||||
* @return void
|
||||
* @return null
|
||||
*/
|
||||
function purge()
|
||||
{
|
||||
|
2
phpBB/includes/cache/driver/xcache.php
vendored
2
phpBB/includes/cache/driver/xcache.php
vendored
@ -41,7 +41,7 @@ class phpbb_cache_driver_xcache extends phpbb_cache_driver_memory
|
||||
/**
|
||||
* Purge cache data
|
||||
*
|
||||
* @return void
|
||||
* @return null
|
||||
*/
|
||||
function purge()
|
||||
{
|
||||
|
@ -109,7 +109,7 @@ class phpbb_config implements ArrayAccess, IteratorAggregate, Countable
|
||||
* @param String $key The configuration option's name
|
||||
* @param bool $use_cache Whether this variable should be cached or if it
|
||||
* changes too frequently to be efficiently cached
|
||||
* @return void
|
||||
* @return null
|
||||
*/
|
||||
public function delete($key, $use_cache = true)
|
||||
{
|
||||
|
@ -96,7 +96,7 @@ class phpbb_config_db extends phpbb_config
|
||||
* @param String $key The configuration option's name
|
||||
* @param bool $use_cache Whether this variable should be cached or if it
|
||||
* changes too frequently to be efficiently cached
|
||||
* @return void
|
||||
* @return null
|
||||
*/
|
||||
public function delete($key, $use_cache = true)
|
||||
{
|
||||
|
@ -54,7 +54,7 @@ class phpbb_cron_manager
|
||||
*
|
||||
* @param array|Traversable $tasks Array of instances of phpbb_cron_task
|
||||
*
|
||||
* @return void
|
||||
* @return null
|
||||
*/
|
||||
public function load_tasks($tasks)
|
||||
{
|
||||
|
@ -50,7 +50,7 @@ class phpbb_cron_task_core_prune_all_forums extends phpbb_cron_task_base
|
||||
/**
|
||||
* Runs this cron task.
|
||||
*
|
||||
* @return void
|
||||
* @return null
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
|
@ -70,7 +70,7 @@ class phpbb_cron_task_core_prune_forum extends phpbb_cron_task_base implements p
|
||||
/**
|
||||
* Runs this cron task.
|
||||
*
|
||||
* @return void
|
||||
* @return null
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
@ -138,7 +138,7 @@ class phpbb_cron_task_core_prune_forum extends phpbb_cron_task_base implements p
|
||||
*
|
||||
* @param phpbb_request_interface $request Request object.
|
||||
*
|
||||
* @return void
|
||||
* @return null
|
||||
*/
|
||||
public function parse_parameters(phpbb_request_interface $request)
|
||||
{
|
||||
|
@ -43,7 +43,7 @@ class phpbb_cron_task_core_queue extends phpbb_cron_task_base
|
||||
/**
|
||||
* Runs this cron task.
|
||||
*
|
||||
* @return void
|
||||
* @return null
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
|
@ -40,7 +40,7 @@ class phpbb_cron_task_core_tidy_cache extends phpbb_cron_task_base
|
||||
/**
|
||||
* Runs this cron task.
|
||||
*
|
||||
* @return void
|
||||
* @return null
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
|
@ -43,7 +43,7 @@ class phpbb_cron_task_core_tidy_database extends phpbb_cron_task_base
|
||||
/**
|
||||
* Runs this cron task.
|
||||
*
|
||||
* @return void
|
||||
* @return null
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
|
@ -54,7 +54,7 @@ class phpbb_cron_task_core_tidy_search extends phpbb_cron_task_base
|
||||
/**
|
||||
* Runs this cron task.
|
||||
*
|
||||
* @return void
|
||||
* @return null
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
|
@ -40,7 +40,7 @@ class phpbb_cron_task_core_tidy_sessions extends phpbb_cron_task_base
|
||||
/**
|
||||
* Runs this cron task.
|
||||
*
|
||||
* @return void
|
||||
* @return null
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
|
@ -45,7 +45,7 @@ class phpbb_cron_task_core_tidy_warnings extends phpbb_cron_task_base
|
||||
/**
|
||||
* Runs this cron task.
|
||||
*
|
||||
* @return void
|
||||
* @return null
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
|
@ -46,7 +46,7 @@ interface phpbb_cron_task_parametrized extends phpbb_cron_task
|
||||
*
|
||||
* @param phpbb_request_interface $request Request object.
|
||||
*
|
||||
* @return void
|
||||
* @return null
|
||||
*/
|
||||
public function parse_parameters(phpbb_request_interface $request);
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ interface phpbb_cron_task
|
||||
/**
|
||||
* Runs this cron task.
|
||||
*
|
||||
* @return void
|
||||
* @return null
|
||||
*/
|
||||
public function run();
|
||||
|
||||
|
@ -24,11 +24,19 @@ include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
|
||||
*/
|
||||
class dbal_mssql extends dbal
|
||||
{
|
||||
var $connect_error = '';
|
||||
|
||||
/**
|
||||
* Connect to server
|
||||
*/
|
||||
function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false)
|
||||
{
|
||||
if (!function_exists('mssql_connect'))
|
||||
{
|
||||
$this->connect_error = 'mssql_connect function does not exist, is mssql extension installed?';
|
||||
return $this->sql_error('');
|
||||
}
|
||||
|
||||
$this->persistency = $persistency;
|
||||
$this->user = $sqluser;
|
||||
$this->dbname = $database;
|
||||
@ -355,34 +363,44 @@ class dbal_mssql extends dbal
|
||||
*/
|
||||
function _sql_error()
|
||||
{
|
||||
$error = array(
|
||||
'message' => @mssql_get_last_message(),
|
||||
'code' => ''
|
||||
);
|
||||
|
||||
// Get error code number
|
||||
$result_id = @mssql_query('SELECT @@ERROR as code', $this->db_connect_id);
|
||||
if ($result_id)
|
||||
if (function_exists('mssql_get_last_message'))
|
||||
{
|
||||
$row = @mssql_fetch_assoc($result_id);
|
||||
$error['code'] = $row['code'];
|
||||
@mssql_free_result($result_id);
|
||||
}
|
||||
$error = array(
|
||||
'message' => @mssql_get_last_message(),
|
||||
'code' => '',
|
||||
);
|
||||
|
||||
// Get full error message if possible
|
||||
$sql = 'SELECT CAST(description as varchar(255)) as message
|
||||
FROM master.dbo.sysmessages
|
||||
WHERE error = ' . $error['code'];
|
||||
$result_id = @mssql_query($sql);
|
||||
|
||||
if ($result_id)
|
||||
{
|
||||
$row = @mssql_fetch_assoc($result_id);
|
||||
if (!empty($row['message']))
|
||||
// Get error code number
|
||||
$result_id = @mssql_query('SELECT @@ERROR as code', $this->db_connect_id);
|
||||
if ($result_id)
|
||||
{
|
||||
$error['message'] .= '<br />' . $row['message'];
|
||||
$row = @mssql_fetch_assoc($result_id);
|
||||
$error['code'] = $row['code'];
|
||||
@mssql_free_result($result_id);
|
||||
}
|
||||
@mssql_free_result($result_id);
|
||||
|
||||
// Get full error message if possible
|
||||
$sql = 'SELECT CAST(description as varchar(255)) as message
|
||||
FROM master.dbo.sysmessages
|
||||
WHERE error = ' . $error['code'];
|
||||
$result_id = @mssql_query($sql);
|
||||
|
||||
if ($result_id)
|
||||
{
|
||||
$row = @mssql_fetch_assoc($result_id);
|
||||
if (!empty($row['message']))
|
||||
{
|
||||
$error['message'] .= '<br />' . $row['message'];
|
||||
}
|
||||
@mssql_free_result($result_id);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$error = array(
|
||||
'message' => $this->connect_error,
|
||||
'code' => '',
|
||||
);
|
||||
}
|
||||
|
||||
return $error;
|
||||
|
@ -31,6 +31,7 @@ include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
|
||||
class dbal_mssql_odbc extends dbal
|
||||
{
|
||||
var $last_query_text = '';
|
||||
var $connect_error = '';
|
||||
|
||||
/**
|
||||
* Connect to server
|
||||
@ -67,7 +68,24 @@ class dbal_mssql_odbc extends dbal
|
||||
@ini_set('odbc.defaultlrl', $max_size);
|
||||
}
|
||||
|
||||
$this->db_connect_id = ($this->persistency) ? @odbc_pconnect($this->server, $this->user, $sqlpassword) : @odbc_connect($this->server, $this->user, $sqlpassword);
|
||||
if ($this->persistency)
|
||||
{
|
||||
if (!function_exists('odbc_pconnect'))
|
||||
{
|
||||
$this->connect_error = 'odbc_pconnect function does not exist, is odbc extension installed?';
|
||||
return $this->sql_error('');
|
||||
}
|
||||
$this->db_connect_id = @odbc_pconnect($this->server, $this->user, $sqlpassword);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!function_exists('odbc_connect'))
|
||||
{
|
||||
$this->connect_error = 'odbc_connect function does not exist, is odbc extension installed?';
|
||||
return $this->sql_error('');
|
||||
}
|
||||
$this->db_connect_id = @odbc_connect($this->server, $this->user, $sqlpassword);
|
||||
}
|
||||
|
||||
return ($this->db_connect_id) ? $this->db_connect_id : $this->sql_error('');
|
||||
}
|
||||
@ -349,10 +367,22 @@ class dbal_mssql_odbc extends dbal
|
||||
*/
|
||||
function _sql_error()
|
||||
{
|
||||
return array(
|
||||
'message' => @odbc_errormsg(),
|
||||
'code' => @odbc_error()
|
||||
);
|
||||
if (function_exists('odbc_errormsg'))
|
||||
{
|
||||
$error = array(
|
||||
'message' => @odbc_errormsg(),
|
||||
'code' => @odbc_error(),
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$error = array(
|
||||
'message' => $this->connect_error,
|
||||
'code' => '',
|
||||
);
|
||||
}
|
||||
|
||||
return $error;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -198,16 +198,18 @@ class dbal_mssqlnative extends dbal
|
||||
var $m_insert_id = NULL;
|
||||
var $last_query_text = '';
|
||||
var $query_options = array();
|
||||
var $connect_error = '';
|
||||
|
||||
/**
|
||||
* Connect to server
|
||||
*/
|
||||
function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false)
|
||||
{
|
||||
# Test for driver support, to avoid suppressed fatal error
|
||||
// Test for driver support, to avoid suppressed fatal error
|
||||
if (!function_exists('sqlsrv_connect'))
|
||||
{
|
||||
trigger_error('Native MS SQL Server driver for PHP is missing or needs to be updated. Version 1.1 or later is required to install phpBB3. You can download the driver from: http://www.microsoft.com/sqlserver/2005/en/us/PHP-Driver.aspx\n', E_USER_ERROR);
|
||||
$this->connect_error = 'Native MS SQL Server driver for PHP is missing or needs to be updated. Version 1.1 or later is required to install phpBB3. You can download the driver from: http://www.microsoft.com/sqlserver/2005/en/us/PHP-Driver.aspx';
|
||||
return $this->sql_error('');
|
||||
}
|
||||
|
||||
//set up connection variables
|
||||
@ -521,31 +523,43 @@ class dbal_mssqlnative extends dbal
|
||||
*/
|
||||
function _sql_error()
|
||||
{
|
||||
$errors = @sqlsrv_errors(SQLSRV_ERR_ERRORS);
|
||||
$error_message = '';
|
||||
$code = 0;
|
||||
|
||||
if ($errors != null)
|
||||
if (function_exists('sqlsrv_errors'))
|
||||
{
|
||||
foreach ($errors as $error)
|
||||
$errors = @sqlsrv_errors(SQLSRV_ERR_ERRORS);
|
||||
$error_message = '';
|
||||
$code = 0;
|
||||
|
||||
if ($errors != null)
|
||||
{
|
||||
$error_message .= "SQLSTATE: ".$error[ 'SQLSTATE']."\n";
|
||||
$error_message .= "code: ".$error[ 'code']."\n";
|
||||
$code = $error['code'];
|
||||
$error_message .= "message: ".$error[ 'message']."\n";
|
||||
foreach ($errors as $error)
|
||||
{
|
||||
$error_message .= "SQLSTATE: " . $error[ 'SQLSTATE'] . "\n";
|
||||
$error_message .= "code: " . $error[ 'code'] . "\n";
|
||||
$code = $error['code'];
|
||||
$error_message .= "message: " . $error[ 'message'] . "\n";
|
||||
}
|
||||
$this->last_error_result = $error_message;
|
||||
$error = $this->last_error_result;
|
||||
}
|
||||
$this->last_error_result = $error_message;
|
||||
$error = $this->last_error_result;
|
||||
else
|
||||
{
|
||||
$error = (isset($this->last_error_result) && $this->last_error_result) ? $this->last_error_result : array();
|
||||
}
|
||||
|
||||
$error = array(
|
||||
'message' => $error,
|
||||
'code' => $code,
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$error = (isset($this->last_error_result) && $this->last_error_result) ? $this->last_error_result : array();
|
||||
$error = array(
|
||||
'message' => $this->connect_error,
|
||||
'code' => '',
|
||||
);
|
||||
}
|
||||
|
||||
return array(
|
||||
'message' => $error,
|
||||
'code' => $code,
|
||||
);
|
||||
return $error;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -29,6 +29,7 @@ include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
|
||||
class dbal_mysql extends dbal
|
||||
{
|
||||
var $multi_insert = true;
|
||||
var $connect_error = '';
|
||||
|
||||
/**
|
||||
* Connect to server
|
||||
@ -43,7 +44,24 @@ class dbal_mysql extends dbal
|
||||
|
||||
$this->sql_layer = 'mysql4';
|
||||
|
||||
$this->db_connect_id = ($this->persistency) ? @mysql_pconnect($this->server, $this->user, $sqlpassword) : @mysql_connect($this->server, $this->user, $sqlpassword, $new_link);
|
||||
if ($this->persistency)
|
||||
{
|
||||
if (!function_exists('mysql_pconnect'))
|
||||
{
|
||||
$this->connect_error = 'mysql_pconnect function does not exist, is mysql extension installed?';
|
||||
return $this->sql_error('');
|
||||
}
|
||||
$this->db_connect_id = @mysql_pconnect($this->server, $this->user, $sqlpassword);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!function_exists('mysql_connect'))
|
||||
{
|
||||
$this->connect_error = 'mysql_connect function does not exist, is mysql extension installed?';
|
||||
return $this->sql_error('');
|
||||
}
|
||||
$this->db_connect_id = @mysql_connect($this->server, $this->user, $sqlpassword, $new_link);
|
||||
}
|
||||
|
||||
if ($this->db_connect_id && $this->dbname != '')
|
||||
{
|
||||
@ -426,18 +444,29 @@ class dbal_mysql extends dbal
|
||||
*/
|
||||
function _sql_error()
|
||||
{
|
||||
if (!$this->db_connect_id)
|
||||
if ($this->db_connect_id)
|
||||
{
|
||||
return array(
|
||||
$error = array(
|
||||
'message' => @mysql_error($this->db_connect_id),
|
||||
'code' => @mysql_errno($this->db_connect_id),
|
||||
);
|
||||
}
|
||||
else if (function_exists('mysql_error'))
|
||||
{
|
||||
$error = array(
|
||||
'message' => @mysql_error(),
|
||||
'code' => @mysql_errno()
|
||||
'code' => @mysql_errno(),
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$error = array(
|
||||
'message' => $this->connect_error,
|
||||
'code' => '',
|
||||
);
|
||||
}
|
||||
|
||||
return array(
|
||||
'message' => @mysql_error($this->db_connect_id),
|
||||
'code' => @mysql_errno($this->db_connect_id)
|
||||
);
|
||||
return $error;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -26,12 +26,19 @@ include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
|
||||
class dbal_mysqli extends dbal
|
||||
{
|
||||
var $multi_insert = true;
|
||||
var $connect_error = '';
|
||||
|
||||
/**
|
||||
* Connect to server
|
||||
*/
|
||||
function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false , $new_link = false)
|
||||
{
|
||||
if (!function_exists('mysqli_connect'))
|
||||
{
|
||||
$this->connect_error = 'mysqli_connect function does not exist, is mysqli extension installed?';
|
||||
return $this->sql_error('');
|
||||
}
|
||||
|
||||
// Mysqli extension supports persistent connection since PHP 5.3.0
|
||||
$this->persistency = (version_compare(PHP_VERSION, '5.3.0', '>=')) ? $persistency : false;
|
||||
$this->user = $sqluser;
|
||||
@ -423,18 +430,29 @@ class dbal_mysqli extends dbal
|
||||
*/
|
||||
function _sql_error()
|
||||
{
|
||||
if (!$this->db_connect_id)
|
||||
if ($this->db_connect_id)
|
||||
{
|
||||
return array(
|
||||
$error = array(
|
||||
'message' => @mysqli_error($this->db_connect_id),
|
||||
'code' => @mysqli_errno($this->db_connect_id)
|
||||
);
|
||||
}
|
||||
else if (function_exists('mysqli_connect_error'))
|
||||
{
|
||||
$error = array(
|
||||
'message' => @mysqli_connect_error(),
|
||||
'code' => @mysqli_connect_errno()
|
||||
'code' => @mysqli_connect_errno(),
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$error = array(
|
||||
'message' => $this->connect_error,
|
||||
'code' => '',
|
||||
);
|
||||
}
|
||||
|
||||
return array(
|
||||
'message' => @mysqli_error($this->db_connect_id),
|
||||
'code' => @mysqli_errno($this->db_connect_id)
|
||||
);
|
||||
return $error;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -24,6 +24,7 @@ include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
|
||||
class dbal_oracle extends dbal
|
||||
{
|
||||
var $last_query_text = '';
|
||||
var $connect_error = '';
|
||||
|
||||
/**
|
||||
* Connect to server
|
||||
@ -47,7 +48,33 @@ class dbal_oracle extends dbal
|
||||
$connect = $sqlserver . (($port) ? ':' . $port : '') . '/' . $database;
|
||||
}
|
||||
|
||||
$this->db_connect_id = ($new_link) ? @ocinlogon($this->user, $sqlpassword, $connect, 'UTF8') : (($this->persistency) ? @ociplogon($this->user, $sqlpassword, $connect, 'UTF8') : @ocilogon($this->user, $sqlpassword, $connect, 'UTF8'));
|
||||
if ($new_link)
|
||||
{
|
||||
if (!function_exists('ocinlogon'))
|
||||
{
|
||||
$this->connect_error = 'ocinlogon function does not exist, is oci extension installed?';
|
||||
return $this->sql_error('');
|
||||
}
|
||||
$this->db_connect_id = @ocinlogon($this->user, $sqlpassword, $connect, 'UTF8');
|
||||
}
|
||||
else if ($this->persistency)
|
||||
{
|
||||
if (!function_exists('ociplogon'))
|
||||
{
|
||||
$this->connect_error = 'ociplogon function does not exist, is oci extension installed?';
|
||||
return $this->sql_error('');
|
||||
}
|
||||
$this->db_connect_id = @ociplogon($this->user, $sqlpassword, $connect, 'UTF8');
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!function_exists('ocilogon'))
|
||||
{
|
||||
$this->connect_error = 'ocilogon function does not exist, is oci extension installed?';
|
||||
return $this->sql_error('');
|
||||
}
|
||||
$this->db_connect_id = @ocilogon($this->user, $sqlpassword, $connect, 'UTF8');
|
||||
}
|
||||
|
||||
return ($this->db_connect_id) ? $this->db_connect_id : $this->sql_error('');
|
||||
}
|
||||
@ -646,17 +673,27 @@ class dbal_oracle extends dbal
|
||||
*/
|
||||
function _sql_error()
|
||||
{
|
||||
$error = @ocierror();
|
||||
$error = (!$error) ? @ocierror($this->query_result) : $error;
|
||||
$error = (!$error) ? @ocierror($this->db_connect_id) : $error;
|
||||
|
||||
if ($error)
|
||||
if (function_exists('ocierror'))
|
||||
{
|
||||
$this->last_error_result = $error;
|
||||
$error = @ocierror();
|
||||
$error = (!$error) ? @ocierror($this->query_result) : $error;
|
||||
$error = (!$error) ? @ocierror($this->db_connect_id) : $error;
|
||||
|
||||
if ($error)
|
||||
{
|
||||
$this->last_error_result = $error;
|
||||
}
|
||||
else
|
||||
{
|
||||
$error = (isset($this->last_error_result) && $this->last_error_result) ? $this->last_error_result : array();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$error = (isset($this->last_error_result) && $this->last_error_result) ? $this->last_error_result : array();
|
||||
$error = array(
|
||||
'message' => $this->connect_error,
|
||||
'code' => '',
|
||||
);
|
||||
}
|
||||
|
||||
return $error;
|
||||
|
@ -24,6 +24,8 @@ include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
|
||||
*/
|
||||
class dbal_sqlite extends dbal
|
||||
{
|
||||
var $connect_error = '';
|
||||
|
||||
/**
|
||||
* Connect to server
|
||||
*/
|
||||
@ -35,7 +37,24 @@ class dbal_sqlite extends dbal
|
||||
$this->dbname = $database;
|
||||
|
||||
$error = '';
|
||||
$this->db_connect_id = ($this->persistency) ? @sqlite_popen($this->server, 0666, $error) : @sqlite_open($this->server, 0666, $error);
|
||||
if ($this->persistency)
|
||||
{
|
||||
if (!function_exists('sqlite_popen'))
|
||||
{
|
||||
$this->connect_error = 'sqlite_popen function does not exist, is sqlite extension installed?';
|
||||
return $this->sql_error('');
|
||||
}
|
||||
$this->db_connect_id = @sqlite_popen($this->server, 0666, $error);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!function_exists('sqlite_open'))
|
||||
{
|
||||
$this->connect_error = 'sqlite_open function does not exist, is sqlite extension installed?';
|
||||
return $this->sql_error('');
|
||||
}
|
||||
$this->db_connect_id = @sqlite_open($this->server, 0666, $error);
|
||||
}
|
||||
|
||||
if ($this->db_connect_id)
|
||||
{
|
||||
@ -280,10 +299,22 @@ class dbal_sqlite extends dbal
|
||||
*/
|
||||
function _sql_error()
|
||||
{
|
||||
return array(
|
||||
'message' => @sqlite_error_string(@sqlite_last_error($this->db_connect_id)),
|
||||
'code' => @sqlite_last_error($this->db_connect_id)
|
||||
);
|
||||
if (function_exists('sqlite_error_string'))
|
||||
{
|
||||
$error = array(
|
||||
'message' => @sqlite_error_string(@sqlite_last_error($this->db_connect_id)),
|
||||
'code' => @sqlite_last_error($this->db_connect_id),
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$error = array(
|
||||
'message' => $this->connect_error,
|
||||
'code' => '',
|
||||
);
|
||||
}
|
||||
|
||||
return $error;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2904,7 +2904,7 @@ function meta_refresh($time, $url, $disable_cd_check = false)
|
||||
*
|
||||
* @param int $code HTTP status code
|
||||
* @param string $message Message for the status code
|
||||
* @return void
|
||||
* @return null
|
||||
*/
|
||||
function send_status_line($code, $message)
|
||||
{
|
||||
@ -4843,7 +4843,7 @@ function phpbb_get_plural_form($rule, $number)
|
||||
*
|
||||
* @param array $param Parameter array, see $param_defaults array.
|
||||
*
|
||||
* @return void
|
||||
* @return null
|
||||
*/
|
||||
function phpbb_http_login($param)
|
||||
{
|
||||
|
@ -3324,7 +3324,7 @@ function obtain_latest_version_info($force_update = false, $warn_fail = false, $
|
||||
* @param int $flag The binary flag which is OR-ed with the current column value
|
||||
* @param string $sql_more This string is attached to the sql query generated to update the table.
|
||||
*
|
||||
* @return void
|
||||
* @return null
|
||||
*/
|
||||
function enable_bitfield_column_flag($table_name, $column_name, $flag, $sql_more = '')
|
||||
{
|
||||
|
@ -433,7 +433,7 @@ function set_modified_headers($stamp, $browser)
|
||||
*
|
||||
* @param bool $exit Whether to die or not.
|
||||
*
|
||||
* @return void
|
||||
* @return null
|
||||
*/
|
||||
function file_gc($exit = true)
|
||||
{
|
||||
|
@ -87,7 +87,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20
|
||||
'2.0.x' => false,
|
||||
),
|
||||
'postgres' => array(
|
||||
'LABEL' => 'PostgreSQL 7.x/8.x',
|
||||
'LABEL' => 'PostgreSQL 8.3+',
|
||||
'SCHEMA' => 'postgres',
|
||||
'MODULE' => 'pgsql',
|
||||
'DELIM' => ';',
|
||||
|
@ -650,64 +650,6 @@ class queue
|
||||
$this->data[$object]['data'][] = $scope;
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains exclusive lock on queue cache file.
|
||||
* Returns resource representing the lock
|
||||
*/
|
||||
function lock()
|
||||
{
|
||||
// For systems that can't have two processes opening
|
||||
// one file for writing simultaneously
|
||||
if (file_exists($this->cache_file . '.lock'))
|
||||
{
|
||||
$mode = 'rb';
|
||||
}
|
||||
else
|
||||
{
|
||||
$mode = 'wb';
|
||||
}
|
||||
|
||||
$lock_fp = @fopen($this->cache_file . '.lock', $mode);
|
||||
|
||||
if ($mode == 'wb')
|
||||
{
|
||||
if (!$lock_fp)
|
||||
{
|
||||
// Two processes may attempt to create lock file at the same time.
|
||||
// Have the losing process try opening the lock file again for reading
|
||||
// on the assumption that the winning process created it
|
||||
$mode = 'rb';
|
||||
$lock_fp = @fopen($this->cache_file . '.lock', $mode);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Only need to set mode when the lock file is written
|
||||
@chmod($this->cache_file . '.lock', 0666);
|
||||
}
|
||||
}
|
||||
|
||||
if ($lock_fp)
|
||||
{
|
||||
@flock($lock_fp, LOCK_EX);
|
||||
}
|
||||
|
||||
return $lock_fp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Releases lock on queue cache file, using resource obtained from lock()
|
||||
*/
|
||||
function unlock($lock_fp)
|
||||
{
|
||||
// lock() will return null if opening lock file, and thus locking, failed.
|
||||
// Accept null values here so that client code does not need to check them
|
||||
if ($lock_fp)
|
||||
{
|
||||
@flock($lock_fp, LOCK_UN);
|
||||
fclose($lock_fp);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Process queue
|
||||
* Using lock file
|
||||
@ -716,16 +658,24 @@ class queue
|
||||
{
|
||||
global $db, $config, $phpEx, $phpbb_root_path, $user;
|
||||
|
||||
$lock_fp = $this->lock();
|
||||
$lock = new phpbb_lock_flock($this->cache_file);
|
||||
$lock->acquire();
|
||||
|
||||
set_config('last_queue_run', time(), true);
|
||||
|
||||
if (!file_exists($this->cache_file) || filemtime($this->cache_file) > time() - $config['queue_interval'])
|
||||
// avoid races, check file existence once
|
||||
$have_cache_file = file_exists($this->cache_file);
|
||||
if (!$have_cache_file || $config['last_queue_run'] > time() - $config['queue_interval'])
|
||||
{
|
||||
$this->unlock($lock_fp);
|
||||
if (!$have_cache_file)
|
||||
{
|
||||
set_config('last_queue_run', time(), true);
|
||||
}
|
||||
|
||||
$lock->release();
|
||||
return;
|
||||
}
|
||||
|
||||
set_config('last_queue_run', time(), true);
|
||||
|
||||
include($this->cache_file);
|
||||
|
||||
foreach ($this->queue_data as $object => $data_ary)
|
||||
@ -789,7 +739,7 @@ class queue
|
||||
break;
|
||||
|
||||
default:
|
||||
$this->unlock($lock_fp);
|
||||
$lock->release();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -865,7 +815,7 @@ class queue
|
||||
}
|
||||
}
|
||||
|
||||
$this->unlock($lock_fp);
|
||||
$lock->release();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -878,7 +828,8 @@ class queue
|
||||
return;
|
||||
}
|
||||
|
||||
$lock_fp = $this->lock();
|
||||
$lock = new phpbb_lock_flock($this->cache_file);
|
||||
$lock->acquire();
|
||||
|
||||
if (file_exists($this->cache_file))
|
||||
{
|
||||
@ -905,7 +856,7 @@ class queue
|
||||
phpbb_chmod($this->cache_file, CHMOD_READ | CHMOD_WRITE);
|
||||
}
|
||||
|
||||
$this->unlock($lock_fp);
|
||||
$lock->release();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -759,7 +759,26 @@ class p_master
|
||||
}
|
||||
}
|
||||
|
||||
$u_title = $module_url . $delim . 'i=' . (($item_ary['cat']) ? $item_ary['id'] : $item_ary['name'] . (($item_ary['is_duplicate']) ? '&icat=' . $current_id : '') . '&mode=' . $item_ary['mode']);
|
||||
$u_title = $module_url . $delim . 'i=';
|
||||
// if the item has a name use it, else use its id
|
||||
if (empty($item_ary['name']))
|
||||
{
|
||||
$u_title .= $item_ary['id'];
|
||||
}
|
||||
else
|
||||
{
|
||||
// if the category has a name, then use it.
|
||||
$u_title .= $item_ary['name'];
|
||||
}
|
||||
// If the item is not a category append the mode
|
||||
if (!$item_ary['cat'])
|
||||
{
|
||||
if ($item_ary['is_duplicate'])
|
||||
{
|
||||
$u_title .= '&icat=' . $current_id;
|
||||
}
|
||||
$u_title .= '&mode=' . $item_ary['mode'];
|
||||
}
|
||||
|
||||
// Was not allowed in categories before - /*!$item_ary['cat'] && */
|
||||
$u_title .= (isset($item_ary['url_extra'])) ? $item_ary['url_extra'] : '';
|
||||
|
@ -104,7 +104,7 @@ class phpbb_group_positions
|
||||
* Addes a group by group_id
|
||||
*
|
||||
* @param int $group_id group_id of the group to be added
|
||||
* @return void
|
||||
* @return null
|
||||
*/
|
||||
public function add_group($group_id)
|
||||
{
|
||||
@ -128,7 +128,7 @@ class phpbb_group_positions
|
||||
*
|
||||
* @param int $group_id group_id of the group to be deleted
|
||||
* @param bool $skip_group Skip setting the group to GROUP_DISABLED, to save the query, when you need to update it anyway.
|
||||
* @return void
|
||||
* @return null
|
||||
*/
|
||||
public function delete_group($group_id, $skip_group = false)
|
||||
{
|
||||
@ -159,7 +159,7 @@ class phpbb_group_positions
|
||||
* Moves a group up by group_id
|
||||
*
|
||||
* @param int $group_id group_id of the group to be moved
|
||||
* @return void
|
||||
* @return null
|
||||
*/
|
||||
public function move_up($group_id)
|
||||
{
|
||||
@ -170,7 +170,7 @@ class phpbb_group_positions
|
||||
* Moves a group down by group_id
|
||||
*
|
||||
* @param int $group_id group_id of the group to be moved
|
||||
* @return void
|
||||
* @return null
|
||||
*/
|
||||
public function move_down($group_id)
|
||||
{
|
||||
@ -184,7 +184,7 @@ class phpbb_group_positions
|
||||
* @param int $delta number of steps:
|
||||
* - positive = move up
|
||||
* - negative = move down
|
||||
* @return void
|
||||
* @return null
|
||||
*/
|
||||
public function move($group_id, $delta)
|
||||
{
|
||||
|
@ -125,7 +125,7 @@ class phpbb_lock_db
|
||||
* Note: Attempting to release a lock that is already released,
|
||||
* that is, calling release() multiple times, is harmless.
|
||||
*
|
||||
* @return void
|
||||
* @return null
|
||||
*/
|
||||
public function release()
|
||||
{
|
||||
|
133
phpBB/includes/lock/flock.php
Normal file
133
phpBB/includes/lock/flock.php
Normal file
@ -0,0 +1,133 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package phpBB3
|
||||
* @copyright (c) 2012 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
if (!defined('IN_PHPBB'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* File locking class
|
||||
* @package phpBB3
|
||||
*/
|
||||
class phpbb_lock_flock
|
||||
{
|
||||
/**
|
||||
* Path to the file to which access is controlled
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $path;
|
||||
|
||||
/**
|
||||
* File pointer for the lock file
|
||||
* @var string
|
||||
*/
|
||||
private $lock_fp;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* You have to call acquire() to actually acquire the lock.
|
||||
*
|
||||
* @param string $path Path to the file to which access is controlled
|
||||
*/
|
||||
public function __construct($path)
|
||||
{
|
||||
$this->path = $path;
|
||||
$this->lock_fp = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to acquire the lock.
|
||||
*
|
||||
* If the lock is already held by another process, this call will block
|
||||
* until the other process releases the lock. If a lock is acquired and
|
||||
* is not released before script finishes but the process continues to
|
||||
* live (apache/fastcgi) then subsequent processes trying to acquire
|
||||
* the same lock will be blocked forever.
|
||||
*
|
||||
* If the lock is already held by the same process via another instance
|
||||
* of this class, this call will block forever.
|
||||
*
|
||||
* If flock function is disabled in php or fails to work, lock
|
||||
* acquisition will fail and false will be returned.
|
||||
*
|
||||
* @return bool true if lock was acquired
|
||||
* false otherwise
|
||||
*/
|
||||
public function acquire()
|
||||
{
|
||||
if ($this->lock_fp)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// For systems that can't have two processes opening
|
||||
// one file for writing simultaneously
|
||||
if (file_exists($this->path . '.lock'))
|
||||
{
|
||||
$mode = 'rb';
|
||||
}
|
||||
else
|
||||
{
|
||||
$mode = 'wb';
|
||||
}
|
||||
|
||||
$this->lock_fp = @fopen($this->path . '.lock', $mode);
|
||||
|
||||
if ($mode == 'wb')
|
||||
{
|
||||
if (!$this->lock_fp)
|
||||
{
|
||||
// Two processes may attempt to create lock file at the same time.
|
||||
// Have the losing process try opening the lock file again for reading
|
||||
// on the assumption that the winning process created it
|
||||
$mode = 'rb';
|
||||
$this->lock_fp = @fopen($this->path . '.lock', $mode);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Only need to set mode when the lock file is written
|
||||
@chmod($this->path . '.lock', 0666);
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->lock_fp)
|
||||
{
|
||||
@flock($this->lock_fp, LOCK_EX);
|
||||
}
|
||||
|
||||
return (bool) $this->lock_fp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Releases the lock.
|
||||
*
|
||||
* The lock must have been previously obtained, that is, acquire() call
|
||||
* was issued and returned true.
|
||||
*
|
||||
* Note: Attempting to release a lock that is already released,
|
||||
* that is, calling release() multiple times, is harmless.
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function release()
|
||||
{
|
||||
if ($this->lock_fp)
|
||||
{
|
||||
@flock($this->lock_fp, LOCK_UN);
|
||||
fclose($this->lock_fp);
|
||||
$this->lock_fp = null;
|
||||
}
|
||||
}
|
||||
}
|
@ -70,7 +70,7 @@ class phpbb_questionnaire_data_collector
|
||||
/**
|
||||
* Collect info into the data property.
|
||||
*
|
||||
* @return void
|
||||
* @return null
|
||||
*/
|
||||
function collect()
|
||||
{
|
||||
|
@ -86,6 +86,14 @@ class phpbb_search_fulltext_mysql extends phpbb_search_base
|
||||
|
||||
$this->word_length = array('min' => $this->config['fulltext_mysql_min_word_len'], 'max' => $this->config['fulltext_mysql_max_word_len']);
|
||||
|
||||
/**
|
||||
* Load the UTF tools
|
||||
*/
|
||||
if (!function_exists('utf8_strlen'))
|
||||
{
|
||||
include($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
|
||||
}
|
||||
|
||||
$error = false;
|
||||
}
|
||||
|
||||
@ -230,7 +238,7 @@ class phpbb_search_fulltext_mysql extends phpbb_search_base
|
||||
}
|
||||
else
|
||||
{
|
||||
$tmp_split_words[] = $word . ' ';
|
||||
$tmp_split_words[] = $word;
|
||||
}
|
||||
}
|
||||
if ($phrase)
|
||||
|
@ -121,6 +121,14 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the UTF tools
|
||||
*/
|
||||
if (!function_exists('utf8_strlen'))
|
||||
{
|
||||
include($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
|
||||
}
|
||||
|
||||
$error = false;
|
||||
}
|
||||
|
||||
|
@ -110,7 +110,7 @@ class phpbb_style_resource_locator implements phpbb_template_locator
|
||||
* Typically it is one directory level deep, e.g. "template/".
|
||||
*
|
||||
* @param string $template_path Relative path to templates directory within style directories
|
||||
* @return void
|
||||
* @return null
|
||||
*/
|
||||
public function set_template_path($template_path)
|
||||
{
|
||||
@ -121,7 +121,7 @@ class phpbb_style_resource_locator implements phpbb_template_locator
|
||||
* Sets the location of templates directory within style directories
|
||||
* to the default, which is "template/".
|
||||
*
|
||||
* @return void
|
||||
* @return null
|
||||
*/
|
||||
public function set_default_template_path()
|
||||
{
|
||||
|
@ -58,6 +58,9 @@ class phpbb_template_compile
|
||||
*/
|
||||
public function compile_file_to_file($source_file, $compiled_file)
|
||||
{
|
||||
$lock = new phpbb_lock_flock($compiled_file);
|
||||
$lock->acquire();
|
||||
|
||||
$source_handle = @fopen($source_file, 'rb');
|
||||
$destination_handle = @fopen($compiled_file, 'wb');
|
||||
|
||||
@ -66,16 +69,15 @@ class phpbb_template_compile
|
||||
return false;
|
||||
}
|
||||
|
||||
@flock($destination_handle, LOCK_EX);
|
||||
|
||||
$this->compile_stream_to_stream($source_handle, $destination_handle);
|
||||
|
||||
@fclose($source_handle);
|
||||
@flock($destination_handle, LOCK_UN);
|
||||
@fclose($destination_handle);
|
||||
|
||||
phpbb_chmod($compiled_file, CHMOD_READ | CHMOD_WRITE);
|
||||
|
||||
$lock->release();
|
||||
|
||||
clearstatcache();
|
||||
|
||||
return true;
|
||||
@ -118,7 +120,7 @@ class phpbb_template_compile
|
||||
*
|
||||
* @param resource $source_stream Source stream
|
||||
* @param resource $dest_stream Destination stream
|
||||
* @return void
|
||||
* @return null
|
||||
*/
|
||||
private function compile_stream_to_stream($source_stream, $dest_stream)
|
||||
{
|
||||
|
@ -19,7 +19,7 @@ class ucp_profile_info
|
||||
'title' => 'UCP_PROFILE',
|
||||
'version' => '1.0.0',
|
||||
'modes' => array(
|
||||
'profile_info' => array('title' => 'UCP_PROFILE_PROFILE_INFO', 'auth' => '', 'cat' => array('UCP_PROFILE')),
|
||||
'profile_info' => array('title' => 'UCP_PROFILE_PROFILE_INFO', 'auth' => 'acl_u_chgprofileinfo', 'cat' => array('UCP_PROFILE')),
|
||||
'signature' => array('title' => 'UCP_PROFILE_SIGNATURE', 'auth' => 'acl_u_sig', 'cat' => array('UCP_PROFILE')),
|
||||
'avatar' => array('title' => 'UCP_PROFILE_AVATAR', 'auth' => 'cfg_allow_avatar && (cfg_allow_avatar_local || cfg_allow_avatar_remote || cfg_allow_avatar_upload || cfg_allow_avatar_remote_upload)', 'cat' => array('UCP_PROFILE')),
|
||||
'reg_details' => array('title' => 'UCP_PROFILE_REG_DETAILS', 'auth' => '', 'cat' => array('UCP_PROFILE')),
|
||||
|
@ -127,6 +127,36 @@ class ucp_prefs
|
||||
$dateformat_options .= '>' . $user->lang['CUSTOM_DATEFORMAT'] . '</option>';
|
||||
|
||||
$timezone_selects = phpbb_timezone_select($user, $data['tz'], true);
|
||||
|
||||
// check if there are any user-selectable languages
|
||||
$sql = 'SELECT COUNT(lang_id) as languages_count
|
||||
FROM ' . LANG_TABLE;
|
||||
$result = $db->sql_query($sql);
|
||||
if ($db->sql_fetchfield('languages_count') > 1)
|
||||
{
|
||||
$s_more_languages = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$s_more_languages = false;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
// check if there are any user-selectable styles
|
||||
$sql = 'SELECT COUNT(style_id) as styles_count
|
||||
FROM ' . STYLES_TABLE . '
|
||||
WHERE style_active = 1';
|
||||
$result = $db->sql_query($sql);
|
||||
if ($db->sql_fetchfield('styles_count') > 1)
|
||||
{
|
||||
$s_more_styles = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$s_more_styles = false;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '',
|
||||
|
||||
@ -145,6 +175,9 @@ class ucp_prefs
|
||||
'DEFAULT_DATEFORMAT' => $config['default_dateformat'],
|
||||
'A_DEFAULT_DATEFORMAT' => addslashes($config['default_dateformat']),
|
||||
|
||||
'S_MORE_LANGUAGES' => $s_more_languages,
|
||||
'S_MORE_STYLES' => $s_more_styles,
|
||||
|
||||
'S_LANG_OPTIONS' => language_select($data['lang']),
|
||||
'S_STYLE_OPTIONS' => ($config['override_user_style']) ? '' : style_select($data['style']),
|
||||
'S_TZ_OPTIONS' => $timezone_selects['tz_select'],
|
||||
|
@ -251,6 +251,11 @@ class ucp_profile
|
||||
break;
|
||||
|
||||
case 'profile_info':
|
||||
// Do not display profile information panel if not authed to do so
|
||||
if (!$auth->acl_get('u_chgprofileinfo'))
|
||||
{
|
||||
trigger_error('NO_AUTH_PROFILEINFO');
|
||||
}
|
||||
|
||||
include($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx);
|
||||
|
||||
|
@ -2346,6 +2346,26 @@ function change_database_data(&$no_updates, $version)
|
||||
}
|
||||
}
|
||||
|
||||
// Disable receiving pms for bots
|
||||
$sql = 'SELECT user_id
|
||||
FROM ' . BOTS_TABLE;
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$bot_user_ids = array();
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$bot_user_ids[] = (int) $row['user_id'];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if (!empty($bot_user_ids))
|
||||
{
|
||||
$sql = 'UPDATE ' . USERS_TABLE . '
|
||||
SET user_allow_pm = 0
|
||||
WHERE ' . $db->sql_in_set('user_id', $bot_user_ids);
|
||||
_sql($sql, $errored, $error_ary);
|
||||
}
|
||||
|
||||
$no_updates = false;
|
||||
break;
|
||||
|
||||
@ -2768,8 +2788,6 @@ function change_database_data(&$no_updates, $version)
|
||||
$config->set('display_last_subject', '1');
|
||||
}
|
||||
|
||||
$no_updates = false;
|
||||
|
||||
if (!isset($config['assets_version']))
|
||||
{
|
||||
$config->set('assets_version', '1');
|
||||
@ -2873,6 +2891,77 @@ function change_database_data(&$no_updates, $version)
|
||||
}
|
||||
}
|
||||
|
||||
// PHPBB3-10601: Make inbox default. Add basename to ucp's pm category
|
||||
|
||||
// Get the category wanted while checking, at the same time, if this has already been applied
|
||||
$sql = 'SELECT module_id, module_basename
|
||||
FROM ' . MODULES_TABLE . "
|
||||
WHERE module_basename <> 'ucp_pm' AND
|
||||
module_langname='UCP_PM'
|
||||
";
|
||||
$result = $db->sql_query_limit($sql, 1);
|
||||
|
||||
if ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
// This update is still not applied. Applying it
|
||||
|
||||
$sql = 'UPDATE ' . MODULES_TABLE . "
|
||||
SET module_basename = 'ucp_pm'
|
||||
WHERE module_id = " . (int) $row['module_id'];
|
||||
|
||||
_sql($sql, $errored, $error_ary);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
// Add new permission u_chgprofileinfo and duplicate settings from u_sig
|
||||
include_once($phpbb_root_path . 'includes/acp/auth.' . $phpEx);
|
||||
$auth_admin = new auth_admin();
|
||||
|
||||
// Only add the new permission if it does not already exist
|
||||
if (empty($auth_admin->acl_options['id']['u_chgprofileinfo']))
|
||||
{
|
||||
$auth_admin->acl_add_option(array('global' => array('u_chgprofileinfo')));
|
||||
|
||||
// Now the tricky part, filling the permission
|
||||
$old_id = $auth_admin->acl_options['id']['u_sig'];
|
||||
$new_id = $auth_admin->acl_options['id']['u_chgprofileinfo'];
|
||||
|
||||
$tables = array(ACL_GROUPS_TABLE, ACL_ROLES_DATA_TABLE, ACL_USERS_TABLE);
|
||||
|
||||
foreach ($tables as $table)
|
||||
{
|
||||
$sql = 'SELECT *
|
||||
FROM ' . $table . '
|
||||
WHERE auth_option_id = ' . $old_id;
|
||||
$result = _sql($sql, $errored, $error_ary);
|
||||
|
||||
$sql_ary = array();
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$row['auth_option_id'] = $new_id;
|
||||
$sql_ary[] = $row;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if (sizeof($sql_ary))
|
||||
{
|
||||
$db->sql_multi_insert($table, $sql_ary);
|
||||
}
|
||||
}
|
||||
|
||||
// Remove any old permission entries
|
||||
$auth_admin->acl_clear_prefetch();
|
||||
}
|
||||
|
||||
// Update the auth setting for the module
|
||||
$sql = 'UPDATE ' . MODULES_TABLE . "
|
||||
SET module_auth = 'acl_u_chgprofileinfo'
|
||||
WHERE module_class = 'ucp'
|
||||
AND module_basename = 'ucp_profile'
|
||||
AND module_mode = 'profile_info'";
|
||||
_sql($sql, $errored, $error_ary);
|
||||
|
||||
$no_updates = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1478,8 +1478,14 @@ class install_install extends module
|
||||
|
||||
foreach ($this->module_categories[$module_class] as $cat_name => $subs)
|
||||
{
|
||||
$basename = '';
|
||||
// Check if this sub-category has a basename. If it has, use it.
|
||||
if (isset($this->module_categories_basenames[$cat_name]))
|
||||
{
|
||||
$basename = $this->module_categories_basenames[$cat_name];
|
||||
}
|
||||
$module_data = array(
|
||||
'module_basename' => '',
|
||||
'module_basename' => $basename,
|
||||
'module_enabled' => 1,
|
||||
'module_display' => 1,
|
||||
'parent_id' => 0,
|
||||
@ -1507,8 +1513,14 @@ class install_install extends module
|
||||
{
|
||||
foreach ($subs as $level2_name)
|
||||
{
|
||||
$basename = '';
|
||||
// Check if this sub-category has a basename. If it has, use it.
|
||||
if (isset($this->module_categories_basenames[$level2_name]))
|
||||
{
|
||||
$basename = $this->module_categories_basenames[$level2_name];
|
||||
}
|
||||
$module_data = array(
|
||||
'module_basename' => '',
|
||||
'module_basename' => $basename,
|
||||
'module_enabled' => 1,
|
||||
'module_display' => 1,
|
||||
'parent_id' => (int) $categories[$cat_name]['id'],
|
||||
@ -1772,6 +1784,7 @@ class install_install extends module
|
||||
'user_timezone' => 'UTC',
|
||||
'user_dateformat' => $lang['default_dateformat'],
|
||||
'user_allow_massemail' => 0,
|
||||
'user_allow_pm' => 0,
|
||||
);
|
||||
|
||||
$user_id = user_add($user_row);
|
||||
@ -2115,6 +2128,9 @@ class install_install extends module
|
||||
'UCP_ZEBRA' => null,
|
||||
),
|
||||
);
|
||||
var $module_categories_basenames = array(
|
||||
'UCP_PM' => 'ucp_pm',
|
||||
);
|
||||
|
||||
var $module_extras = array(
|
||||
'acp' => array(
|
||||
|
@ -388,6 +388,7 @@ INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_chgemail', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_chggrp', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_chgname', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_chgpasswd', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_chgprofileinfo', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_download', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_hideonline', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_ignoreflood', 1);
|
||||
@ -549,7 +550,7 @@ INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT
|
||||
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 22, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option NOT IN ('f_announce', 'f_attach', 'f_bump', 'f_delete', 'f_flash', 'f_icons', 'f_ignoreflood', 'f_sticky', 'f_user_lock', 'f_votechg');
|
||||
|
||||
# New Member (u_)
|
||||
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 23, auth_option_id, 0 FROM phpbb_acl_options WHERE auth_option LIKE 'u_%' AND auth_option IN ('u_sendpm', 'u_masspm', 'u_masspm_group');
|
||||
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 23, auth_option_id, 0 FROM phpbb_acl_options WHERE auth_option LIKE 'u_%' AND auth_option IN ('u_sendpm', 'u_masspm', 'u_masspm_group', 'u_chgprofileinfo');
|
||||
|
||||
# New Member (f_)
|
||||
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 24, auth_option_id, 0 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option IN ('f_noapprove');
|
||||
|
@ -449,10 +449,10 @@ $lang = array_merge($lang, array(
|
||||
'ACP_SECURITY_SETTINGS_EXPLAIN' => 'Here you are able to define session and login related settings.',
|
||||
|
||||
'ALL' => 'All',
|
||||
'ALLOW_AUTOLOGIN' => 'Allow persistent logins',
|
||||
'ALLOW_AUTOLOGIN_EXPLAIN' => 'Determines whether users can autologin when they visit the board.',
|
||||
'AUTOLOGIN_LENGTH' => 'Persistent login key expiration length (in days)',
|
||||
'AUTOLOGIN_LENGTH_EXPLAIN' => 'Number of days after which persistent login keys are removed or zero to disable.',
|
||||
'ALLOW_AUTOLOGIN' => 'Allow "Remember Me" logins',
|
||||
'ALLOW_AUTOLOGIN_EXPLAIN' => 'Determines whether users are given "Remember Me" option when they visit the board.',
|
||||
'AUTOLOGIN_LENGTH' => '"Remember Me" login key expiration length (in days)',
|
||||
'AUTOLOGIN_LENGTH_EXPLAIN' => 'Number of days after which "Remember Me" login keys are removed or zero to disable.',
|
||||
'BROWSER_VALID' => 'Validate browser',
|
||||
'BROWSER_VALID_EXPLAIN' => 'Enables browser validation for each session improving security.',
|
||||
'CHECK_DNSBL' => 'Check IP against DNS Blackhole List',
|
||||
|
@ -102,6 +102,7 @@ $lang = array_merge($lang, array(
|
||||
'acl_u_chgemail' => array('lang' => 'Can change email address', 'cat' => 'profile'),
|
||||
'acl_u_chgavatar' => array('lang' => 'Can change avatar', 'cat' => 'profile'),
|
||||
'acl_u_chggrp' => array('lang' => 'Can change default usergroup', 'cat' => 'profile'),
|
||||
'acl_u_chgprofileinfo' => array('lang' => 'Can change profile field information', 'cat' => 'profile'),
|
||||
|
||||
'acl_u_attach' => array('lang' => 'Can attach files', 'cat' => 'post'),
|
||||
'acl_u_download' => array('lang' => 'Can download files', 'cat' => 'post'),
|
||||
|
@ -343,7 +343,7 @@ $lang = array_merge($lang, array(
|
||||
'LOGIN_EXPLAIN_VIEWONLINE' => 'In order to view the online list you have to be registered and logged in.',
|
||||
'LOGOUT' => 'Logout',
|
||||
'LOGOUT_USER' => 'Logout [ %s ]',
|
||||
'LOG_ME_IN' => 'Log me on automatically each visit',
|
||||
'LOG_ME_IN' => 'Remember me',
|
||||
|
||||
'MARK' => 'Mark',
|
||||
'MARK_ALL' => 'Mark all',
|
||||
|
@ -43,7 +43,7 @@ $help = array(
|
||||
),
|
||||
array(
|
||||
0 => 'Why do I get logged off automatically?',
|
||||
1 => 'If you do not check the <em>Log me in automatically</em> box when you login, the board will only keep you logged in for a preset time. This prevents misuse of your account by anyone else. To stay logged in, check the box during login. This is not recommended if you access the board from a shared computer, e.g. library, internet cafe, university computer lab, etc. If you do not see this checkbox, it means the board administrator has disabled this feature.'
|
||||
1 => 'If you do not check the <em>Remember me</em> box when you login, the board will only keep you logged in for a preset time. This prevents misuse of your account by anyone else. To stay logged in, check the box during login. This is not recommended if you access the board from a shared computer, e.g. library, internet cafe, university computer lab, etc. If you do not see this checkbox, it means the board administrator has disabled this feature.'
|
||||
),
|
||||
array(
|
||||
0 => 'How do I prevent my username appearing in the online user listings?',
|
||||
|
@ -210,7 +210,7 @@ $lang = array_merge($lang, array(
|
||||
<p>phpBB3 supports the following databases:</p>
|
||||
<ul>
|
||||
<li>MySQL 3.23 or above (MySQLi supported)</li>
|
||||
<li>PostgreSQL 7.3+</li>
|
||||
<li>PostgreSQL 8.3+</li>
|
||||
<li>SQLite 2.8.2+</li>
|
||||
<li>Firebird 2.1+</li>
|
||||
<li>MS SQL Server 2000 or above (directly or via ODBC)</li>
|
||||
|
@ -87,7 +87,7 @@ $lang = array_merge($lang, array(
|
||||
'ATTACHMENTS_EXPLAIN' => 'This is a list of attachments you have made in posts to this board.',
|
||||
'ATTACHMENTS_DELETED' => 'Attachments successfully deleted.',
|
||||
'ATTACHMENT_DELETED' => 'Attachment successfully deleted.',
|
||||
'AUTOLOGIN_SESSION_KEYS_DELETED'=> 'The selected persistent login keys were successfully deleted.',
|
||||
'AUTOLOGIN_SESSION_KEYS_DELETED'=> 'The selected "Remember Me" login keys were successfully deleted.',
|
||||
'AVATAR_CATEGORY' => 'Category',
|
||||
'AVATAR_EXPLAIN' => 'Maximum dimensions; width: %1$s, height: %2$s, file size: %3$.2f KiB.',
|
||||
'AVATAR_FEATURES_DISABLED' => 'The avatar functionality is currently disabled.',
|
||||
@ -337,6 +337,7 @@ $lang = array_merge($lang, array(
|
||||
'NO_AUTH_FORWARD_MESSAGE' => 'You are not authorised to forward private messages.',
|
||||
'NO_AUTH_GROUP_MESSAGE' => 'You are not authorised to send private messages to groups.',
|
||||
'NO_AUTH_PASSWORD_REMINDER' => 'You are not authorised to request a new password.',
|
||||
'NO_AUTH_PROFILEINFO' => 'You are not authorised to change your profile information.',
|
||||
'NO_AUTH_READ_HOLD_MESSAGE' => 'You are not authorised to read private messages that are on hold.',
|
||||
'NO_AUTH_READ_MESSAGE' => 'You are not authorised to read private messages.',
|
||||
'NO_AUTH_READ_REMOVED_MESSAGE' => 'You are not able to read this message because it was removed by the author.',
|
||||
@ -399,8 +400,8 @@ $lang = array_merge($lang, array(
|
||||
'PREFERENCES_UPDATED' => 'Your preferences have been updated.',
|
||||
'PROFILE_INFO_NOTICE' => 'Please note that this information may be viewable to other members. Be careful when including any personal details. Any fields marked with a * must be completed.',
|
||||
'PROFILE_UPDATED' => 'Your profile has been updated.',
|
||||
'PROFILE_AUTOLOGIN_KEYS' => 'The persistent login keys automatically log you in when you visit the board. If you logout, the persistent login key is deleted only on the computer you are using to logout. Here you can see persistent login keys created on other computers you used to access this site.',
|
||||
'PROFILE_NO_AUTOLOGIN_KEYS' => 'There are no saved persistent login keys.',
|
||||
'PROFILE_AUTOLOGIN_KEYS' => 'The "Remember Me" login keys automatically log you in when you visit the board. If you logout, the remember me login key is deleted only on the computer you are using to logout. Here you can see remember login keys created on other computers you used to access this site.',
|
||||
'PROFILE_NO_AUTOLOGIN_KEYS' => 'There are no saved "Remember Me" login keys.',
|
||||
|
||||
'RECIPIENT' => 'Recipient',
|
||||
'RECIPIENTS' => 'Recipients',
|
||||
@ -500,7 +501,7 @@ $lang = array_merge($lang, array(
|
||||
'UCP_PROFILE_PROFILE_INFO' => 'Edit profile',
|
||||
'UCP_PROFILE_REG_DETAILS' => 'Edit account settings',
|
||||
'UCP_PROFILE_SIGNATURE' => 'Edit signature',
|
||||
'UCP_PROFILE_AUTOLOGIN_KEYS'=> 'Edit persistent login keys',
|
||||
'UCP_PROFILE_AUTOLOGIN_KEYS'=> 'Edit "Remember Me" login keys',
|
||||
|
||||
'UCP_USERGROUPS' => 'Usergroups',
|
||||
'UCP_USERGROUPS_MEMBER' => 'Edit memberships',
|
||||
|
@ -12,21 +12,21 @@
|
||||
<dl>
|
||||
<dt><label for="viewemail0">{L_SHOW_EMAIL}{L_COLON}</label></dt>
|
||||
<dd>
|
||||
<label for="viewemail1"><input type="radio" name="viewemail" id="viewemail1" value="1"<!-- IF S_VIEW_EMAIL --> checked="checked"<!-- ENDIF --> /> {L_YES}</label>
|
||||
<label for="viewemail1"><input type="radio" name="viewemail" id="viewemail1" value="1"<!-- IF S_VIEW_EMAIL --> checked="checked"<!-- ENDIF --> /> {L_YES}</label>
|
||||
<label for="viewemail0"><input type="radio" name="viewemail" id="viewemail0" value="0"<!-- IF not S_VIEW_EMAIL --> checked="checked"<!-- ENDIF --> /> {L_NO}</label>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="massemail1">{L_ADMIN_EMAIL}{L_COLON}</label></dt>
|
||||
<dd>
|
||||
<label for="massemail1"><input type="radio" name="massemail" id="massemail1" value="1"<!-- IF S_MASS_EMAIL --> checked="checked"<!-- ENDIF --> /> {L_YES}</label>
|
||||
<label for="massemail1"><input type="radio" name="massemail" id="massemail1" value="1"<!-- IF S_MASS_EMAIL --> checked="checked"<!-- ENDIF --> /> {L_YES}</label>
|
||||
<label for="massemail0"><input type="radio" name="massemail" id="massemail0" value="0"<!-- IF not S_MASS_EMAIL --> checked="checked"<!-- ENDIF --> /> {L_NO}</label>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="allowpm1">{L_ALLOW_PM}{L_COLON}</label><br /><span>{L_ALLOW_PM_EXPLAIN}</span></dt>
|
||||
<dd>
|
||||
<label for="allowpm1"><input type="radio" name="allowpm" id="allowpm1" value="1"<!-- IF S_ALLOW_PM --> checked="checked"<!-- ENDIF --> /> {L_YES}</label>
|
||||
<label for="allowpm1"><input type="radio" name="allowpm" id="allowpm1" value="1"<!-- IF S_ALLOW_PM --> checked="checked"<!-- ENDIF --> /> {L_YES}</label>
|
||||
<label for="allowpm0"><input type="radio" name="allowpm" id="allowpm0" value="0"<!-- IF not S_ALLOW_PM --> checked="checked"<!-- ENDIF --> /> {L_NO}</label>
|
||||
</dd>
|
||||
</dl>
|
||||
@ -34,26 +34,28 @@
|
||||
<dl>
|
||||
<dt><label for="hideonline0">{L_HIDE_ONLINE}{L_COLON}</label><br /><span>{L_HIDE_ONLINE_EXPLAIN}</span></dt>
|
||||
<dd>
|
||||
<label for="hideonline1"><input type="radio" name="hideonline" id="hideonline1" value="1"<!-- IF S_HIDE_ONLINE --> checked="checked"<!-- ENDIF --> /> {L_YES}</label>
|
||||
<label for="hideonline1"><input type="radio" name="hideonline" id="hideonline1" value="1"<!-- IF S_HIDE_ONLINE --> checked="checked"<!-- ENDIF --> /> {L_YES}</label>
|
||||
<label for="hideonline0"><input type="radio" name="hideonline" id="hideonline0" value="0"<!-- IF not S_HIDE_ONLINE --> checked="checked"<!-- ENDIF --> /> {L_NO}</label>
|
||||
</dd>
|
||||
</dl>
|
||||
<!-- ENDIF -->
|
||||
<!-- ENDIF -->
|
||||
<!-- IF S_SELECT_NOTIFY -->
|
||||
<dl>
|
||||
<dt><label for="notifymethod0">{L_NOTIFY_METHOD}{L_COLON}</label></dt>
|
||||
<dd>
|
||||
<label for="notifymethod0"><input type="radio" name="notifymethod" id="notifymethod0" value="0"<!-- IF S_NOTIFY_EMAIL --> checked="checked"<!-- ENDIF --> /> {L_NOTIFY_METHOD_EMAIL}</label>
|
||||
<label for="notifymethod1"><input type="radio" name="notifymethod" id="notifymethod1" value="1"<!-- IF S_NOTIFY_IM --> checked="checked"<!-- ENDIF --> /> {L_NOTIFY_METHOD_IM}</label>
|
||||
<label for="notifymethod0"><input type="radio" name="notifymethod" id="notifymethod0" value="0"<!-- IF S_NOTIFY_EMAIL --> checked="checked"<!-- ENDIF --> /> {L_NOTIFY_METHOD_EMAIL}</label>
|
||||
<label for="notifymethod1"><input type="radio" name="notifymethod" id="notifymethod1" value="1"<!-- IF S_NOTIFY_IM --> checked="checked"<!-- ENDIF --> /> {L_NOTIFY_METHOD_IM}</label>
|
||||
<label for="notifymethod2"><input type="radio" name="notifymethod" id="notifymethod2" value="2"<!-- IF S_NOTIFY_BOTH --> checked="checked"<!-- ENDIF --> /> {L_NOTIFY_METHOD_BOTH}</label>
|
||||
</dd>
|
||||
</dl>
|
||||
<!-- ENDIF -->
|
||||
<dl>
|
||||
<dt><label for="lang">{L_BOARD_LANGUAGE}{L_COLON}</label></dt>
|
||||
<dd><select name="lang" id="lang">{S_LANG_OPTIONS}</select></dd>
|
||||
</dl>
|
||||
<!-- IF S_STYLE_OPTIONS -->
|
||||
<!-- IF S_MORE_LANGUAGES -->
|
||||
<dl>
|
||||
<dt><label for="lang">{L_BOARD_LANGUAGE}{L_COLON}</label></dt>
|
||||
<dd><select name="lang" id="lang">{S_LANG_OPTIONS}</select></dd>
|
||||
</dl>
|
||||
<!-- ENDIF -->
|
||||
<!-- IF S_STYLE_OPTIONS and S_MORE_STYLES -->
|
||||
<dl>
|
||||
<dt><label for="style">{L_BOARD_STYLE}{L_COLON}</label></dt>
|
||||
<dd><select name="style" id="style">{S_STYLE_OPTIONS}</select></dd>
|
||||
@ -73,9 +75,9 @@
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<fieldset class="submit-buttons">
|
||||
{S_HIDDEN_FIELDS}<input type="reset" value="{L_RESET}" name="reset" class="button2" />
|
||||
{S_HIDDEN_FIELDS}<input type="reset" value="{L_RESET}" name="reset" class="button2" />
|
||||
<input type="submit" name="submit" value="{L_SUBMIT}" class="button1" />
|
||||
{S_FORM_TOKEN}
|
||||
</fieldset>
|
||||
@ -89,9 +91,9 @@
|
||||
function customDates()
|
||||
{
|
||||
var e = document.getElementById('dateoptions');
|
||||
|
||||
|
||||
e.selectedIndex = e.length - 1;
|
||||
|
||||
|
||||
// Loop and match date_format in menu
|
||||
for (var i = 0; i < e.length; i++)
|
||||
{
|
||||
@ -101,7 +103,7 @@
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Show/hide custom field
|
||||
if (e.selectedIndex == e.length - 1)
|
||||
{
|
||||
|
@ -29,35 +29,37 @@
|
||||
<td class="row3" colspan="2" align="center"><span class="gensmall error">{ERROR}</span></td>
|
||||
</tr>
|
||||
<!-- ENDIF -->
|
||||
<tr>
|
||||
<tr>
|
||||
<td class="row1" width="50%"><b class="genmed">{L_SHOW_EMAIL}{L_COLON}</b></td>
|
||||
<td class="row2"><input type="radio" class="radio" name="viewemail" value="1"<!-- IF S_VIEW_EMAIL --> checked="checked"<!-- ENDIF --> /><span class="genmed">{L_YES}</span> <input type="radio" class="radio" name="viewemail" value="0"<!-- IF not S_VIEW_EMAIL --> checked="checked"<!-- ENDIF --> /><span class="genmed">{L_NO}</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr>
|
||||
<td class="row1" width="50%"><b class="genmed">{L_ADMIN_EMAIL}{L_COLON}</b></td>
|
||||
<td class="row2"><input type="radio" class="radio" name="massemail" value="1"<!-- IF S_MASS_EMAIL --> checked="checked"<!-- ENDIF --> /><span class="genmed">{L_YES}</span> <input type="radio" class="radio" name="massemail" value="0"<!-- IF not S_MASS_EMAIL --> checked="checked"<!-- ENDIF --> /><span class="genmed">{L_NO}</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr>
|
||||
<td class="row1" width="50%"><b class="genmed">{L_ALLOW_PM}{L_COLON}</b><br /><span class="gensmall">{L_ALLOW_PM_EXPLAIN}</span></td>
|
||||
<td class="row2"><input type="radio" class="radio" name="allowpm" value="1"<!-- IF S_ALLOW_PM --> checked="checked"<!-- ENDIF --> /><span class="genmed">{L_YES}</span> <input type="radio" class="radio" name="allowpm" value="0"<!-- IF not S_ALLOW_PM --> checked="checked"<!-- ENDIF --> /><span class="genmed">{L_NO}</span></td>
|
||||
</tr>
|
||||
<!-- IF S_CAN_HIDE_ONLINE -->
|
||||
<tr>
|
||||
<tr>
|
||||
<td class="row1" width="50%"><b class="genmed">{L_HIDE_ONLINE}{L_COLON}</b><br /><span class="gensmall">{L_HIDE_ONLINE_EXPLAIN}</span></td>
|
||||
<td class="row2"><input type="radio" class="radio" name="hideonline" value="1"<!-- IF S_HIDE_ONLINE --> checked="checked"<!-- ENDIF --> /><span class="genmed">{L_YES}</span> <input type="radio" class="radio" name="hideonline" value="0"<!-- IF not S_HIDE_ONLINE --> checked="checked"<!-- ENDIF --> /><span class="genmed">{L_NO}</span></td>
|
||||
</tr>
|
||||
<!-- ENDIF -->
|
||||
<!-- IF S_SELECT_NOTIFY -->
|
||||
<tr>
|
||||
<tr>
|
||||
<td class="row1" width="50%"><b class="genmed">{L_NOTIFY_METHOD}{L_COLON}</b><br /><span class="gensmall">{L_NOTIFY_METHOD_EXPLAIN}</span></td>
|
||||
<td class="row2"><input type="radio" class="radio" name="notifymethod" value="0"<!-- IF S_NOTIFY_EMAIL --> checked="checked"<!-- ENDIF --> /><span class="genmed">{L_NOTIFY_METHOD_EMAIL}</span> <input type="radio" class="radio" name="notifymethod" value="1"<!-- IF S_NOTIFY_IM --> checked="checked"<!-- ENDIF --> /><span class="genmed">{L_NOTIFY_METHOD_IM}</span> <input type="radio" class="radio" name="notifymethod" value="2"<!-- IF S_NOTIFY_BOTH --> checked="checked"<!-- ENDIF --> /><span class="genmed">{L_NOTIFY_METHOD_BOTH}</span></td>
|
||||
</tr>
|
||||
<!-- ENDIF -->
|
||||
<!-- IF S_MORE_LANGUAGES -->
|
||||
<tr>
|
||||
<td class="row1" width="50%"><b class="genmed">{L_BOARD_LANGUAGE}{L_COLON}</b></td>
|
||||
<td class="row2"><select name="lang">{S_LANG_OPTIONS}</select></td>
|
||||
</tr>
|
||||
<!-- IF S_STYLE_OPTIONS -->
|
||||
<!-- ENDIF -->
|
||||
<!-- IF S_STYLE_OPTIONS and S_MORE_STYLES -->
|
||||
<tr>
|
||||
<td class="row1" width="50%"><b class="genmed">{L_BOARD_STYLE}{L_COLON}</b></td>
|
||||
<td class="row2"><select name="style">{S_STYLE_OPTIONS}</select></td>
|
||||
|
@ -72,6 +72,21 @@ to connect to that database in phpBB.
|
||||
Additionally, you will need to be running the DbUnit fork from
|
||||
https://github.com/phpbb/dbunit/tree/phpbb.
|
||||
|
||||
Redis
|
||||
-----
|
||||
|
||||
In order to run tests for the Redis cache driver, at least one of Redis host
|
||||
or port must be specified in test configuration. This can be done via
|
||||
test_config.php as follows:
|
||||
|
||||
<?php
|
||||
$phpbb_redis_host = 'localhost';
|
||||
$phpbb_redis_port = 6379;
|
||||
|
||||
Or via environment variables as follows:
|
||||
|
||||
$ PHPBB_TEST_REDIS_HOST=localhost PHPBB_TEST_REDIS_PORT=6379 phpunit
|
||||
|
||||
Running
|
||||
=======
|
||||
|
||||
|
53
tests/cache/apc_driver_test.php
vendored
Normal file
53
tests/cache/apc_driver_test.php
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package testing
|
||||
* @copyright (c) 2012 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
// Important: apc.enable_cli=1 must be in php.ini.
|
||||
// http://forums.devshed.com/php-development-5/apc-problem-561290.html
|
||||
// http://php.net/manual/en/apc.configuration.php
|
||||
|
||||
require_once dirname(__FILE__) . '/common_test_case.php';
|
||||
|
||||
class phpbb_cache_apc_driver_test extends phpbb_cache_common_test_case
|
||||
{
|
||||
protected static $config;
|
||||
protected $driver;
|
||||
|
||||
public function getDataSet()
|
||||
{
|
||||
return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/config.xml');
|
||||
}
|
||||
|
||||
static public function setUpBeforeClass()
|
||||
{
|
||||
if (!extension_loaded('apc'))
|
||||
{
|
||||
self::markTestSkipped('APC extension is not loaded');
|
||||
}
|
||||
|
||||
$php_ini = new phpbb_php_ini;
|
||||
|
||||
if (!$php_ini->get_bool('apc.enabled'))
|
||||
{
|
||||
self::markTestSkipped('APC is not enabled. Make sure apc.enabled=1 in php.ini');
|
||||
}
|
||||
|
||||
if (PHP_SAPI == 'cli' && !$php_ini->get_bool('apc.enable_cli'))
|
||||
{
|
||||
self::markTestSkipped('APC is not enabled for CLI. Set apc.enable_cli=1 in php.ini');
|
||||
}
|
||||
}
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->driver = new phpbb_cache_driver_apc;
|
||||
$this->driver->purge();
|
||||
}
|
||||
}
|
109
tests/cache/cache_test.php
vendored
109
tests/cache/cache_test.php
vendored
@ -1,109 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package testing
|
||||
* @copyright (c) 2010 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
|
||||
|
||||
class phpbb_cache_test extends phpbb_database_test_case
|
||||
{
|
||||
private $cache_dir;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->cache_dir = dirname(__FILE__) . '/../tmp/cache/';
|
||||
}
|
||||
|
||||
public function getDataSet()
|
||||
{
|
||||
return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/config.xml');
|
||||
}
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
if (file_exists($this->cache_dir))
|
||||
{
|
||||
// cache directory possibly left after aborted
|
||||
// or failed run earlier
|
||||
$this->remove_cache_dir();
|
||||
}
|
||||
$this->create_cache_dir();
|
||||
}
|
||||
|
||||
protected function tearDown()
|
||||
{
|
||||
if (file_exists($this->cache_dir))
|
||||
{
|
||||
$this->remove_cache_dir();
|
||||
}
|
||||
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
private function create_cache_dir()
|
||||
{
|
||||
$this->get_test_case_helpers()->makedirs($this->cache_dir);
|
||||
}
|
||||
|
||||
private function remove_cache_dir()
|
||||
{
|
||||
$iterator = new DirectoryIterator($this->cache_dir);
|
||||
foreach ($iterator as $file)
|
||||
{
|
||||
if ($file != '.' && $file != '..')
|
||||
{
|
||||
unlink($this->cache_dir . '/' . $file);
|
||||
}
|
||||
}
|
||||
rmdir($this->cache_dir);
|
||||
}
|
||||
|
||||
public function test_cache_driver_file()
|
||||
{
|
||||
$driver = new phpbb_cache_driver_file($this->cache_dir);
|
||||
$driver->put('test_key', 'test_value');
|
||||
$driver->save();
|
||||
|
||||
$this->assertEquals(
|
||||
'test_value',
|
||||
$driver->get('test_key'),
|
||||
'File ACM put and get'
|
||||
);
|
||||
}
|
||||
|
||||
public function test_cache_sql()
|
||||
{
|
||||
$driver = new phpbb_cache_driver_file($this->cache_dir);
|
||||
|
||||
global $db, $cache;
|
||||
$db = $this->new_dbal();
|
||||
$cache = new phpbb_cache_service($driver);
|
||||
|
||||
$sql = "SELECT * FROM phpbb_config
|
||||
WHERE config_name = 'foo'";
|
||||
$result = $db->sql_query($sql, 300);
|
||||
$first_result = $db->sql_fetchrow($result);
|
||||
|
||||
$this->assertFileExists($this->cache_dir . 'sql_' . md5(preg_replace('/[\n\r\s\t]+/', ' ', $sql)) . '.php');
|
||||
|
||||
$sql = "SELECT * FROM phpbb_config
|
||||
WHERE config_name = 'foo'";
|
||||
$result = $db->sql_query($sql, 300);
|
||||
|
||||
$this->assertEquals($first_result, $db->sql_fetchrow($result));
|
||||
|
||||
$sql = "SELECT * FROM phpbb_config
|
||||
WHERE config_name = 'bar'";
|
||||
$result = $db->sql_query($sql, 300);
|
||||
|
||||
$this->assertNotEquals($first_result, $db->sql_fetchrow($result));
|
||||
|
||||
$db->sql_close();
|
||||
}
|
||||
}
|
97
tests/cache/common_test_case.php
vendored
Normal file
97
tests/cache/common_test_case.php
vendored
Normal file
@ -0,0 +1,97 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package testing
|
||||
* @copyright (c) 2012 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
abstract class phpbb_cache_common_test_case extends phpbb_database_test_case
|
||||
{
|
||||
public function test_get_put_exists()
|
||||
{
|
||||
$this->assertFalse($this->driver->_exists('test_key'));
|
||||
$this->assertSame(false, $this->driver->get('test_key'));
|
||||
|
||||
$this->driver->put('test_key', 'test_value');
|
||||
|
||||
$this->assertTrue($this->driver->_exists('test_key'));
|
||||
$this->assertEquals(
|
||||
'test_value',
|
||||
$this->driver->get('test_key'),
|
||||
'File ACM put and get'
|
||||
);
|
||||
}
|
||||
|
||||
public function test_purge()
|
||||
{
|
||||
$this->driver->put('test_key', 'test_value');
|
||||
|
||||
$this->assertEquals(
|
||||
'test_value',
|
||||
$this->driver->get('test_key'),
|
||||
'File ACM put and get'
|
||||
);
|
||||
|
||||
$this->driver->purge();
|
||||
|
||||
$this->assertSame(false, $this->driver->get('test_key'));
|
||||
}
|
||||
|
||||
public function test_destroy()
|
||||
{
|
||||
$this->driver->put('first_key', 'first_value');
|
||||
$this->driver->put('second_key', 'second_value');
|
||||
|
||||
$this->assertEquals(
|
||||
'first_value',
|
||||
$this->driver->get('first_key')
|
||||
);
|
||||
$this->assertEquals(
|
||||
'second_value',
|
||||
$this->driver->get('second_key')
|
||||
);
|
||||
|
||||
$this->driver->destroy('first_key');
|
||||
|
||||
$this->assertFalse($this->driver->_exists('first_key'));
|
||||
$this->assertEquals(
|
||||
'second_value',
|
||||
$this->driver->get('second_key')
|
||||
);
|
||||
}
|
||||
|
||||
public function test_cache_sql()
|
||||
{
|
||||
global $db, $cache;
|
||||
$db = $this->new_dbal();
|
||||
$cache = new phpbb_cache_service($this->driver);
|
||||
|
||||
$sql = "SELECT * FROM phpbb_config
|
||||
WHERE config_name = 'foo'";
|
||||
|
||||
$result = $db->sql_query($sql, 300);
|
||||
$first_result = $db->sql_fetchrow($result);
|
||||
$expected = array('config_name' => 'foo', 'config_value' => '23', 'is_dynamic' => 0);
|
||||
$this->assertEquals($expected, $first_result);
|
||||
|
||||
$sql = 'DELETE FROM phpbb_config';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$sql = "SELECT * FROM phpbb_config
|
||||
WHERE config_name = 'foo'";
|
||||
$result = $db->sql_query($sql, 300);
|
||||
|
||||
$this->assertEquals($expected, $db->sql_fetchrow($result));
|
||||
|
||||
$sql = "SELECT * FROM phpbb_config
|
||||
WHERE config_name = 'foo'";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$no_cache_result = $db->sql_fetchrow($result);
|
||||
$this->assertSame(false, $no_cache_result);
|
||||
|
||||
$db->sql_close();
|
||||
}
|
||||
}
|
69
tests/cache/file_driver_test.php
vendored
Normal file
69
tests/cache/file_driver_test.php
vendored
Normal file
@ -0,0 +1,69 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package testing
|
||||
* @copyright (c) 2010 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
require_once dirname(__FILE__) . '/common_test_case.php';
|
||||
|
||||
class phpbb_cache_file_driver_test extends phpbb_cache_common_test_case
|
||||
{
|
||||
private $cache_dir;
|
||||
protected $driver;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->cache_dir = dirname(__FILE__) . '/../tmp/cache/';
|
||||
}
|
||||
|
||||
public function getDataSet()
|
||||
{
|
||||
return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/config.xml');
|
||||
}
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
if (file_exists($this->cache_dir))
|
||||
{
|
||||
// cache directory possibly left after aborted
|
||||
// or failed run earlier
|
||||
$this->remove_cache_dir();
|
||||
}
|
||||
$this->create_cache_dir();
|
||||
|
||||
$this->driver = new phpbb_cache_driver_file($this->cache_dir);
|
||||
}
|
||||
|
||||
protected function tearDown()
|
||||
{
|
||||
if (file_exists($this->cache_dir))
|
||||
{
|
||||
$this->remove_cache_dir();
|
||||
}
|
||||
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
private function create_cache_dir()
|
||||
{
|
||||
$this->get_test_case_helpers()->makedirs($this->cache_dir);
|
||||
}
|
||||
|
||||
private function remove_cache_dir()
|
||||
{
|
||||
$iterator = new DirectoryIterator($this->cache_dir);
|
||||
foreach ($iterator as $file)
|
||||
{
|
||||
if ($file != '.' && $file != '..')
|
||||
{
|
||||
unlink($this->cache_dir . '/' . $file);
|
||||
}
|
||||
}
|
||||
rmdir($this->cache_dir);
|
||||
}
|
||||
}
|
74
tests/cache/null_driver_test.php
vendored
Normal file
74
tests/cache/null_driver_test.php
vendored
Normal file
@ -0,0 +1,74 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package testing
|
||||
* @copyright (c) 2012 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
class phpbb_cache_null_driver_test extends phpbb_database_test_case
|
||||
{
|
||||
protected $driver;
|
||||
|
||||
public function getDataSet()
|
||||
{
|
||||
return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/config.xml');
|
||||
}
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->driver = new phpbb_cache_driver_null;
|
||||
}
|
||||
|
||||
public function test_get_put()
|
||||
{
|
||||
$this->assertSame(false, $this->driver->get('key'));
|
||||
|
||||
$this->driver->put('key', 'value');
|
||||
|
||||
// null driver does not cache
|
||||
$this->assertSame(false, $this->driver->get('key'));
|
||||
}
|
||||
|
||||
public function test_purge()
|
||||
{
|
||||
// does nothing
|
||||
$this->driver->purge();
|
||||
}
|
||||
|
||||
public function test_destroy()
|
||||
{
|
||||
// does nothing
|
||||
$this->driver->destroy('foo');
|
||||
}
|
||||
|
||||
public function test_cache_sql()
|
||||
{
|
||||
global $db, $cache;
|
||||
$db = $this->new_dbal();
|
||||
$cache = new phpbb_cache_service($this->driver);
|
||||
|
||||
$sql = "SELECT * FROM phpbb_config
|
||||
WHERE config_name = 'foo'";
|
||||
$result = $db->sql_query($sql, 300);
|
||||
$first_result = $db->sql_fetchrow($result);
|
||||
$expected = array('config_name' => 'foo', 'config_value' => '23', 'is_dynamic' => 0);
|
||||
$this->assertEquals($expected, $first_result);
|
||||
|
||||
$sql = 'DELETE FROM phpbb_config';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
// As null cache driver does not actually cache,
|
||||
// this should return no results
|
||||
$sql = "SELECT * FROM phpbb_config
|
||||
WHERE config_name = 'foo'";
|
||||
$result = $db->sql_query($sql, 300);
|
||||
|
||||
$this->assertSame(false, $db->sql_fetchrow($result));
|
||||
|
||||
$db->sql_close();
|
||||
}
|
||||
}
|
49
tests/cache/redis_driver_test.php
vendored
Normal file
49
tests/cache/redis_driver_test.php
vendored
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package testing
|
||||
* @copyright (c) 2012 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
require_once dirname(__FILE__) . '/common_test_case.php';
|
||||
|
||||
class phpbb_cache_redis_driver_test extends phpbb_cache_common_test_case
|
||||
{
|
||||
protected static $config;
|
||||
protected $driver;
|
||||
|
||||
public function getDataSet()
|
||||
{
|
||||
return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/config.xml');
|
||||
}
|
||||
|
||||
static public function setUpBeforeClass()
|
||||
{
|
||||
if (!extension_loaded('redis'))
|
||||
{
|
||||
self::markTestSkipped('redis extension is not loaded');
|
||||
}
|
||||
|
||||
$config = phpbb_test_case_helpers::get_test_config();
|
||||
if (isset($config['redis_host']) || isset($config['redis_port']))
|
||||
{
|
||||
$host = isset($config['redis_host']) ? $config['redis_host'] : 'localhost';
|
||||
$port = isset($config['redis_port']) ? $config['redis_port'] : 6379;
|
||||
self::$config = array('host' => $host, 'port' => $port);
|
||||
}
|
||||
else
|
||||
{
|
||||
self::markTestSkipped('Test redis host/port is not specified');
|
||||
}
|
||||
}
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->driver = new phpbb_cache_driver_redis(self::$config['host'], self::$config['port']);
|
||||
$this->driver->purge();
|
||||
}
|
||||
}
|
43
tests/dbal/connect_test.php
Normal file
43
tests/dbal/connect_test.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package testing
|
||||
* @copyright (c) 2012 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
|
||||
|
||||
class phpbb_dbal_connect_test extends phpbb_database_test_case
|
||||
{
|
||||
public function getDataSet()
|
||||
{
|
||||
return $this->createXMLDataSet(dirname(__FILE__) . '/../fixtures/empty.xml');
|
||||
}
|
||||
|
||||
public function test_failing_connect()
|
||||
{
|
||||
global $phpbb_root_path, $phpEx;
|
||||
|
||||
$config = $this->get_database_config();
|
||||
|
||||
require_once dirname(__FILE__) . '/../../phpBB/includes/db/' . $config['dbms'] . '.php';
|
||||
$dbal = 'dbal_' . $config['dbms'];
|
||||
$db = new $dbal();
|
||||
|
||||
// Failure to connect results in a trigger_error call in dbal.
|
||||
// phpunit converts triggered errors to exceptions.
|
||||
// In particular there should be no fatals here.
|
||||
try
|
||||
{
|
||||
$db->sql_connect($config['dbhost'], 'phpbbogus', 'phpbbogus', 'phpbbogus', $config['dbport']);
|
||||
$this->assertFalse(true);
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
// should have a legitimate message
|
||||
$this->assertNotEmpty($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
55
tests/dbal/write_sequence_test.php
Normal file
55
tests/dbal/write_sequence_test.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package testing
|
||||
* @copyright (c) 2012 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
|
||||
|
||||
class phpbb_dbal_write_sequence_test extends phpbb_database_test_case
|
||||
{
|
||||
public function getDataSet()
|
||||
{
|
||||
return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/three_users.xml');
|
||||
}
|
||||
|
||||
static public function write_sequence_data()
|
||||
{
|
||||
return array(
|
||||
array(
|
||||
'ticket/11219',
|
||||
4,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider write_sequence_data
|
||||
*/
|
||||
public function test_write_sequence($username, $expected)
|
||||
{
|
||||
$db = $this->new_dbal();
|
||||
|
||||
$sql = 'INSERT INTO phpbb_users ' . $db->sql_build_array('INSERT', array(
|
||||
'username' => $username,
|
||||
'username_clean' => $username,
|
||||
'user_permissions' => '',
|
||||
'user_sig' => '',
|
||||
'user_occ' => '',
|
||||
'user_interests' => '',
|
||||
));
|
||||
$db->sql_query($sql);
|
||||
|
||||
$this->assertEquals($expected, $db->sql_nextid());
|
||||
|
||||
$sql = "SELECT user_id
|
||||
FROM phpbb_users
|
||||
WHERE username_clean = '" . $db->sql_escape($username) . "'";
|
||||
$result = $db->sql_query_limit($sql, 1);
|
||||
|
||||
$this->assertEquals($expected, $db->sql_fetchfield('user_id'));
|
||||
}
|
||||
}
|
9
tests/fixtures/empty.xml
vendored
Normal file
9
tests/fixtures/empty.xml
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<dataset>
|
||||
<table name="phpbb_sessions">
|
||||
<column>session_id</column>
|
||||
<column>session_user_id</column>
|
||||
<column>session_ip</column>
|
||||
<column>session_browser</column>
|
||||
</table>
|
||||
</dataset>
|
@ -64,6 +64,9 @@ class phpbb_functional_fileupload_form_test extends phpbb_functional_test_case
|
||||
public function test_valid_file()
|
||||
{
|
||||
$crawler = $this->upload_file('valid.jpg', 'image/jpeg');
|
||||
$this->assert_response_success();
|
||||
// ensure there was no error message rendered
|
||||
$this->assertNotContains('<h2>' . $this->lang('INFORMATION') . '</h2>', $this->client->getResponse()->getContent());
|
||||
$this->assertContains($this->lang('POSTED_ATTACHMENTS'), $crawler->filter('#postform h3')->eq(1)->text());
|
||||
}
|
||||
}
|
||||
|
74
tests/lint_test.php
Normal file
74
tests/lint_test.php
Normal file
@ -0,0 +1,74 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package testing
|
||||
* @copyright (c) 2012 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
class phpbb_lint_test extends phpbb_test_case
|
||||
{
|
||||
static protected $exclude;
|
||||
|
||||
static public function setUpBeforeClass()
|
||||
{
|
||||
$output = array();
|
||||
$status = 1;
|
||||
exec('(php -v) 2>&1', $output, $status);
|
||||
if ($status)
|
||||
{
|
||||
$output = implode("\n", $output);
|
||||
self::markTestSkipped("php is not in PATH or broken: $output");
|
||||
}
|
||||
|
||||
self::$exclude = array(
|
||||
// PHP Fatal error: Cannot declare class Container because the name is already in use in /var/www/projects/phpbb3/tests/../phpBB/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1-1.php on line 20
|
||||
// https://gist.github.com/e003913ffd493da63cbc
|
||||
dirname(__FILE__) . '/../phpBB/vendor',
|
||||
);
|
||||
}
|
||||
|
||||
public function test_lint()
|
||||
{
|
||||
if (version_compare(PHP_VERSION, '5.3.0', '<'))
|
||||
{
|
||||
$this->markTestSkipped('phpBB uses PHP 5.3 syntax in some files, linting on PHP < 5.3 will fail');
|
||||
}
|
||||
|
||||
$root = dirname(__FILE__) . '/..';
|
||||
$this->check($root);
|
||||
}
|
||||
|
||||
protected function check($root)
|
||||
{
|
||||
$dh = opendir($root);
|
||||
while (($filename = readdir($dh)) !== false)
|
||||
{
|
||||
if ($filename == '.' || $filename == '..' || $filename == 'git')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
$path = $root . '/' . $filename;
|
||||
// skip symlinks to avoid infinite loops
|
||||
if (is_link($path))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (is_dir($path) && !in_array($path, self::$exclude))
|
||||
{
|
||||
$this->check($path);
|
||||
}
|
||||
else if (substr($filename, strlen($filename)-4) == '.php')
|
||||
{
|
||||
// assume php binary is called php and it is in PATH
|
||||
$cmd = '(php -l ' . escapeshellarg($path) . ') 2>&1';
|
||||
$output = array();
|
||||
$status = 1;
|
||||
exec($cmd, $output, $status);
|
||||
$output = implode("\n", $output);
|
||||
$this->assertEquals(0, $status, "php -l failed for $path:\n$output");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
109
tests/lock/flock_test.php
Normal file
109
tests/lock/flock_test.php
Normal file
@ -0,0 +1,109 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package testing
|
||||
* @copyright (c) 2012 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
class phpbb_lock_flock_test extends phpbb_test_case
|
||||
{
|
||||
public function test_lock()
|
||||
{
|
||||
$path = __DIR__ . '/../tmp/precious';
|
||||
|
||||
$lock = new phpbb_lock_flock($path);
|
||||
$ok = $lock->acquire();
|
||||
$this->assertTrue($ok);
|
||||
$lock->release();
|
||||
}
|
||||
|
||||
public function test_consecutive_locking()
|
||||
{
|
||||
$path = __DIR__ . '/../tmp/precious';
|
||||
|
||||
$lock = new phpbb_lock_flock($path);
|
||||
$ok = $lock->acquire();
|
||||
$this->assertTrue($ok);
|
||||
$lock->release();
|
||||
|
||||
$ok = $lock->acquire();
|
||||
$this->assertTrue($ok);
|
||||
$lock->release();
|
||||
|
||||
$ok = $lock->acquire();
|
||||
$this->assertTrue($ok);
|
||||
$lock->release();
|
||||
}
|
||||
|
||||
/* This hangs the process.
|
||||
public function test_concurrent_locking_fail()
|
||||
{
|
||||
$path = __DIR__ . '/../tmp/precious';
|
||||
|
||||
$lock1 = new phpbb_lock_flock($path);
|
||||
$ok = $lock1->acquire();
|
||||
$this->assertTrue($ok);
|
||||
|
||||
$lock2 = new phpbb_lock_flock($path);
|
||||
$ok = $lock2->acquire();
|
||||
$this->assertFalse($ok);
|
||||
|
||||
$lock->release();
|
||||
$ok = $lock2->acquire();
|
||||
$this->assertTrue($ok);
|
||||
}
|
||||
*/
|
||||
|
||||
public function test_concurrent_locking()
|
||||
{
|
||||
if (!function_exists('pcntl_fork'))
|
||||
{
|
||||
$this->markTestSkipped('pcntl extension and pcntl_fork are required for this test');
|
||||
}
|
||||
|
||||
$path = __DIR__ . '/../tmp/precious';
|
||||
|
||||
$pid = pcntl_fork();
|
||||
if ($pid)
|
||||
{
|
||||
// parent
|
||||
// wait 0.5 s, acquire the lock, note how long it took
|
||||
sleep(1);
|
||||
|
||||
$lock = new phpbb_lock_flock($path);
|
||||
$start = time();
|
||||
$ok = $lock->acquire();
|
||||
$delta = time() - $start;
|
||||
$this->assertTrue($ok);
|
||||
$this->assertGreaterThan(0.5, $delta, 'First lock acquired too soon');
|
||||
|
||||
$lock->release();
|
||||
|
||||
// acquire again, this should be instantaneous
|
||||
$start = time();
|
||||
$ok = $lock->acquire();
|
||||
$delta = time() - $start;
|
||||
$this->assertTrue($ok);
|
||||
$this->assertLessThan(0.1, $delta, 'Second lock not acquired instantaneously');
|
||||
|
||||
// reap the child
|
||||
$status = null;
|
||||
pcntl_waitpid($pid, $status);
|
||||
}
|
||||
else
|
||||
{
|
||||
// child
|
||||
// immediately acquire the lock and sleep for 2 s
|
||||
$lock = new phpbb_lock_flock($path);
|
||||
$ok = $lock->acquire();
|
||||
$this->assertTrue($ok);
|
||||
sleep(2);
|
||||
$lock->release();
|
||||
|
||||
// and go away silently
|
||||
pcntl_exec('/usr/bin/env', array('true'));
|
||||
}
|
||||
}
|
||||
}
|
@ -123,6 +123,7 @@ class phpbb_mock_cache implements phpbb_cache_driver_interface
|
||||
}
|
||||
public function sql_save($query, $query_result, $ttl)
|
||||
{
|
||||
return $query_result;
|
||||
}
|
||||
public function sql_exists($query_id)
|
||||
{
|
||||
|
106
tests/search/common_test_case.php
Normal file
106
tests/search/common_test_case.php
Normal file
@ -0,0 +1,106 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package testing
|
||||
* @copyright (c) 2012 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
require_once dirname(__FILE__) . '/../test_framework/phpbb_search_test_case.php';
|
||||
|
||||
abstract class phpbb_search_common_test_case extends phpbb_search_test_case
|
||||
{
|
||||
public function keywords()
|
||||
{
|
||||
return array(
|
||||
// keywords
|
||||
// terms
|
||||
// ok
|
||||
// split words
|
||||
// common words
|
||||
array(
|
||||
'fooo',
|
||||
'all',
|
||||
true,
|
||||
array('fooo'),
|
||||
array(),
|
||||
),
|
||||
array(
|
||||
'fooo baar',
|
||||
'all',
|
||||
true,
|
||||
array('fooo', 'baar'),
|
||||
array(),
|
||||
),
|
||||
// leading, trailing and multiple spaces
|
||||
array(
|
||||
' fooo baar ',
|
||||
'all',
|
||||
true,
|
||||
array('fooo', 'baar'),
|
||||
array(),
|
||||
),
|
||||
// words too short
|
||||
array(
|
||||
'f',
|
||||
'all',
|
||||
false,
|
||||
null,
|
||||
// short words count as "common" words
|
||||
array('f'),
|
||||
),
|
||||
array(
|
||||
'f o o',
|
||||
'all',
|
||||
false,
|
||||
null,
|
||||
array('f', 'o', 'o'),
|
||||
),
|
||||
array(
|
||||
'f -o -o',
|
||||
'all',
|
||||
false,
|
||||
null,
|
||||
array('f', '-o', '-o'),
|
||||
),
|
||||
array(
|
||||
'fooo -baar',
|
||||
'all',
|
||||
true,
|
||||
array('-baar', 'fooo'),
|
||||
array(),
|
||||
),
|
||||
// all negative
|
||||
array(
|
||||
'-fooo',
|
||||
'all',
|
||||
true,
|
||||
array('-fooo'),
|
||||
array(),
|
||||
),
|
||||
array(
|
||||
'-fooo -baar',
|
||||
'all',
|
||||
true,
|
||||
array('-fooo', '-baar'),
|
||||
array(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider keywords
|
||||
*/
|
||||
public function test_split_keywords($keywords, $terms, $ok, $split_words, $common)
|
||||
{
|
||||
$rv = $this->search->split_keywords($keywords, $terms);
|
||||
$this->assertEquals($ok, $rv);
|
||||
if ($ok)
|
||||
{
|
||||
// only check criteria if the search is going to be performed
|
||||
$this->assert_array_content_equals($split_words, $this->search->get_split_words());
|
||||
}
|
||||
$this->assert_array_content_equals($common, $this->search->get_common_words());
|
||||
}
|
||||
}
|
40
tests/search/mysql_test.php
Normal file
40
tests/search/mysql_test.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package testing
|
||||
* @copyright (c) 2012 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
require_once dirname(__FILE__) . '/common_test_case.php';
|
||||
|
||||
class phpbb_search_mysql_test extends phpbb_search_common_test_case
|
||||
{
|
||||
protected $db;
|
||||
protected $search;
|
||||
|
||||
public function getDataSet()
|
||||
{
|
||||
return $this->createXMLDataSet(dirname(__FILE__) . '/../fixtures/empty.xml');
|
||||
}
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
global $phpbb_root_path, $phpEx, $config, $user, $cache;
|
||||
|
||||
parent::setUp();
|
||||
|
||||
// dbal uses cache
|
||||
$cache = new phpbb_cache_service(new phpbb_cache_driver_null);
|
||||
|
||||
// set config values
|
||||
$config['fulltext_mysql_min_word_len'] = 4;
|
||||
$config['fulltext_mysql_max_word_len'] = 254;
|
||||
|
||||
$this->db = $this->new_dbal();
|
||||
$error = null;
|
||||
$class = self::get_search_wrapper('phpbb_search_fulltext_mysql');
|
||||
$this->search = new $class($error, $phpbb_root_path, $phpEx, null, $config, $this->db, $user);
|
||||
}
|
||||
}
|
@ -7,24 +7,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
function phpbb_search_wrapper($class)
|
||||
{
|
||||
$wrapped = $class . '_wrapper';
|
||||
if (!class_exists($wrapped))
|
||||
{
|
||||
$code = "
|
||||
class $wrapped extends $class
|
||||
{
|
||||
public function get_must_contain_ids() { return \$this->must_contain_ids; }
|
||||
public function get_must_not_contain_ids() { return \$this->must_not_contain_ids; }
|
||||
}
|
||||
";
|
||||
eval($code);
|
||||
}
|
||||
return $wrapped;
|
||||
}
|
||||
require_once dirname(__FILE__) . '/../test_framework/phpbb_search_test_case.php';
|
||||
|
||||
class phpbb_search_native_test extends phpbb_database_test_case
|
||||
class phpbb_search_native_test extends phpbb_search_test_case
|
||||
{
|
||||
protected $db;
|
||||
protected $search;
|
||||
@ -41,19 +26,14 @@ class phpbb_search_native_test extends phpbb_database_test_case
|
||||
parent::setUp();
|
||||
|
||||
// dbal uses cache
|
||||
$cache = new phpbb_cache_driver_null;
|
||||
$cache = new phpbb_cache_service(new phpbb_cache_driver_null);
|
||||
|
||||
$this->db = $this->new_dbal();
|
||||
$error = null;
|
||||
$class = phpbb_search_wrapper('phpbb_search_fulltext_native');
|
||||
$class = self::get_search_wrapper('phpbb_search_fulltext_native');
|
||||
$this->search = new $class($error, $phpbb_root_path, $phpEx, null, $config, $this->db, $user);
|
||||
}
|
||||
|
||||
protected function tearDown()
|
||||
{
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
public function keywords()
|
||||
{
|
||||
return array(
|
||||
@ -106,6 +86,14 @@ class phpbb_search_native_test extends phpbb_database_test_case
|
||||
null,
|
||||
array('f', 'o', 'o'),
|
||||
),
|
||||
array(
|
||||
'f -o -o',
|
||||
'all',
|
||||
false,
|
||||
null,
|
||||
null,
|
||||
array('f', 'o', 'o'),
|
||||
),
|
||||
array(
|
||||
'foo -bar',
|
||||
'all',
|
||||
@ -167,20 +155,4 @@ class phpbb_search_native_test extends phpbb_database_test_case
|
||||
}
|
||||
$this->assert_array_content_equals($common, $this->search->get_common_words());
|
||||
}
|
||||
|
||||
public function assert_array_content_equals($one, $two)
|
||||
{
|
||||
// http://stackoverflow.com/questions/3838288/phpunit-assert-two-arrays-are-equal-but-order-of-elements-not-important
|
||||
// but one array_diff is not enough!
|
||||
if (sizeof(array_diff($one, $two)) || sizeof(array_diff($two, $one)))
|
||||
{
|
||||
// get a nice error message
|
||||
$this->assertEquals($one, $two);
|
||||
}
|
||||
else
|
||||
{
|
||||
// increase assertion count
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
40
tests/search/postgres_test.php
Normal file
40
tests/search/postgres_test.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package testing
|
||||
* @copyright (c) 2012 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
require_once dirname(__FILE__) . '/common_test_case.php';
|
||||
|
||||
class phpbb_search_postgres_test extends phpbb_search_common_test_case
|
||||
{
|
||||
protected $db;
|
||||
protected $search;
|
||||
|
||||
public function getDataSet()
|
||||
{
|
||||
return $this->createXMLDataSet(dirname(__FILE__) . '/../fixtures/empty.xml');
|
||||
}
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
global $phpbb_root_path, $phpEx, $config, $user, $cache;
|
||||
|
||||
parent::setUp();
|
||||
|
||||
// dbal uses cache
|
||||
$cache = new phpbb_cache_service(new phpbb_cache_driver_null);
|
||||
|
||||
// set config values
|
||||
$config['fulltext_postgres_min_word_len'] = 4;
|
||||
$config['fulltext_postgres_max_word_len'] = 254;
|
||||
|
||||
$this->db = $this->new_dbal();
|
||||
$error = null;
|
||||
$class = self::get_search_wrapper('phpbb_search_fulltext_postgres');
|
||||
$this->search = new $class($error, $phpbb_root_path, $phpEx, null, $config, $this->db, $user);
|
||||
}
|
||||
}
|
@ -13,6 +13,8 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test
|
||||
|
||||
protected $test_case_helpers;
|
||||
|
||||
protected $fixture_xml_data;
|
||||
|
||||
public function __construct($name = NULL, array $data = array(), $dataName = '')
|
||||
{
|
||||
parent::__construct($name, $data, $dataName);
|
||||
@ -28,6 +30,20 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test
|
||||
);
|
||||
}
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
// Resynchronise tables if a fixture was loaded
|
||||
if (isset($this->fixture_xml_data))
|
||||
{
|
||||
$config = $this->get_database_config();
|
||||
$manager = $this->create_connection_manager($config);
|
||||
$manager->connect();
|
||||
$manager->post_setup_synchronisation($this->fixture_xml_data);
|
||||
}
|
||||
}
|
||||
|
||||
public function createXMLDataSet($path)
|
||||
{
|
||||
$db_config = $this->get_database_config();
|
||||
@ -47,7 +63,9 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test
|
||||
$path = $meta_data['uri'];
|
||||
}
|
||||
|
||||
return parent::createXMLDataSet($path);
|
||||
$this->fixture_xml_data = parent::createXMLDataSet($path);
|
||||
|
||||
return $this->fixture_xml_data;
|
||||
}
|
||||
|
||||
public function get_test_case_helpers()
|
||||
@ -141,4 +159,20 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test
|
||||
{
|
||||
return $matches[1] . strtoupper($matches[2]) . $matches[3];
|
||||
}
|
||||
|
||||
public function assert_array_content_equals($one, $two)
|
||||
{
|
||||
// http://stackoverflow.com/questions/3838288/phpunit-assert-two-arrays-are-equal-but-order-of-elements-not-important
|
||||
// but one array_diff is not enough!
|
||||
if (sizeof(array_diff($one, $two)) || sizeof(array_diff($two, $one)))
|
||||
{
|
||||
// get a nice error message
|
||||
$this->assertEquals($one, $two);
|
||||
}
|
||||
else
|
||||
{
|
||||
// increase assertion count
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -426,4 +426,111 @@ class phpbb_database_test_connection_manager
|
||||
$this->pdo->exec($query);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs synchronisations on the database after a fixture has been loaded
|
||||
*
|
||||
* @param PHPUnit_Extensions_Database_DataSet_XmlDataSet $xml_data_set Information about the tables contained within the loaded fixture
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function post_setup_synchronisation($xml_data_set)
|
||||
{
|
||||
$this->ensure_connected(__METHOD__);
|
||||
$queries = array();
|
||||
|
||||
// Get escaped versions of the table names used in the fixture
|
||||
$table_names = array_map(array($this->pdo, 'PDO::quote'), $xml_data_set->getTableNames());
|
||||
|
||||
switch ($this->config['dbms'])
|
||||
{
|
||||
case 'oracle':
|
||||
// Get all of the information about the sequences
|
||||
$sql = "SELECT t.table_name, tc.column_name, d.referenced_name as sequence_name, s.increment_by, s.min_value
|
||||
FROM USER_TRIGGERS t
|
||||
JOIN USER_DEPENDENCIES d ON (d.name = t.trigger_name)
|
||||
JOIN USER_TRIGGER_COLS tc ON (tc.trigger_name = t.trigger_name)
|
||||
JOIN USER_SEQUENCES s ON (s.sequence_name = d.referenced_name)
|
||||
WHERE d.referenced_type = 'SEQUENCE'
|
||||
AND d.type = 'TRIGGER'
|
||||
AND t.table_name IN (" . implode(', ', array_map('strtoupper', $table_names)) . ')';
|
||||
|
||||
$result = $this->pdo->query($sql);
|
||||
|
||||
while ($row = $result->fetch(PDO::FETCH_ASSOC))
|
||||
{
|
||||
// Get the current max value of the table
|
||||
$sql = "SELECT MAX({$row['COLUMN_NAME']}) AS max FROM {$row['TABLE_NAME']}";
|
||||
$max_result = $this->pdo->query($sql);
|
||||
$max_row = $max_result->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if (!$max_row)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$max_val = (int) $max_row['MAX'];
|
||||
$max_val++;
|
||||
|
||||
/**
|
||||
* This is not the "proper" way, but the proper way does not allow you to completely reset
|
||||
* tables with no rows since you have to select the next value to make the change go into effect.
|
||||
* You would have to go past the minimum value to set it correctly, but that's illegal.
|
||||
* Since we have no objects attached to our sequencers (triggers aren't attached), this works fine.
|
||||
*/
|
||||
$queries[] = 'DROP SEQUENCE ' . $row['SEQUENCE_NAME'];
|
||||
$queries[] = "CREATE SEQUENCE {$row['SEQUENCE_NAME']}
|
||||
MINVALUE {$row['MIN_VALUE']}
|
||||
INCREMENT BY {$row['INCREMENT_BY']}
|
||||
START WITH $max_val";
|
||||
}
|
||||
break;
|
||||
|
||||
case 'postgres':
|
||||
// Get the sequences attached to the tables
|
||||
$sql = 'SELECT column_name, table_name FROM information_schema.columns
|
||||
WHERE table_name IN (' . implode(', ', $table_names) . ")
|
||||
AND strpos(column_default, '_seq''::regclass') > 0";
|
||||
$result = $this->pdo->query($sql);
|
||||
|
||||
$setval_queries = array();
|
||||
while ($row = $result->fetch(PDO::FETCH_ASSOC))
|
||||
{
|
||||
// Get the columns used in the fixture for this table
|
||||
$column_names = $xml_data_set->getTableMetaData($row['table_name'])->getColumns();
|
||||
|
||||
// Skip sequences that weren't specified in the fixture
|
||||
if (!in_array($row['column_name'], $column_names))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Get the old value if it exists, or use 1 if it doesn't
|
||||
$sql = "SELECT COALESCE((SELECT MAX({$row['column_name']}) + 1 FROM {$row['table_name']}), 1) AS val";
|
||||
$result_max = $this->pdo->query($sql);
|
||||
$row_max = $result_max->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if ($row_max)
|
||||
{
|
||||
$seq_name = $this->pdo->quote($row['table_name'] . '_seq');
|
||||
$max_val = (int) $row_max['val'];
|
||||
|
||||
// The last parameter is false so that the system doesn't increment it again
|
||||
$setval_queries[] = "SETVAL($seq_name, $max_val, false)";
|
||||
}
|
||||
}
|
||||
|
||||
// Combine all of the SETVALs into one query
|
||||
if (sizeof($setval_queries))
|
||||
{
|
||||
$queries[] = 'SELECT ' . implode(', ', $setval_queries);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
foreach ($queries as $query)
|
||||
{
|
||||
$this->pdo->exec($query);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
29
tests/test_framework/phpbb_search_test_case.php
Normal file
29
tests/test_framework/phpbb_search_test_case.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package testing
|
||||
* @copyright (c) 2012 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
abstract class phpbb_search_test_case extends phpbb_database_test_case
|
||||
{
|
||||
static protected function get_search_wrapper($class)
|
||||
{
|
||||
$wrapped = $class . '_wrapper';
|
||||
if (!class_exists($wrapped))
|
||||
{
|
||||
$code = "
|
||||
class $wrapped extends $class
|
||||
{
|
||||
public function get_must_contain_ids() { return \$this->must_contain_ids; }
|
||||
public function get_must_not_contain_ids() { return \$this->must_not_contain_ids; }
|
||||
public function get_split_words() { return \$this->split_words; }
|
||||
}
|
||||
";
|
||||
eval($code);
|
||||
}
|
||||
return $wrapped;
|
||||
}
|
||||
}
|
@ -91,6 +91,15 @@ class phpbb_test_case_helpers
|
||||
{
|
||||
$config['phpbb_functional_url'] = $phpbb_functional_url;
|
||||
}
|
||||
|
||||
if (isset($phpbb_redis_host))
|
||||
{
|
||||
$config['redis_host'] = $phpbb_redis_host;
|
||||
}
|
||||
if (isset($phpbb_redis_port))
|
||||
{
|
||||
$config['redis_port'] = $phpbb_redis_port;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_SERVER['PHPBB_TEST_DBMS']))
|
||||
@ -113,6 +122,16 @@ class phpbb_test_case_helpers
|
||||
));
|
||||
}
|
||||
|
||||
if (isset($_SERVER['PHPBB_TEST_REDIS_HOST']))
|
||||
{
|
||||
$config['redis_host'] = $_SERVER['PHPBB_TEST_REDIS_HOST'];
|
||||
}
|
||||
|
||||
if (isset($_SERVER['PHPBB_TEST_REDIS_PORT']))
|
||||
{
|
||||
$config['redis_port'] = $_SERVER['PHPBB_TEST_REDIS_PORT'];
|
||||
}
|
||||
|
||||
return $config;
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
stopOnFailure="false"
|
||||
syntaxCheck="true"
|
||||
strict="true"
|
||||
verbose="true"
|
||||
bootstrap="../tests/bootstrap.php">
|
||||
<testsuites>
|
||||
<testsuite name="phpBB Test Suite">
|
||||
|
@ -9,6 +9,7 @@
|
||||
stopOnFailure="false"
|
||||
syntaxCheck="true"
|
||||
strict="true"
|
||||
verbose="true"
|
||||
bootstrap="../tests/bootstrap.php">
|
||||
<testsuites>
|
||||
<testsuite name="phpBB Test Suite">
|
||||
|
Loading…
x
Reference in New Issue
Block a user