diff options
Diffstat (limited to 'phpBB/phpbb')
25 files changed, 1678 insertions, 137 deletions
diff --git a/phpBB/phpbb/cache/driver/apc.php b/phpBB/phpbb/cache/driver/apc.php index a28d91c00a..77b7b11181 100644 --- a/phpBB/phpbb/cache/driver/apc.php +++ b/phpBB/phpbb/cache/driver/apc.php @@ -18,9 +18,7 @@ class apc extends \phpbb\cache\driver\memory  	var $extension = 'apc';  	/** -	* Purge cache data -	* -	* @return null +	* {@inheritDoc}  	*/  	function purge()  	{ diff --git a/phpBB/phpbb/cache/driver/driver_interface.php b/phpBB/phpbb/cache/driver/driver_interface.php index 0715a4b934..8444028115 100644 --- a/phpBB/phpbb/cache/driver/driver_interface.php +++ b/phpBB/phpbb/cache/driver/driver_interface.php @@ -18,46 +18,73 @@ interface driver_interface  {  	/**  	* Load global cache +	* +	* @return mixed False if an error was encountered, otherwise the data type of the cached data  	*/  	public function load();  	/**  	* Unload cache object +	* +	* @return null  	*/  	public function unload();  	/**  	* Save modified objects +	* +	* @return null  	*/  	public function save();  	/**  	* Tidy cache +	* +	* @return null  	*/  	public function tidy();  	/**  	* Get saved cache object +	* +	* @param string $var_name 		Cache key +	* @return mixed 				False if an error was encountered, otherwise the saved cached object  	*/  	public function get($var_name);  	/**  	* Put data into cache +	* +	* @param string $var_name 		Cache key +	* @param mixed $var 			Cached data to store +	* @param int $ttl 				Time-to-live of cached data +	* @return null  	*/  	public function put($var_name, $var, $ttl = 0);  	/**  	* Purge cache data +	* +	* @return null  	*/  	public function purge();  	/**  	* Destroy cache data +	* +	* @param string $var_name 		Cache key +	* @param string $table 			Table name +	* @return null  	*/  	public function destroy($var_name, $table = '');  	/**  	* Check if a given cache entry exists +	* +	* @param string $var_name 		Cache key +	* +	* @return bool 					True if cache file exists and has not expired. +	*								False otherwise.  	*/  	public function _exists($var_name); diff --git a/phpBB/phpbb/cache/driver/eaccelerator.php b/phpBB/phpbb/cache/driver/eaccelerator.php index 2629cb53e5..d1ad69ef6d 100644 --- a/phpBB/phpbb/cache/driver/eaccelerator.php +++ b/phpBB/phpbb/cache/driver/eaccelerator.php @@ -22,9 +22,7 @@ class eaccelerator extends \phpbb\cache\driver\memory  	var $serialize_header = '#phpbb-serialized#';  	/** -	* Purge cache data -	* -	* @return null +	* {@inheritDoc}  	*/  	function purge()  	{ @@ -39,10 +37,8 @@ class eaccelerator extends \phpbb\cache\driver\memory  	}  	/** -	 * Perform cache garbage collection -	 * -	 * @return null -	 */ +	* {@inheritDoc} +	*/  	function tidy()  	{  		eaccelerator_gc(); diff --git a/phpBB/phpbb/cache/driver/file.php b/phpBB/phpbb/cache/driver/file.php index 6686da6953..a57a805193 100644 --- a/phpBB/phpbb/cache/driver/file.php +++ b/phpBB/phpbb/cache/driver/file.php @@ -33,7 +33,7 @@ class file extends \phpbb\cache\driver\base  	}  	/** -	* Load global cache +	* {@inheritDoc}  	*/  	function load()  	{ @@ -41,7 +41,7 @@ class file extends \phpbb\cache\driver\base  	}  	/** -	* Unload cache object +	* {@inheritDoc}  	*/  	function unload()  	{ @@ -58,7 +58,7 @@ class file extends \phpbb\cache\driver\base  	}  	/** -	* Save modified objects +	* {@inheritDoc}  	*/  	function save()  	{ @@ -93,7 +93,7 @@ class file extends \phpbb\cache\driver\base  	}  	/** -	* Tidy cache +	* {@inheritDoc}  	*/  	function tidy()  	{ @@ -155,7 +155,7 @@ class file extends \phpbb\cache\driver\base  	}  	/** -	* Get saved cache object +	* {@inheritDoc}  	*/  	function get($var_name)  	{ @@ -177,7 +177,7 @@ class file extends \phpbb\cache\driver\base  	}  	/** -	* Put data into cache +	* {@inheritDoc}  	*/  	function put($var_name, $var, $ttl = 31536000)  	{ @@ -194,7 +194,7 @@ class file extends \phpbb\cache\driver\base  	}  	/** -	* Purge cache data +	* {@inheritDoc}  	*/  	function purge()  	{ @@ -280,7 +280,7 @@ class file extends \phpbb\cache\driver\base  	}  	/** -	* Destroy cache data +	* {@inheritDoc}  	*/  	function destroy($var_name, $table = '')  	{ @@ -359,7 +359,7 @@ class file extends \phpbb\cache\driver\base  	}  	/** -	* Check if a given cache entry exist +	* {@inheritDoc}  	*/  	function _exists($var_name)  	{ @@ -385,7 +385,7 @@ class file extends \phpbb\cache\driver\base  	}  	/** -	* Load cached sql query +	* {@inheritDoc}  	*/  	function sql_load($query)  	{ @@ -431,7 +431,7 @@ class file extends \phpbb\cache\driver\base  	}  	/** -	* Ceck if a given sql query exist in cache +	* {@inheritDoc}  	*/  	function sql_exists($query_id)  	{ @@ -439,7 +439,7 @@ class file extends \phpbb\cache\driver\base  	}  	/** -	* Fetch row from cache (database) +	* {@inheritDoc}  	*/  	function sql_fetchrow($query_id)  	{ @@ -452,7 +452,7 @@ class file extends \phpbb\cache\driver\base  	}  	/** -	* Fetch a field from the current row of a cached database result (database) +	* {@inheritDoc}  	*/  	function sql_fetchfield($query_id, $field)  	{ @@ -465,7 +465,7 @@ class file extends \phpbb\cache\driver\base  	}  	/** -	* Seek a specific row in an a cached database result (database) +	* {@inheritDoc}  	*/  	function sql_rowseek($rownum, $query_id)  	{ @@ -479,7 +479,7 @@ class file extends \phpbb\cache\driver\base  	}  	/** -	* Free memory used for a cached database result (database) +	* {@inheritDoc}  	*/  	function sql_freeresult($query_id)  	{ @@ -758,6 +758,10 @@ class file extends \phpbb\cache\driver\base  	/**  	* Removes/unlinks file +	* +	* @param string $filename Filename to remove +	* @param bool $check Check file permissions +	* @return bool True if the file was successfully removed, otherwise false  	*/  	function remove_file($filename, $check = false)  	{ diff --git a/phpBB/phpbb/cache/driver/memcache.php b/phpBB/phpbb/cache/driver/memcache.php index c725ec0fb0..eb3fced973 100644 --- a/phpBB/phpbb/cache/driver/memcache.php +++ b/phpBB/phpbb/cache/driver/memcache.php @@ -56,9 +56,7 @@ class memcache extends \phpbb\cache\driver\memory  	}  	/** -	* Unload the cache resources -	* -	* @return null +	* {@inheritDoc}  	*/  	function unload()  	{ @@ -68,9 +66,7 @@ class memcache extends \phpbb\cache\driver\memory  	}  	/** -	* Purge cache data -	* -	* @return null +	* {@inheritDoc}  	*/  	function purge()  	{ diff --git a/phpBB/phpbb/cache/driver/memory.php b/phpBB/phpbb/cache/driver/memory.php index 292024212b..b618b0f3e6 100644 --- a/phpBB/phpbb/cache/driver/memory.php +++ b/phpBB/phpbb/cache/driver/memory.php @@ -50,7 +50,7 @@ abstract class memory extends \phpbb\cache\driver\base  	}  	/** -	* Load global cache +	* {@inheritDoc}  	*/  	function load()  	{ @@ -66,7 +66,7 @@ abstract class memory extends \phpbb\cache\driver\base  	}  	/** -	* Unload cache object +	* {@inheritDoc}  	*/  	function unload()  	{ @@ -81,7 +81,7 @@ abstract class memory extends \phpbb\cache\driver\base  	}  	/** -	* Save modified objects +	* {@inheritDoc}  	*/  	function save()  	{ @@ -96,7 +96,7 @@ abstract class memory extends \phpbb\cache\driver\base  	}  	/** -	* Tidy cache +	* {@inheritDoc}  	*/  	function tidy()  	{ @@ -106,7 +106,7 @@ abstract class memory extends \phpbb\cache\driver\base  	}  	/** -	* Get saved cache object +	* {@inheritDoc}  	*/  	function get($var_name)  	{ @@ -126,7 +126,7 @@ abstract class memory extends \phpbb\cache\driver\base  	}  	/** -	* Put data into cache +	* {@inheritDoc}  	*/  	function put($var_name, $var, $ttl = 2592000)  	{ @@ -142,7 +142,7 @@ abstract class memory extends \phpbb\cache\driver\base  	}  	/** -	* Purge cache data +	* {@inheritDoc}  	*/  	function purge()  	{ @@ -183,7 +183,7 @@ abstract class memory extends \phpbb\cache\driver\base  	/** -	* Destroy cache data +	* {@inheritDoc}  	*/  	function destroy($var_name, $table = '')  	{ @@ -237,7 +237,7 @@ abstract class memory extends \phpbb\cache\driver\base  	}  	/** -	* Check if a given cache entry exist +	* {@inheritDoc}  	*/  	function _exists($var_name)  	{ @@ -257,7 +257,7 @@ abstract class memory extends \phpbb\cache\driver\base  	}  	/** -	* Load cached sql query +	* {@inheritDoc}  	*/  	function sql_load($query)  	{ @@ -335,7 +335,7 @@ abstract class memory extends \phpbb\cache\driver\base  	}  	/** -	* Ceck if a given sql query exist in cache +	* {@inheritDoc}  	*/  	function sql_exists($query_id)  	{ @@ -343,7 +343,7 @@ abstract class memory extends \phpbb\cache\driver\base  	}  	/** -	* Fetch row from cache (database) +	* {@inheritDoc}  	*/  	function sql_fetchrow($query_id)  	{ @@ -356,7 +356,7 @@ abstract class memory extends \phpbb\cache\driver\base  	}  	/** -	* Fetch a field from the current row of a cached database result (database) +	* {@inheritDoc}  	*/  	function sql_fetchfield($query_id, $field)  	{ @@ -369,7 +369,7 @@ abstract class memory extends \phpbb\cache\driver\base  	}  	/** -	* Seek a specific row in an a cached database result (database) +	* {@inheritDoc}  	*/  	function sql_rowseek($rownum, $query_id)  	{ @@ -383,7 +383,7 @@ abstract class memory extends \phpbb\cache\driver\base  	}  	/** -	* Free memory used for a cached database result (database) +	* {@inheritDoc}  	*/  	function sql_freeresult($query_id)  	{ @@ -400,6 +400,10 @@ abstract class memory extends \phpbb\cache\driver\base  	/**  	* Removes/unlinks file +	* +	* @param string $filename Filename to remove +	* @param bool $check Check file permissions +	* @return bool True if the file was successfully removed, otherwise false  	*/  	function remove_file($filename, $check = false)  	{ diff --git a/phpBB/phpbb/cache/driver/null.php b/phpBB/phpbb/cache/driver/null.php index ea535ca1e1..8af63eb725 100644 --- a/phpBB/phpbb/cache/driver/null.php +++ b/phpBB/phpbb/cache/driver/null.php @@ -23,7 +23,7 @@ class null extends \phpbb\cache\driver\base  	}  	/** -	* Load global cache +	* {@inheritDoc}  	*/  	function load()  	{ @@ -31,21 +31,21 @@ class null extends \phpbb\cache\driver\base  	}  	/** -	* Unload cache object +	* {@inheritDoc}  	*/  	function unload()  	{  	}  	/** -	* Save modified objects +	* {@inheritDoc}  	*/  	function save()  	{  	}  	/** -	* Tidy cache +	* {@inheritDoc}  	*/  	function tidy()  	{ @@ -54,7 +54,7 @@ class null extends \phpbb\cache\driver\base  	}  	/** -	* Get saved cache object +	* {@inheritDoc}  	*/  	function get($var_name)  	{ @@ -62,28 +62,28 @@ class null extends \phpbb\cache\driver\base  	}  	/** -	* Put data into cache +	* {@inheritDoc}  	*/  	function put($var_name, $var, $ttl = 0)  	{  	}  	/** -	* Purge cache data +	* {@inheritDoc}  	*/  	function purge()  	{  	}  	/** -	* Destroy cache data +	* {@inheritDoc}  	*/  	function destroy($var_name, $table = '')  	{  	}  	/** -	* Check if a given cache entry exist +	* {@inheritDoc}  	*/  	function _exists($var_name)  	{ @@ -91,7 +91,7 @@ class null extends \phpbb\cache\driver\base  	}  	/** -	* Load cached sql query +	* {@inheritDoc}  	*/  	function sql_load($query)  	{ @@ -107,7 +107,7 @@ class null extends \phpbb\cache\driver\base  	}  	/** -	* Ceck if a given sql query exist in cache +	* {@inheritDoc}  	*/  	function sql_exists($query_id)  	{ @@ -115,7 +115,7 @@ class null extends \phpbb\cache\driver\base  	}  	/** -	* Fetch row from cache (database) +	* {@inheritDoc}  	*/  	function sql_fetchrow($query_id)  	{ @@ -123,7 +123,7 @@ class null extends \phpbb\cache\driver\base  	}  	/** -	* Fetch a field from the current row of a cached database result (database) +	* {@inheritDoc}  	*/  	function sql_fetchfield($query_id, $field)  	{ @@ -131,7 +131,7 @@ class null extends \phpbb\cache\driver\base  	}  	/** -	* Seek a specific row in an a cached database result (database) +	* {@inheritDoc}  	*/  	function sql_rowseek($rownum, $query_id)  	{ @@ -139,7 +139,7 @@ class null extends \phpbb\cache\driver\base  	}  	/** -	* Free memory used for a cached database result (database) +	* {@inheritDoc}  	*/  	function sql_freeresult($query_id)  	{ diff --git a/phpBB/phpbb/cache/driver/redis.php b/phpBB/phpbb/cache/driver/redis.php index 2b6f9bf36d..2f2a32a12d 100644 --- a/phpBB/phpbb/cache/driver/redis.php +++ b/phpBB/phpbb/cache/driver/redis.php @@ -92,9 +92,7 @@ class redis extends \phpbb\cache\driver\memory  	}  	/** -	* Unload the cache resources -	* -	* @return null +	* {@inheritDoc}  	*/  	function unload()  	{ @@ -104,9 +102,7 @@ class redis extends \phpbb\cache\driver\memory  	}  	/** -	* Purge cache data -	* -	* @return null +	* {@inheritDoc}  	*/  	function purge()  	{ diff --git a/phpBB/phpbb/cache/driver/wincache.php b/phpBB/phpbb/cache/driver/wincache.php index 1f040e9ab2..d0f636d9cb 100644 --- a/phpBB/phpbb/cache/driver/wincache.php +++ b/phpBB/phpbb/cache/driver/wincache.php @@ -18,9 +18,7 @@ class wincache extends \phpbb\cache\driver\memory  	var $extension = 'wincache';  	/** -	* Purge cache data -	* -	* @return null +	* {@inheritDoc}  	*/  	function purge()  	{ diff --git a/phpBB/phpbb/cache/driver/xcache.php b/phpBB/phpbb/cache/driver/xcache.php index 4d0d683b3d..6c9323ec83 100644 --- a/phpBB/phpbb/cache/driver/xcache.php +++ b/phpBB/phpbb/cache/driver/xcache.php @@ -33,9 +33,7 @@ class xcache extends \phpbb\cache\driver\memory  	}  	/** -	* Purge cache data -	* -	* @return null +	* {@inheritDoc}  	*/  	function purge()  	{ diff --git a/phpBB/phpbb/class_loader.php b/phpBB/phpbb/class_loader.php index 37b62fff24..ee9767148b 100644 --- a/phpBB/phpbb/class_loader.php +++ b/phpBB/phpbb/class_loader.php @@ -142,7 +142,13 @@ class class_loader  	*/  	public function load_class($class)  	{ -		$class = '\\' . $class; +		// In general $class is not supposed to contain a leading backslash, +		// but sometimes it does. See tickets PHP-50731 and HHVM-1840. +		if ($class[0] !== '\\') +		{ +			$class = '\\' . $class; +		} +  		if (substr($class, 0, strlen($this->namespace)) === $this->namespace)  		{  			$path = $this->resolve_path($class); diff --git a/phpBB/phpbb/controller/helper.php b/phpBB/phpbb/controller/helper.php index 10fdbb1375..54c30c93fc 100644 --- a/phpBB/phpbb/controller/helper.php +++ b/phpBB/phpbb/controller/helper.php @@ -77,9 +77,9 @@ class helper  	* @param int $status_code The status code to be sent to the page header  	* @return Response object containing rendered page  	*/ -	public function render($template_file, $page_title = '', $status_code = 200) +	public function render($template_file, $page_title = '', $status_code = 200, $display_online_list = false)  	{ -		page_header($page_title); +		page_header($page_title, $display_online_list);  		$this->template->set_filenames(array(  			'body'	=> $template_file, diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_0.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_0.php new file mode 100644 index 0000000000..41ade22a29 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_0.php @@ -0,0 +1,1177 @@ +<?php +/** +* +* @package migration +* @copyright (c) 2014 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +namespace phpbb\db\migration\data\v30x; + +class release_3_0_0 extends \phpbb\db\migration\migration +{ +	public function effectively_installed() +	{ +		return phpbb_version_compare($this->config['version'], '3.0.0', '>='); +	} + +	public function update_schema() +	{ +		return array( +			'add_tables' => array( +				$this->table_prefix . 'attachments'	=> array( +					'COLUMNS'	=> array( +						'attach_id'	=> array('UINT', NULL, 'auto_increment'), +						'post_msg_id'	=> array('UINT', 0), +						'topic_id'	=> array('UINT', 0), +						'in_message'	=> array('BOOL', 0), +						'poster_id'	=> array('UINT', 0), +						'is_orphan'	=> array('BOOL', 1), +						'physical_filename'	=> array('VCHAR', ''), +						'real_filename'	=> array('VCHAR', ''), +						'download_count'	=> array('UINT', 0), +						'attach_comment'	=> array('TEXT_UNI', ''), +						'extension'	=> array('VCHAR:100', ''), +						'mimetype'	=> array('VCHAR:100', ''), +						'filesize'	=> array('UINT:20', 0), +						'filetime'	=> array('TIMESTAMP', 0), +						'thumbnail'	=> array('BOOL', 0), +					), +					'PRIMARY_KEY'	=> 'attach_id', +					'KEYS'	=> array( +						'filetime'	=> array('INDEX', 'filetime'), +						'post_msg_id'	=> array('INDEX', 'post_msg_id'), +						'topic_id'	=> array('INDEX', 'topic_id'), +						'poster_id'	=> array('INDEX', 'poster_id'), +						'is_orphan'	=> array('INDEX', 'is_orphan'), +					), +				), + +				$this->table_prefix . 'acl_groups'	=> array( +					'COLUMNS'	=> array( +						'group_id'	=> array('UINT', 0), +						'forum_id'	=> array('UINT', 0), +						'auth_option_id'	=> array('UINT', 0), +						'auth_role_id'	=> array('UINT', 0), +						'auth_setting'	=> array('TINT:2', 0), +					), +					'KEYS'	=> array( +						'group_id'	=> array('INDEX', 'group_id'), +						'auth_opt_id'	=> array('INDEX', 'auth_option_id'), +						'auth_role_id'	=> array('INDEX', 'auth_role_id'), +					), +				), + +				$this->table_prefix . 'acl_options'	=> array( +					'COLUMNS'	=> array( +						'auth_option_id'	=> array('UINT', NULL, 'auto_increment'), +						'auth_option'	=> array('VCHAR:50', ''), +						'is_global'	=> array('BOOL', 0), +						'is_local'	=> array('BOOL', 0), +						'founder_only'	=> array('BOOL', 0), +					), +					'PRIMARY_KEY'	=> 'auth_option_id', +					'KEYS'	=> array( +						'auth_option'	=> array('INDEX', 'auth_option'), +					), +				), + +				$this->table_prefix . 'acl_roles'	=> array( +					'COLUMNS'	=> array( +						'role_id'	=> array('UINT', NULL, 'auto_increment'), +						'role_name'	=> array('VCHAR_UNI', ''), +						'role_description'	=> array('TEXT_UNI', ''), +						'role_type'	=> array('VCHAR:10', ''), +						'role_order'	=> array('USINT', 0), +					), +					'PRIMARY_KEY'	=> 'role_id', +					'KEYS'	=> array( +						'role_type'	=> array('INDEX', 'role_type'), +						'role_order'	=> array('INDEX', 'role_order'), +					), +				), + +				$this->table_prefix . 'acl_roles_data'	=> array( +					'COLUMNS'	=> array( +						'role_id'	=> array('UINT', 0), +						'auth_option_id'	=> array('UINT', 0), +						'auth_setting'	=> array('TINT:2', 0), +					), +					'PRIMARY_KEY'	=> array('role_id', 'auth_option_id'), +					'KEYS'	=> array( +						'ath_op_id'	=> array('INDEX', 'auth_option_id'), +					), +				), + +				$this->table_prefix . 'acl_users'	=> array( +					'COLUMNS'	=> array( +						'user_id'	=> array('UINT', 0), +						'forum_id'	=> array('UINT', 0), +						'auth_option_id'	=> array('UINT', 0), +						'auth_role_id'	=> array('UINT', 0), +						'auth_setting'	=> array('TINT:2', 0), +					), +					'KEYS'	=> array( +						'user_id'	=> array('INDEX', 'user_id'), +						'auth_option_id'	=> array('INDEX', 'auth_option_id'), +						'auth_role_id'	=> array('INDEX', 'auth_role_id'), +					), +				), + +				$this->table_prefix . 'banlist'	=> array( +					'COLUMNS'	=> array( +						'ban_id'	=> array('UINT', NULL, 'auto_increment'), +						'ban_userid'	=> array('UINT', 0), +						'ban_ip'	=> array('VCHAR:40', ''), +						'ban_email'	=> array('VCHAR_UNI:100', ''), +						'ban_start'	=> array('TIMESTAMP', 0), +						'ban_end'	=> array('TIMESTAMP', 0), +						'ban_exclude'	=> array('BOOL', 0), +						'ban_reason'	=> array('VCHAR_UNI', ''), +						'ban_give_reason'	=> array('VCHAR_UNI', ''), +					), +					'PRIMARY_KEY'	=> 'ban_id', +					'KEYS'	=> array( +						'ban_end'	=> array('INDEX', 'ban_end'), +						'ban_user'	=> array('INDEX', array('ban_userid', 'ban_exclude')), +						'ban_email'	=> array('INDEX', array('ban_email', 'ban_exclude')), +						'ban_ip'	=> array('INDEX', array('ban_ip', 'ban_exclude')), +					), +				), + +				$this->table_prefix . 'bbcodes'	=> array( +					'COLUMNS'	=> array( +						'bbcode_id'	=> array('TINT:3', 0), +						'bbcode_tag'	=> array('VCHAR:16', ''), +						'bbcode_helpline'	=> array('VCHAR_UNI', ''), +						'display_on_posting'	=> array('BOOL', 0), +						'bbcode_match'	=> array('TEXT_UNI', ''), +						'bbcode_tpl'	=> array('MTEXT_UNI', ''), +						'first_pass_match'	=> array('MTEXT_UNI', ''), +						'first_pass_replace'	=> array('MTEXT_UNI', ''), +						'second_pass_match'	=> array('MTEXT_UNI', ''), +						'second_pass_replace'	=> array('MTEXT_UNI', ''), +					), +					'PRIMARY_KEY'	=> 'bbcode_id', +					'KEYS'	=> array( +						'display_on_post'	=> array('INDEX', 'display_on_posting'), +					), +				), + +				$this->table_prefix . 'bookmarks'	=> array( +					'COLUMNS'	=> array( +						'topic_id'	=> array('UINT', 0), +						'user_id'	=> array('UINT', 0), +					), +					'PRIMARY_KEY'	=> array('topic_id', 'user_id'), +				), + +				$this->table_prefix . 'bots'	=> array( +					'COLUMNS'	=> array( +						'bot_id'	=> array('UINT', NULL, 'auto_increment'), +						'bot_active'	=> array('BOOL', 1), +						'bot_name'	=> array('STEXT_UNI', ''), +						'user_id'	=> array('UINT', 0), +						'bot_agent'	=> array('VCHAR', ''), +						'bot_ip'	=> array('VCHAR', ''), +					), +					'PRIMARY_KEY'	=> 'bot_id', +					'KEYS'	=> array( +						'bot_active'	=> array('INDEX', 'bot_active'), +					), +				), + +				$this->table_prefix . 'config'	=> array( +					'COLUMNS'	=> array( +						'config_name'	=> array('VCHAR', ''), +						'config_value'	=> array('VCHAR_UNI', ''), +						'is_dynamic'	=> array('BOOL', 0), +					), +					'PRIMARY_KEY'	=> 'config_name', +					'KEYS'	=> array( +						'is_dynamic'	=> array('INDEX', 'is_dynamic'), +					), +				), + +				$this->table_prefix . 'confirm'	=> array( +					'COLUMNS'	=> array( +						'confirm_id'	=> array('CHAR:32', ''), +						'session_id'	=> array('CHAR:32', ''), +						'confirm_type'	=> array('TINT:3', 0), +						'code'	=> array('VCHAR:8', ''), +						'seed'	=> array('UINT:10', 0), +					), +					'PRIMARY_KEY'	=> array('session_id', 'confirm_id'), +					'KEYS'	=> array( +						'confirm_type'	=> array('INDEX', 'confirm_type'), +					), +				), + +				$this->table_prefix . 'disallow'	=> array( +					'COLUMNS'	=> array( +						'disallow_id'	=> array('UINT', NULL, 'auto_increment'), +						'disallow_username'	=> array('VCHAR_UNI:255', ''), +					), +					'PRIMARY_KEY'	=> 'disallow_id', +				), + +				$this->table_prefix . 'drafts'	=> array( +					'COLUMNS'	=> array( +						'draft_id'	=> array('UINT', NULL, 'auto_increment'), +						'user_id'	=> array('UINT', 0), +						'topic_id'	=> array('UINT', 0), +						'forum_id'	=> array('UINT', 0), +						'save_time'	=> array('TIMESTAMP', 0), +						'draft_subject'	=> array('XSTEXT_UNI', ''), +						'draft_message'	=> array('MTEXT_UNI', ''), +					), +					'PRIMARY_KEY'	=> 'draft_id', +					'KEYS'	=> array( +						'save_time'	=> array('INDEX', 'save_time'), +					), +				), + +				$this->table_prefix . 'extensions'	=> array( +					'COLUMNS'	=> array( +						'extension_id'	=> array('UINT', NULL, 'auto_increment'), +						'group_id'	=> array('UINT', 0), +						'extension'	=> array('VCHAR:100', ''), +					), +					'PRIMARY_KEY'	=> 'extension_id', +				), + +				$this->table_prefix . 'extension_groups'	=> array( +					'COLUMNS'	=> array( +						'group_id'	=> array('UINT', NULL, 'auto_increment'), +						'group_name'	=> array('VCHAR_UNI', ''), +						'cat_id'	=> array('TINT:2', 0), +						'allow_group'	=> array('BOOL', 0), +						'download_mode'	=> array('BOOL', 1), +						'upload_icon'	=> array('VCHAR', ''), +						'max_filesize'	=> array('UINT:20', 0), +						'allowed_forums'	=> array('TEXT', ''), +						'allow_in_pm'	=> array('BOOL', 0), +					), +					'PRIMARY_KEY'	=> 'group_id', +				), + +				$this->table_prefix . 'forums'	=> array( +					'COLUMNS'	=> array( +						'forum_id'	=> array('UINT', NULL, 'auto_increment'), +						'parent_id'	=> array('UINT', 0), +						'left_id'	=> array('UINT', 0), +						'right_id'	=> array('UINT', 0), +						'forum_parents'	=> array('MTEXT', ''), +						'forum_name'	=> array('STEXT_UNI', ''), +						'forum_desc'	=> array('TEXT_UNI', ''), +						'forum_desc_bitfield'	=> array('VCHAR:255', ''), +						'forum_desc_options'	=> array('UINT:11', 7), +						'forum_desc_uid'	=> array('VCHAR:8', ''), +						'forum_link'	=> array('VCHAR_UNI', ''), +						'forum_password'	=> array('VCHAR_UNI:40', ''), +						'forum_style'	=> array('USINT', 0), +						'forum_image'	=> array('VCHAR', ''), +						'forum_rules'	=> array('TEXT_UNI', ''), +						'forum_rules_link'	=> array('VCHAR_UNI', ''), +						'forum_rules_bitfield'	=> array('VCHAR:255', ''), +						'forum_rules_options'	=> array('UINT:11', 7), +						'forum_rules_uid'	=> array('VCHAR:8', ''), +						'forum_topics_per_page'	=> array('TINT:4', 0), +						'forum_type'	=> array('TINT:4', 0), +						'forum_status'	=> array('TINT:4', 0), +						'forum_posts'	=> array('UINT', 0), +						'forum_topics'	=> array('UINT', 0), +						'forum_topics_real'	=> array('UINT', 0), +						'forum_last_post_id'	=> array('UINT', 0), +						'forum_last_poster_id'	=> array('UINT', 0), +						'forum_last_post_subject' => array('XSTEXT_UNI', ''), +						'forum_last_post_time'	=> array('TIMESTAMP', 0), +						'forum_last_poster_name'=> array('VCHAR_UNI', ''), +						'forum_last_poster_colour'=> array('VCHAR:6', ''), +						'forum_flags'	=> array('TINT:4', 32), +						'display_on_index'	=> array('BOOL', 1), +						'enable_indexing'	=> array('BOOL', 1), +						'enable_icons'	=> array('BOOL', 1), +						'enable_prune'	=> array('BOOL', 0), +						'prune_next'	=> array('TIMESTAMP', 0), +						'prune_days'	=> array('UINT', 0), +						'prune_viewed'	=> array('UINT', 0), +						'prune_freq'	=> array('UINT', 0), +					), +					'PRIMARY_KEY'	=> 'forum_id', +					'KEYS'	=> array( +						'left_right_id'	=> array('INDEX', array('left_id', 'right_id')), +						'forum_lastpost_id'	=> array('INDEX', 'forum_last_post_id'), +					), +				), + +				$this->table_prefix . 'forums_access'	=> array( +					'COLUMNS'	=> array( +						'forum_id'	=> array('UINT', 0), +						'user_id'	=> array('UINT', 0), +						'session_id'	=> array('CHAR:32', ''), +					), +					'PRIMARY_KEY'	=> array('forum_id', 'user_id', 'session_id'), +				), + +				$this->table_prefix . 'forums_track'	=> array( +					'COLUMNS'	=> array( +						'user_id'	=> array('UINT', 0), +						'forum_id'	=> array('UINT', 0), +						'mark_time'	=> array('TIMESTAMP', 0), +					), +					'PRIMARY_KEY'	=> array('user_id', 'forum_id'), +				), + +				$this->table_prefix . 'forums_watch'	=> array( +					'COLUMNS'	=> array( +						'forum_id'	=> array('UINT', 0), +						'user_id'	=> array('UINT', 0), +						'notify_status'	=> array('BOOL', 0), +					), +					'KEYS'	=> array( +						'forum_id'	=> array('INDEX', 'forum_id'), +						'user_id'	=> array('INDEX', 'user_id'), +						'notify_stat'	=> array('INDEX', 'notify_status'), +					), +				), + +				$this->table_prefix . 'groups'	=> array( +					'COLUMNS'	=> array( +						'group_id'	=> array('UINT', NULL, 'auto_increment'), +						'group_type'	=> array('TINT:4', 1), +						'group_founder_manage'	=> array('BOOL', 0), +						'group_name'	=> array('VCHAR_CI', ''), +						'group_desc'	=> array('TEXT_UNI', ''), +						'group_desc_bitfield'	=> array('VCHAR:255', ''), +						'group_desc_options'	=> array('UINT:11', 7), +						'group_desc_uid'	=> array('VCHAR:8', ''), +						'group_display'	=> array('BOOL', 0), +						'group_avatar'	=> array('VCHAR', ''), +						'group_avatar_type'	=> array('TINT:2', 0), +						'group_avatar_width'	=> array('USINT', 0), +						'group_avatar_height'	=> array('USINT', 0), +						'group_rank'	=> array('UINT', 0), +						'group_colour'	=> array('VCHAR:6', ''), +						'group_sig_chars'	=> array('UINT', 0), +						'group_receive_pm'	=> array('BOOL', 0), +						'group_message_limit'	=> array('UINT', 0), +						'group_legend'	=> array('BOOL', 1), +					), +					'PRIMARY_KEY'	=> 'group_id', +					'KEYS'	=> array( +						'group_legend'	=> array('INDEX', 'group_legend'), +					), +				), + +				$this->table_prefix . 'icons'	=> array( +					'COLUMNS'	=> array( +						'icons_id'	=> array('UINT', NULL, 'auto_increment'), +						'icons_url'	=> array('VCHAR', ''), +						'icons_width'	=> array('TINT:4', 0), +						'icons_height'	=> array('TINT:4', 0), +						'icons_order'	=> array('UINT', 0), +						'display_on_posting'	=> array('BOOL', 1), +					), +					'PRIMARY_KEY'	=> 'icons_id', +					'KEYS'	=> array( +						'display_on_posting'	=> array('INDEX', 'display_on_posting'), +					), +				), + +				$this->table_prefix . 'lang'	=> array( +					'COLUMNS'	=> array( +						'lang_id'	=> array('TINT:4', NULL, 'auto_increment'), +						'lang_iso'	=> array('VCHAR:30', ''), +						'lang_dir'	=> array('VCHAR:30', ''), +						'lang_english_name'	=> array('VCHAR_UNI:100', ''), +						'lang_local_name'	=> array('VCHAR_UNI:255', ''), +						'lang_author'	=> array('VCHAR_UNI:255', ''), +					), +					'PRIMARY_KEY'	=> 'lang_id', +					'KEYS'	=> array( +						'lang_iso'	=> array('INDEX', 'lang_iso'), +					), +				), + +				$this->table_prefix . 'log'	=> array( +					'COLUMNS'	=> array( +						'log_id'	=> array('UINT', NULL, 'auto_increment'), +						'log_type'	=> array('TINT:4', 0), +						'user_id'	=> array('UINT', 0), +						'forum_id'	=> array('UINT', 0), +						'topic_id'	=> array('UINT', 0), +						'reportee_id'	=> array('UINT', 0), +						'log_ip'	=> array('VCHAR:40', ''), +						'log_time'	=> array('TIMESTAMP', 0), +						'log_operation'	=> array('TEXT_UNI', ''), +						'log_data'	=> array('MTEXT_UNI', ''), +					), +					'PRIMARY_KEY'	=> 'log_id', +					'KEYS'	=> array( +						'log_type'	=> array('INDEX', 'log_type'), +						'forum_id'	=> array('INDEX', 'forum_id'), +						'topic_id'	=> array('INDEX', 'topic_id'), +						'reportee_id'	=> array('INDEX', 'reportee_id'), +						'user_id'	=> array('INDEX', 'user_id'), +					), +				), + +				$this->table_prefix . 'moderator_cache'	=> array( +					'COLUMNS'	=> array( +						'forum_id'	=> array('UINT', 0), +						'user_id'	=> array('UINT', 0), +						'username'	=> array('VCHAR_UNI:255', ''), +						'group_id'	=> array('UINT', 0), +						'group_name'	=> array('VCHAR_UNI', ''), +						'display_on_index'	=> array('BOOL', 1), +					), +					'KEYS'	=> array( +						'disp_idx'	=> array('INDEX', 'display_on_index'), +						'forum_id'	=> array('INDEX', 'forum_id'), +					), +				), + +				$this->table_prefix . 'modules'	=> array( +					'COLUMNS'	=> array( +						'module_id'	=> array('UINT', NULL, 'auto_increment'), +						'module_enabled'	=> array('BOOL', 1), +						'module_display'	=> array('BOOL', 1), +						'module_basename'	=> array('VCHAR', ''), +						'module_class'	=> array('VCHAR:10', ''), +						'parent_id'	=> array('UINT', 0), +						'left_id'	=> array('UINT', 0), +						'right_id'	=> array('UINT', 0), +						'module_langname'	=> array('VCHAR', ''), +						'module_mode'	=> array('VCHAR', ''), +						'module_auth'	=> array('VCHAR', ''), +					), +					'PRIMARY_KEY'	=> 'module_id', +					'KEYS'	=> array( +						'left_right_id'	=> array('INDEX', array('left_id', 'right_id')), +						'module_enabled'	=> array('INDEX', 'module_enabled'), +						'class_left_id'	=> array('INDEX', array('module_class', 'left_id')), +					), +				), + +				$this->table_prefix . 'poll_options'	=> array( +					'COLUMNS'	=> array( +						'poll_option_id'	=> array('TINT:4', 0), +						'topic_id'	=> array('UINT', 0), +						'poll_option_text'	=> array('TEXT_UNI', ''), +						'poll_option_total'	=> array('UINT', 0), +					), +					'KEYS'	=> array( +						'poll_opt_id'	=> array('INDEX', 'poll_option_id'), +						'topic_id'	=> array('INDEX', 'topic_id'), +					), +				), + +				$this->table_prefix . 'poll_votes'	=> array( +					'COLUMNS'	=> array( +						'topic_id'	=> array('UINT', 0), +						'poll_option_id'	=> array('TINT:4', 0), +						'vote_user_id'	=> array('UINT', 0), +						'vote_user_ip'	=> array('VCHAR:40', ''), +					), +					'KEYS'	=> array( +						'topic_id'	=> array('INDEX', 'topic_id'), +						'vote_user_id'	=> array('INDEX', 'vote_user_id'), +						'vote_user_ip'	=> array('INDEX', 'vote_user_ip'), +					), +				), + +				$this->table_prefix . 'posts'	=> array( +					'COLUMNS'	=> array( +						'post_id'	=> array('UINT', NULL, 'auto_increment'), +						'topic_id'	=> array('UINT', 0), +						'forum_id'	=> array('UINT', 0), +						'poster_id'	=> array('UINT', 0), +						'icon_id'	=> array('UINT', 0), +						'poster_ip'	=> array('VCHAR:40', ''), +						'post_time'	=> array('TIMESTAMP', 0), +						'post_approved'	=> array('BOOL', 1), +						'post_reported'	=> array('BOOL', 0), +						'enable_bbcode'	=> array('BOOL', 1), +						'enable_smilies'	=> array('BOOL', 1), +						'enable_magic_url'	=> array('BOOL', 1), +						'enable_sig'	=> array('BOOL', 1), +						'post_username'	=> array('VCHAR_UNI:255', ''), +						'post_subject'	=> array('XSTEXT_UNI', '', 'true_sort'), +						'post_text'	=> array('MTEXT_UNI', ''), +						'post_checksum'	=> array('VCHAR:32', ''), +						'post_attachment'	=> array('BOOL', 0), +						'bbcode_bitfield'	=> array('VCHAR:255', ''), +						'bbcode_uid'	=> array('VCHAR:8', ''), +						'post_postcount'	=> array('BOOL', 1), +						'post_edit_time'	=> array('TIMESTAMP', 0), +						'post_edit_reason'	=> array('STEXT_UNI', ''), +						'post_edit_user'	=> array('UINT', 0), +						'post_edit_count'	=> array('USINT', 0), +						'post_edit_locked'	=> array('BOOL', 0), +					), +					'PRIMARY_KEY'	=> 'post_id', +					'KEYS'	=> array( +						'forum_id'	=> array('INDEX', 'forum_id'), +						'topic_id'	=> array('INDEX', 'topic_id'), +						'poster_ip'	=> array('INDEX', 'poster_ip'), +						'poster_id'	=> array('INDEX', 'poster_id'), +						'post_approved'	=> array('INDEX', 'post_approved'), +						'tid_post_time'	=> array('INDEX', array('topic_id', 'post_time')), +					), +				), + +				$this->table_prefix . 'privmsgs'	=> array( +					'COLUMNS'	=> array( +						'msg_id'	=> array('UINT', NULL, 'auto_increment'), +						'root_level'	=> array('UINT', 0), +						'author_id'	=> array('UINT', 0), +						'icon_id'	=> array('UINT', 0), +						'author_ip'	=> array('VCHAR:40', ''), +						'message_time'	=> array('TIMESTAMP', 0), +						'enable_bbcode'	=> array('BOOL', 1), +						'enable_smilies'	=> array('BOOL', 1), +						'enable_magic_url'	=> array('BOOL', 1), +						'enable_sig'	=> array('BOOL', 1), +						'message_subject'	=> array('XSTEXT_UNI', ''), +						'message_text'	=> array('MTEXT_UNI', ''), +						'message_edit_reason'	=> array('STEXT_UNI', ''), +						'message_edit_user'	=> array('UINT', 0), +						'message_attachment'	=> array('BOOL', 0), +						'bbcode_bitfield'	=> array('VCHAR:255', ''), +						'bbcode_uid'	=> array('VCHAR:8', ''), +						'message_edit_time'	=> array('TIMESTAMP', 0), +						'message_edit_count'	=> array('USINT', 0), +						'to_address'	=> array('TEXT_UNI', ''), +						'bcc_address'	=> array('TEXT_UNI', ''), +					), +					'PRIMARY_KEY'	=> 'msg_id', +					'KEYS'	=> array( +						'author_ip'	=> array('INDEX', 'author_ip'), +						'message_time'	=> array('INDEX', 'message_time'), +						'author_id'	=> array('INDEX', 'author_id'), +						'root_level'	=> array('INDEX', 'root_level'), +					), +				), + +				$this->table_prefix . 'privmsgs_folder'	=> array( +					'COLUMNS'	=> array( +						'folder_id'	=> array('UINT', NULL, 'auto_increment'), +						'user_id'	=> array('UINT', 0), +						'folder_name'	=> array('VCHAR_UNI', ''), +						'pm_count'	=> array('UINT', 0), +					), +					'PRIMARY_KEY'	=> 'folder_id', +					'KEYS'	=> array( +						'user_id'	=> array('INDEX', 'user_id'), +					), +				), + +				$this->table_prefix . 'privmsgs_rules'	=> array( +					'COLUMNS'	=> array( +						'rule_id'	=> array('UINT', NULL, 'auto_increment'), +						'user_id'	=> array('UINT', 0), +						'rule_check'	=> array('UINT', 0), +						'rule_connection'	=> array('UINT', 0), +						'rule_string'	=> array('VCHAR_UNI', ''), +						'rule_user_id'	=> array('UINT', 0), +						'rule_group_id'	=> array('UINT', 0), +						'rule_action'	=> array('UINT', 0), +						'rule_folder_id'	=> array('INT:11', 0), +					), +					'PRIMARY_KEY'	=> 'rule_id', +					'KEYS'	=> array( +						'user_id'	=> array('INDEX', 'user_id'), +					), +				), + +				$this->table_prefix . 'privmsgs_to'	=> array( +					'COLUMNS'	=> array( +						'msg_id'	=> array('UINT', 0), +						'user_id'	=> array('UINT', 0), +						'author_id'	=> array('UINT', 0), +						'pm_deleted'	=> array('BOOL', 0), +						'pm_new'	=> array('BOOL', 1), +						'pm_unread'	=> array('BOOL', 1), +						'pm_replied'	=> array('BOOL', 0), +						'pm_marked'	=> array('BOOL', 0), +						'pm_forwarded'	=> array('BOOL', 0), +						'folder_id'	=> array('INT:11', 0), +					), +					'KEYS'	=> array( +						'msg_id'	=> array('INDEX', 'msg_id'), +						'author_id'	=> array('INDEX', 'author_id'), +						'usr_flder_id'	=> array('INDEX', array('user_id', 'folder_id')), +					), +				), + +				$this->table_prefix . 'profile_fields'	=> array( +					'COLUMNS'	=> array( +						'field_id'	=> array('UINT', NULL, 'auto_increment'), +						'field_name'	=> array('VCHAR_UNI', ''), +						'field_type'	=> array('TINT:4', 0), +						'field_ident'	=> array('VCHAR:20', ''), +						'field_length'	=> array('VCHAR:20', ''), +						'field_minlen'	=> array('VCHAR', ''), +						'field_maxlen'	=> array('VCHAR', ''), +						'field_novalue'	=> array('VCHAR_UNI', ''), +						'field_default_value'	=> array('VCHAR_UNI', ''), +						'field_validation'	=> array('VCHAR_UNI:20', ''), +						'field_required'	=> array('BOOL', 0), +						'field_show_on_reg'	=> array('BOOL', 0), +						'field_hide'	=> array('BOOL', 0), +						'field_no_view'	=> array('BOOL', 0), +						'field_active'	=> array('BOOL', 0), +						'field_order'	=> array('UINT', 0), +					), +					'PRIMARY_KEY'	=> 'field_id', +					'KEYS'	=> array( +						'fld_type'	=> array('INDEX', 'field_type'), +						'fld_ordr'	=> array('INDEX', 'field_order'), +					), +				), + +				$this->table_prefix . 'profile_fields_data'	=> array( +					'COLUMNS'	=> array( +						'user_id'	=> array('UINT', 0), +					), +					'PRIMARY_KEY'	=> 'user_id', +				), + +				$this->table_prefix . 'profile_fields_lang'	=> array( +					'COLUMNS'	=> array( +						'field_id'	=> array('UINT', 0), +						'lang_id'	=> array('UINT', 0), +						'option_id'	=> array('UINT', 0), +						'field_type'	=> array('TINT:4', 0), +						'lang_value'	=> array('VCHAR_UNI', ''), +					), +					'PRIMARY_KEY'	=> array('field_id', 'lang_id', 'option_id'), +				), + +				$this->table_prefix . 'profile_lang'	=> array( +					'COLUMNS'	=> array( +						'field_id'	=> array('UINT', 0), +						'lang_id'	=> array('UINT', 0), +						'lang_name'	=> array('VCHAR_UNI', ''), +						'lang_explain'	=> array('TEXT_UNI', ''), +						'lang_default_value'	=> array('VCHAR_UNI', ''), +					), +					'PRIMARY_KEY'	=> array('field_id', 'lang_id'), +				), + +				$this->table_prefix . 'ranks'	=> array( +					'COLUMNS'	=> array( +						'rank_id'	=> array('UINT', NULL, 'auto_increment'), +						'rank_title'	=> array('VCHAR_UNI', ''), +						'rank_min'	=> array('UINT', 0), +						'rank_special'	=> array('BOOL', 0), +						'rank_image'	=> array('VCHAR', ''), +					), +					'PRIMARY_KEY'	=> 'rank_id', +				), + +				$this->table_prefix . 'reports'	=> array( +					'COLUMNS'	=> array( +						'report_id'	=> array('UINT', NULL, 'auto_increment'), +						'reason_id'	=> array('USINT', 0), +						'post_id'	=> array('UINT', 0), +						'user_id'	=> array('UINT', 0), +						'user_notify'	=> array('BOOL', 0), +						'report_closed'	=> array('BOOL', 0), +						'report_time'	=> array('TIMESTAMP', 0), +						'report_text'	=> array('MTEXT_UNI', ''), +					), +					'PRIMARY_KEY'	=> 'report_id', +				), + +				$this->table_prefix . 'reports_reasons'	=> array( +					'COLUMNS'	=> array( +						'reason_id'	=> array('USINT', NULL, 'auto_increment'), +						'reason_title'	=> array('VCHAR_UNI', ''), +						'reason_description'	=> array('MTEXT_UNI', ''), +						'reason_order'	=> array('USINT', 0), +					), +					'PRIMARY_KEY'	=> 'reason_id', +				), + +				$this->table_prefix . 'search_results'	=> array( +					'COLUMNS'	=> array( +						'search_key'	=> array('VCHAR:32', ''), +						'search_time'	=> array('TIMESTAMP', 0), +						'search_keywords'	=> array('MTEXT_UNI', ''), +						'search_authors'	=> array('MTEXT', ''), +					), +					'PRIMARY_KEY'	=> 'search_key', +				), + +				$this->table_prefix . 'search_wordlist'	=> array( +					'COLUMNS'	=> array( +						'word_id'	=> array('UINT', NULL, 'auto_increment'), +						'word_text'	=> array('VCHAR_UNI', ''), +						'word_common'	=> array('BOOL', 0), +						'word_count'	=> array('UINT', 0), +					), +					'PRIMARY_KEY'	=> 'word_id', +					'KEYS'	=> array( +						'wrd_txt'	=> array('UNIQUE', 'word_text'), +						'wrd_cnt'	=> array('INDEX', 'word_count'), +					), +				), + +				$this->table_prefix . 'search_wordmatch'	=> array( +					'COLUMNS'	=> array( +						'post_id'	=> array('UINT', 0), +						'word_id'	=> array('UINT', 0), +						'title_match'	=> array('BOOL', 0), +					), +					'KEYS'	=> array( +						'unq_mtch'	=> array('UNIQUE', array('word_id', 'post_id', 'title_match')), +						'word_id'	=> array('INDEX', 'word_id'), +						'post_id'	=> array('INDEX', 'post_id'), +					), +				), + +				$this->table_prefix . 'sessions'	=> array( +					'COLUMNS'	=> array( +						'session_id'	=> array('CHAR:32', ''), +						'session_user_id'	=> array('UINT', 0), +						'session_last_visit'	=> array('TIMESTAMP', 0), +						'session_start'	=> array('TIMESTAMP', 0), +						'session_time'	=> array('TIMESTAMP', 0), +						'session_ip'	=> array('VCHAR:40', ''), +						'session_browser'	=> array('VCHAR:150', ''), +						'session_forwarded_for'	=> array('VCHAR:255', ''), +						'session_page'	=> array('VCHAR_UNI', ''), +						'session_viewonline'	=> array('BOOL', 1), +						'session_autologin'	=> array('BOOL', 0), +						'session_admin'	=> array('BOOL', 0), +					), +					'PRIMARY_KEY'	=> 'session_id', +					'KEYS'	=> array( +						'session_time'	=> array('INDEX', 'session_time'), +						'session_user_id'	=> array('INDEX', 'session_user_id'), +					), +				), + +				$this->table_prefix . 'sessions_keys'	=> array( +					'COLUMNS'	=> array( +						'key_id'	=> array('CHAR:32', ''), +						'user_id'	=> array('UINT', 0), +						'last_ip'	=> array('VCHAR:40', ''), +						'last_login'	=> array('TIMESTAMP', 0), +					), +					'PRIMARY_KEY'	=> array('key_id', 'user_id'), +					'KEYS'	=> array( +						'last_login'	=> array('INDEX', 'last_login'), +					), +				), + +				$this->table_prefix . 'sitelist'	=> array( +					'COLUMNS'	=> array( +						'site_id'	=> array('UINT', NULL, 'auto_increment'), +						'site_ip'	=> array('VCHAR:40', ''), +						'site_hostname'	=> array('VCHAR', ''), +						'ip_exclude'	=> array('BOOL', 0), +					), +					'PRIMARY_KEY'	=> 'site_id', +				), + +				$this->table_prefix . 'smilies'	=> array( +					'COLUMNS'	=> array( +						'smiley_id'	=> array('UINT', NULL, 'auto_increment'), +// We may want to set 'code' to VCHAR:50 or check if unicode support is possible... at the moment only ASCII characters are allowed. +						'code'	=> array('VCHAR_UNI:50', ''), +						'emotion'	=> array('VCHAR_UNI:50', ''), +						'smiley_url'	=> array('VCHAR:50', ''), +						'smiley_width'	=> array('USINT', 0), +						'smiley_height'	=> array('USINT', 0), +						'smiley_order'	=> array('UINT', 0), +						'display_on_posting'=> array('BOOL', 1), +					), +					'PRIMARY_KEY'	=> 'smiley_id', +					'KEYS'	=> array( +						'display_on_post'	=> array('INDEX', 'display_on_posting'), +					), +				), + +				$this->table_prefix . 'styles'	=> array( +					'COLUMNS'	=> array( +						'style_id'	=> array('USINT', NULL, 'auto_increment'), +						'style_name'	=> array('VCHAR_UNI:255', ''), +						'style_copyright'	=> array('VCHAR_UNI', ''), +						'style_active'	=> array('BOOL', 1), +						'template_id'	=> array('USINT', 0), +						'theme_id'	=> array('USINT', 0), +						'imageset_id'	=> array('USINT', 0), +					), +					'PRIMARY_KEY'	=> 'style_id', +					'KEYS'	=> array( +						'style_name'	=> array('UNIQUE', 'style_name'), +						'template_id'	=> array('INDEX', 'template_id'), +						'theme_id'	=> array('INDEX', 'theme_id'), +						'imageset_id'	=> array('INDEX', 'imageset_id'), +					), +				), + +				$this->table_prefix . 'styles_template'	=> array( +					'COLUMNS'	=> array( +						'template_id'	=> array('USINT', NULL, 'auto_increment'), +						'template_name'	=> array('VCHAR_UNI:255', ''), +						'template_copyright'	=> array('VCHAR_UNI', ''), +						'template_path'	=> array('VCHAR:100', ''), +						'bbcode_bitfield'	=> array('VCHAR:255', 'kNg='), +						'template_storedb'	=> array('BOOL', 0), +					), +					'PRIMARY_KEY'	=> 'template_id', +					'KEYS'	=> array( +						'tmplte_nm'	=> array('UNIQUE', 'template_name'), +					), +				), + +				$this->table_prefix . 'styles_template_data'	=> array( +					'COLUMNS'	=> array( +						'template_id'	=> array('USINT', 0), +						'template_filename'	=> array('VCHAR:100', ''), +						'template_included'	=> array('TEXT', ''), +						'template_mtime'	=> array('TIMESTAMP', 0), +						'template_data'	=> array('MTEXT_UNI', ''), +					), +					'KEYS'	=> array( +						'tid'	=> array('INDEX', 'template_id'), +						'tfn'	=> array('INDEX', 'template_filename'), +					), +				), + +				$this->table_prefix . 'styles_theme'	=> array( +					'COLUMNS'	=> array( +						'theme_id'	=> array('USINT', NULL, 'auto_increment'), +						'theme_name'	=> array('VCHAR_UNI:255', ''), +						'theme_copyright'	=> array('VCHAR_UNI', ''), +						'theme_path'	=> array('VCHAR:100', ''), +						'theme_storedb'	=> array('BOOL', 0), +						'theme_mtime'	=> array('TIMESTAMP', 0), +						'theme_data'	=> array('MTEXT_UNI', ''), +					), +					'PRIMARY_KEY'	=> 'theme_id', +					'KEYS'	=> array( +						'theme_name'	=> array('UNIQUE', 'theme_name'), +					), +				), + +				$this->table_prefix . 'styles_imageset'	=> array( +					'COLUMNS'	=> array( +						'imageset_id'	=> array('USINT', NULL, 'auto_increment'), +						'imageset_name'	=> array('VCHAR_UNI:255', ''), +						'imageset_copyright'	=> array('VCHAR_UNI', ''), +						'imageset_path'	=> array('VCHAR:100', ''), +					), +					'PRIMARY_KEY'	=> 'imageset_id', +					'KEYS'	=> array( +						'imgset_nm'	=> array('UNIQUE', 'imageset_name'), +					), +				), + +				$this->table_prefix . 'styles_imageset_data'	=> array( +					'COLUMNS'	=> array( +						'image_id'	=> array('USINT', NULL, 'auto_increment'), +						'image_name'	=> array('VCHAR:200', ''), +						'image_filename'	=> array('VCHAR:200', ''), +						'image_lang'	=> array('VCHAR:30', ''), +						'image_height'	=> array('USINT', 0), +						'image_width'	=> array('USINT', 0), +						'imageset_id'	=> array('USINT', 0), +					), +					'PRIMARY_KEY'	=> 'image_id', +					'KEYS'	=> array( +						'i_d'	=> array('INDEX', 'imageset_id'), +					), +				), + +				$this->table_prefix . 'topics'	=> array( +					'COLUMNS'	=> array( +						'topic_id'	=> array('UINT', NULL, 'auto_increment'), +						'forum_id'	=> array('UINT', 0), +						'icon_id'	=> array('UINT', 0), +						'topic_attachment'	=> array('BOOL', 0), +						'topic_approved'	=> array('BOOL', 1), +						'topic_reported'	=> array('BOOL', 0), +						'topic_title'	=> array('XSTEXT_UNI', '', 'true_sort'), +						'topic_poster'	=> array('UINT', 0), +						'topic_time'	=> array('TIMESTAMP', 0), +						'topic_time_limit'	=> array('TIMESTAMP', 0), +						'topic_views'	=> array('UINT', 0), +						'topic_replies'	=> array('UINT', 0), +						'topic_replies_real'	=> array('UINT', 0), +						'topic_status'	=> array('TINT:3', 0), +						'topic_type'	=> array('TINT:3', 0), +						'topic_first_post_id'	=> array('UINT', 0), +						'topic_first_poster_name'	=> array('VCHAR_UNI', ''), +						'topic_first_poster_colour'	=> array('VCHAR:6', ''), +						'topic_last_post_id'	=> array('UINT', 0), +						'topic_last_poster_id'	=> array('UINT', 0), +						'topic_last_poster_name'	=> array('VCHAR_UNI', ''), +						'topic_last_poster_colour'	=> array('VCHAR:6', ''), +						'topic_last_post_subject'	=> array('XSTEXT_UNI', ''), +						'topic_last_post_time'	=> array('TIMESTAMP', 0), +						'topic_last_view_time'	=> array('TIMESTAMP', 0), +						'topic_moved_id'	=> array('UINT', 0), +						'topic_bumped'	=> array('BOOL', 0), +						'topic_bumper'	=> array('UINT', 0), +						'poll_title'	=> array('STEXT_UNI', ''), +						'poll_start'	=> array('TIMESTAMP', 0), +						'poll_length'	=> array('TIMESTAMP', 0), +						'poll_max_options'	=> array('TINT:4', 1), +						'poll_last_vote'	=> array('TIMESTAMP', 0), +						'poll_vote_change'	=> array('BOOL', 0), +					), +					'PRIMARY_KEY'	=> 'topic_id', +					'KEYS'	=> array( +						'forum_id'	=> array('INDEX', 'forum_id'), +						'forum_id_type'	=> array('INDEX', array('forum_id', 'topic_type')), +						'last_post_time'	=> array('INDEX', 'topic_last_post_time'), +						'topic_approved'	=> array('INDEX', 'topic_approved'), +						'forum_appr_last'	=> array('INDEX', array('forum_id', 'topic_approved', 'topic_last_post_id')), +						'fid_time_moved'	=> array('INDEX', array('forum_id', 'topic_last_post_time', 'topic_moved_id')), +					), +				), + +				$this->table_prefix . 'topics_track'	=> array( +					'COLUMNS'	=> array( +						'user_id'	=> array('UINT', 0), +						'topic_id'	=> array('UINT', 0), +						'forum_id'	=> array('UINT', 0), +						'mark_time'	=> array('TIMESTAMP', 0), +					), +					'PRIMARY_KEY'	=> array('user_id', 'topic_id'), +					'KEYS'	=> array( +						'forum_id'	=> array('INDEX', 'forum_id'), +					), +				), + +				$this->table_prefix . 'topics_posted'	=> array( +					'COLUMNS'	=> array( +						'user_id'	=> array('UINT', 0), +						'topic_id'	=> array('UINT', 0), +						'topic_posted'	=> array('BOOL', 0), +					), +					'PRIMARY_KEY'	=> array('user_id', 'topic_id'), +				), + +				$this->table_prefix . 'topics_watch'	=> array( +					'COLUMNS'	=> array( +						'topic_id'	=> array('UINT', 0), +						'user_id'	=> array('UINT', 0), +						'notify_status'	=> array('BOOL', 0), +					), +					'KEYS'	=> array( +						'topic_id'	=> array('INDEX', 'topic_id'), +						'user_id'	=> array('INDEX', 'user_id'), +						'notify_stat'	=> array('INDEX', 'notify_status'), +					), +				), + +				$this->table_prefix . 'user_group'	=> array( +					'COLUMNS'	=> array( +						'group_id'	=> array('UINT', 0), +						'user_id'	=> array('UINT', 0), +						'group_leader'	=> array('BOOL', 0), +						'user_pending'	=> array('BOOL', 1), +					), +					'KEYS'	=> array( +						'group_id'	=> array('INDEX', 'group_id'), +						'user_id'	=> array('INDEX', 'user_id'), +						'group_leader'	=> array('INDEX', 'group_leader'), +					), +				), + +				$this->table_prefix . 'users'	=> array( +					'COLUMNS'	=> array( +						'user_id'	=> array('UINT', NULL, 'auto_increment'), +						'user_type'	=> array('TINT:2', 0), +						'group_id'	=> array('UINT', 3), +						'user_permissions'	=> array('MTEXT', ''), +						'user_perm_from'	=> array('UINT', 0), +						'user_ip'	=> array('VCHAR:40', ''), +						'user_regdate'	=> array('TIMESTAMP', 0), +						'username'	=> array('VCHAR_CI', ''), +						'username_clean'	=> array('VCHAR_CI', ''), +						'user_password'	=> array('VCHAR_UNI:40', ''), +						'user_passchg'	=> array('TIMESTAMP', 0), +						'user_pass_convert'	=> array('BOOL', 0), +						'user_email'	=> array('VCHAR_UNI:100', ''), +						'user_email_hash'	=> array('BINT', 0), +						'user_birthday'	=> array('VCHAR:10', ''), +						'user_lastvisit'	=> array('TIMESTAMP', 0), +						'user_lastmark'	=> array('TIMESTAMP', 0), +						'user_lastpost_time'	=> array('TIMESTAMP', 0), +						'user_lastpage'	=> array('VCHAR_UNI:200', ''), +						'user_last_confirm_key'	=> array('VCHAR:10', ''), +						'user_last_search'	=> array('TIMESTAMP', 0), +						'user_warnings'	=> array('TINT:4', 0), +						'user_last_warning'	=> array('TIMESTAMP', 0), +						'user_login_attempts'	=> array('TINT:4', 0), +						'user_inactive_reason'	=> array('TINT:2', 0), +						'user_inactive_time'	=> array('TIMESTAMP', 0), +						'user_posts'	=> array('UINT', 0), +						'user_lang'	=> array('VCHAR:30', ''), +						'user_timezone'	=> array('DECIMAL', 0), +						'user_dst'	=> array('BOOL', 0), +						'user_dateformat'	=> array('VCHAR_UNI:30', 'd M Y H:i'), +						'user_style'	=> array('USINT', 0), +						'user_rank'	=> array('UINT', 0), +						'user_colour'	=> array('VCHAR:6', ''), +						'user_new_privmsg'	=> array('INT:4', 0), +						'user_unread_privmsg'	=> array('INT:4', 0), +						'user_last_privmsg'	=> array('TIMESTAMP', 0), +						'user_message_rules'	=> array('BOOL', 0), +						'user_full_folder'	=> array('INT:11', -3), +						'user_emailtime'	=> array('TIMESTAMP', 0), +						'user_topic_show_days'	=> array('USINT', 0), +						'user_topic_sortby_type'	=> array('VCHAR:1', 't'), +						'user_topic_sortby_dir'	=> array('VCHAR:1', 'd'), +						'user_post_show_days'	=> array('USINT', 0), +						'user_post_sortby_type'	=> array('VCHAR:1', 't'), +						'user_post_sortby_dir'	=> array('VCHAR:1', 'a'), +						'user_notify'	=> array('BOOL', 0), +						'user_notify_pm'	=> array('BOOL', 1), +						'user_notify_type'	=> array('TINT:4', 0), +						'user_allow_pm'	=> array('BOOL', 1), +						'user_allow_viewonline'	=> array('BOOL', 1), +						'user_allow_viewemail'	=> array('BOOL', 1), +						'user_allow_massemail'	=> array('BOOL', 1), +						'user_options'	=> array('UINT:11', 895), +						'user_avatar'	=> array('VCHAR', ''), +						'user_avatar_type'	=> array('TINT:2', 0), +						'user_avatar_width'	=> array('USINT', 0), +						'user_avatar_height'	=> array('USINT', 0), +						'user_sig'	=> array('MTEXT_UNI', ''), +						'user_sig_bbcode_uid'	=> array('VCHAR:8', ''), +						'user_sig_bbcode_bitfield'	=> array('VCHAR:255', ''), +						'user_from'	=> array('VCHAR_UNI:100', ''), +						'user_icq'	=> array('VCHAR:15', ''), +						'user_aim'	=> array('VCHAR_UNI', ''), +						'user_yim'	=> array('VCHAR_UNI', ''), +						'user_msnm'	=> array('VCHAR_UNI', ''), +						'user_jabber'	=> array('VCHAR_UNI', ''), +						'user_website'	=> array('VCHAR_UNI:200', ''), +						'user_occ'	=> array('TEXT_UNI', ''), +						'user_interests'	=> array('TEXT_UNI', ''), +						'user_actkey'	=> array('VCHAR:32', ''), +						'user_newpasswd'	=> array('VCHAR_UNI:40', ''), +						'user_form_salt'	=> array('VCHAR_UNI:32', ''), + +					), +					'PRIMARY_KEY'	=> 'user_id', +					'KEYS'	=> array( +						'user_birthday'	=> array('INDEX', 'user_birthday'), +						'user_email_hash'	=> array('INDEX', 'user_email_hash'), +						'user_type'	=> array('INDEX', 'user_type'), +						'username_clean'	=> array('UNIQUE', 'username_clean'), +					), +				), + +				$this->table_prefix . 'warnings'	=> array( +					'COLUMNS'	=> array( +						'warning_id'	=> array('UINT', NULL, 'auto_increment'), +						'user_id'	=> array('UINT', 0), +						'post_id'	=> array('UINT', 0), +						'log_id'	=> array('UINT', 0), +						'warning_time'	=> array('TIMESTAMP', 0), +					), +					'PRIMARY_KEY'	=> 'warning_id', +				), + +				$this->table_prefix . 'words'	=> array( +					'COLUMNS'	=> array( +						'word_id'	=> array('UINT', NULL, 'auto_increment'), +						'word'	=> array('VCHAR_UNI', ''), +						'replacement'	=> array('VCHAR_UNI', ''), +					), +					'PRIMARY_KEY'	=> 'word_id', +				), + +				$this->table_prefix . 'zebra'	=> array( +					'COLUMNS'	=> array( +						'user_id'	=> array('UINT', 0), +						'zebra_id'	=> array('UINT', 0), +						'friend'	=> array('BOOL', 0), +						'foe'	=> array('BOOL', 0), +					), +					'PRIMARY_KEY'	=> array('user_id', 'zebra_id'), +				), +			), +		); +	} + +	public function revert_schema() +	{ +		return array( +			'drop_tables' => array( +				$this->table_prefix . 'attachments', +				$this->table_prefix . 'acl_groups', +				$this->table_prefix . 'acl_options', +				$this->table_prefix . 'acl_roles', +				$this->table_prefix . 'acl_roles_data', +				$this->table_prefix . 'acl_users', +				$this->table_prefix . 'banlist', +				$this->table_prefix . 'bbcodes', +				$this->table_prefix . 'bookmarks', +				$this->table_prefix . 'bots', +				$this->table_prefix . 'config', +				$this->table_prefix . 'confirm', +				$this->table_prefix . 'disallow', +				$this->table_prefix . 'drafts', +				$this->table_prefix . 'extensions', +				$this->table_prefix . 'extension_groups', +				$this->table_prefix . 'forums', +				$this->table_prefix . 'forums_access', +				$this->table_prefix . 'forums_track', +				$this->table_prefix . 'forums_watch', +				$this->table_prefix . 'groups', +				$this->table_prefix . 'icons', +				$this->table_prefix . 'lang', +				$this->table_prefix . 'log', +				$this->table_prefix . 'moderator_cache', +				$this->table_prefix . 'modules', +				$this->table_prefix . 'poll_options', +				$this->table_prefix . 'poll_votes', +				$this->table_prefix . 'posts', +				$this->table_prefix . 'privmsgs', +				$this->table_prefix . 'privmsgs_folder', +				$this->table_prefix . 'privmsgs_rules', +				$this->table_prefix . 'privmsgs_to', +				$this->table_prefix . 'profile_fields', +				$this->table_prefix . 'profile_fields_data', +				$this->table_prefix . 'profile_fields_lang', +				$this->table_prefix . 'profile_lang', +				$this->table_prefix . 'ranks', +				$this->table_prefix . 'reports', +				$this->table_prefix . 'reports_reasons', +				$this->table_prefix . 'search_results', +				$this->table_prefix . 'search_wordlist', +				$this->table_prefix . 'search_wordmatch', +				$this->table_prefix . 'sessions', +				$this->table_prefix . 'sessions_keys', +				$this->table_prefix . 'sitelist', +				$this->table_prefix . 'smilies', +				$this->table_prefix . 'styles', +				$this->table_prefix . 'styles_template', +				$this->table_prefix . 'styles_template_data', +				$this->table_prefix . 'styles_theme', +				$this->table_prefix . 'styles_imageset', +				$this->table_prefix . 'styles_imageset_data', +				$this->table_prefix . 'topics', +				$this->table_prefix . 'topics_track', +				$this->table_prefix . 'topics_posted', +				$this->table_prefix . 'topics_watch', +				$this->table_prefix . 'user_group', +				$this->table_prefix . 'users', +				$this->table_prefix . 'warnings', +				$this->table_prefix . 'words', +				$this->table_prefix . 'zebra', +			), +		); +	} +} diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_1_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_1_rc1.php index 862276528d..c8273c0801 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_1_rc1.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_1_rc1.php @@ -16,6 +16,11 @@ class release_3_0_1_rc1 extends \phpbb\db\migration\migration  		return phpbb_version_compare($this->config['version'], '3.0.1-RC1', '>=');  	} +	static public function depends_on() +	{ +		return array('\phpbb\db\migration\data\v30x\release_3_0_0'); +	} +  	public function update_schema()  	{  		return array( diff --git a/phpBB/phpbb/db/migration/data/v310/beta2.php b/phpBB/phpbb/db/migration/data/v310/beta2.php new file mode 100644 index 0000000000..4cf29dfb3d --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/beta2.php @@ -0,0 +1,29 @@ +<?php +/** +* +* @package migration +* @copyright (c) 2014 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License v2 +* +*/ + +namespace phpbb\db\migration\data\v310; + +class beta2 extends \phpbb\db\migration\migration +{ +	static public function depends_on() +	{ +		return array( +			'\phpbb\db\migration\data\v310\beta1', +			'\phpbb\db\migration\data\v310\acp_prune_users_module', +			'\phpbb\db\migration\data\v310\profilefield_location_cleanup', +		); +	} + +	public function update_data() +	{ +		return array( +			array('config.update', array('version', '3.1.0-b2')), +		); +	} +} diff --git a/phpBB/phpbb/db/migration/data/v310/dev.php b/phpBB/phpbb/db/migration/data/v310/dev.php index c1db883616..83611d3731 100644 --- a/phpBB/phpbb/db/migration/data/v310/dev.php +++ b/phpBB/phpbb/db/migration/data/v310/dev.php @@ -23,6 +23,7 @@ class dev extends \phpbb\db\migration\migration  			'\phpbb\db\migration\data\v310\style_update_p2',  			'\phpbb\db\migration\data\v310\timezone_p2',  			'\phpbb\db\migration\data\v310\reported_posts_display', +			'\phpbb\db\migration\data\v310\migrations_table',  		);  	} diff --git a/phpBB/phpbb/db/migration/data/v310/jquery_update2.php b/phpBB/phpbb/db/migration/data/v310/jquery_update2.php new file mode 100644 index 0000000000..46a115d8ad --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/jquery_update2.php @@ -0,0 +1,33 @@ +<?php +/** +* +* @package migration +* @copyright (c) 2014 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License v2 +* +*/ + +namespace phpbb\db\migration\data\v310; + +class jquery_update2 extends \phpbb\db\migration\migration +{ +	public function effectively_installed() +	{ +		return $this->config['load_jquery_url'] !== '//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js'; +	} + +	static public function depends_on() +	{ +		return array( +			'\phpbb\db\migration\data\v310\jquery_update', +		); +	} + +	public function update_data() +	{ +		return array( +			array('config.update', array('load_jquery_url', '//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js')), +		); +	} + +} diff --git a/phpBB/phpbb/db/migration/data/v310/migrations_table.php b/phpBB/phpbb/db/migration/data/v310/migrations_table.php new file mode 100644 index 0000000000..e70fd35819 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/migrations_table.php @@ -0,0 +1,47 @@ +<?php +/** +* +* @package migration +* @copyright (c) 2014 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +namespace phpbb\db\migration\data\v310; + +class migrations_table extends \phpbb\db\migration\migration +{ +	public function effectively_installed() +	{ +		return $this->db_tools->sql_table_exists($this->table_prefix . 'migrations'); +	} + +	public function update_schema() +	{ +		return array( +			'add_tables'		=> array( +				$this->table_prefix . 'migrations'	=> array( +					'COLUMNS'		=> array( +						'migration_name'			=> array('VCHAR', ''), +						'migration_depends_on'		=> array('TEXT', ''), +						'migration_schema_done'		=> array('BOOL', 0), +						'migration_data_done'		=> array('BOOL', 0), +						'migration_data_state'		=> array('TEXT', ''), +						'migration_start_time'		=> array('TIMESTAMP', 0), +						'migration_end_time'		=> array('TIMESTAMP', 0), +					), +					'PRIMARY_KEY'	=> 'migration_name', +				), +			), +		); +	} + +	public function revert_schema() +	{ +		return array( +			'drop_tables'		=> array( +				$this->table_prefix . 'migrations', +			), +		); +	} +} diff --git a/phpBB/phpbb/db/migration/schema_generator.php b/phpBB/phpbb/db/migration/schema_generator.php new file mode 100644 index 0000000000..a7e2fa8f06 --- /dev/null +++ b/phpBB/phpbb/db/migration/schema_generator.php @@ -0,0 +1,179 @@ +<?php +/** +* +* @package db +* @copyright (c) 2014 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +namespace phpbb\db\migration; + +/** +* The schema generator generates the schema based on the existing migrations +* +* @package db +*/ +class schema_generator +{ +	/** @var \phpbb\config\config */ +	protected $config; + +	/** @var \phpbb\db\driver\driver */ +	protected $db; + +	/** @var \phpbb\db\tools */ +	protected $db_tools; + +	/** @var array */ +	protected $class_names; + +	/** @var string */ +	protected $table_prefix; + +	/** @var string */ +	protected $phpbb_root_path; + +	/** @var string */ +	protected $php_ext; + +	/** @var array */ +	protected $tables; + +	/** +	* Constructor +	*/ +	public function __construct(array $class_names, \phpbb\config\config $config, \phpbb\db\driver\driver $db, \phpbb\db\tools $db_tools, $phpbb_root_path, $php_ext, $table_prefix) +	{ +		$this->config = $config; +		$this->db = $db; +		$this->db_tools = $db_tools; +		$this->class_names = $class_names; +		$this->phpbb_root_path = $phpbb_root_path; +		$this->php_ext = $php_ext; +		$this->table_prefix = $table_prefix; +	} + +	/** +	* Loads all migrations and their application state from the database. +	* +	* @return array +	*/ +	public function get_schema() +	{ +		if (!empty($this->tables)) +		{ +			return $this->tables; +		} + +		$migrations = $this->class_names; + +		$tree = array(); +		while (!empty($migrations)) +		{ +			foreach ($migrations as $migration_class) +			{ +				$open_dependencies = array_diff($migration_class::depends_on(), $tree); +				if (empty($open_dependencies)) +				{ +					$migration = new $migration_class($this->config, $this->db, $this->db_tools, $this->phpbb_root_path, $this->php_ext, $this->table_prefix); +					$tree[] = $migration_class; +					$migration_key = array_search($migration_class, $migrations); + +					foreach ($migration->update_schema() as $change_type => $data) +					{ +						if ($change_type === 'add_tables') +						{ +							foreach ($data as $table => $table_data) +							{ +								$this->tables[$table] = $table_data; +							} +						} +						else if ($change_type === 'drop_tables') +						{ +							foreach ($data as $table) +							{ +								unset($this->tables[$table]); +							} +						} +						else if ($change_type === 'add_columns') +						{ +							foreach ($data as $table => $add_columns) +							{ +								foreach ($add_columns as $column => $column_data) +								{ +									$this->tables[$table]['COLUMNS'][$column] = $column_data; +								} +							} +						} +						else if ($change_type === 'change_columns') +						{ +							foreach ($data as $table => $change_columns) +							{ +								foreach ($change_columns as $column => $column_data) +								{ +									$this->tables[$table]['COLUMNS'][$column] = $column_data; +								} +							} +						} +						else if ($change_type === 'drop_columns') +						{ +							foreach ($data as $table => $drop_columns) +							{ +								if (is_array($drop_columns)) +								{ +									foreach ($drop_columns as $column) +									{ +										unset($this->tables[$table]['COLUMNS'][$column]); +									} +								} +								else +								{ +									unset($this->tables[$table]['COLUMNS'][$drop_columns]); +								} +							} +						} +						else if ($change_type === 'add_unique_index') +						{ +							foreach ($data as $table => $add_index) +							{ +								foreach ($add_index as $key => $index_data) +								{ +									$this->tables[$table]['KEYS'][$key] = array('UNIQUE', $index_data); +								} +							} +						} +						else if ($change_type === 'add_index') +						{ +							foreach ($data as $table => $add_index) +							{ +								foreach ($add_index as $key => $index_data) +								{ +									$this->tables[$table]['KEYS'][$key] = array('INDEX', $index_data); +								} +							} +						} +						else if ($change_type === 'drop_keys') +						{ +							foreach ($data as $table => $drop_keys) +							{ +								foreach ($drop_keys as $key) +								{ +									unset($this->tables[$table]['KEYS'][$key]); +								} +							} +						} +						else +						{ +							var_dump($change_type); +						} +					} +					unset($migrations[$migration_key]); +				} +			} +		} + +		ksort($this->tables); +		return $this->tables; +	} +} diff --git a/phpBB/phpbb/db/tools.php b/phpBB/phpbb/db/tools.php index 3a7207e743..25c495b80b 100644 --- a/phpBB/phpbb/db/tools.php +++ b/phpBB/phpbb/db/tools.php @@ -467,9 +467,6 @@ class tools  		// Determine if we have created a PRIMARY KEY in the earliest  		$primary_key_gen = false; -		// Determine if the table must be created with TEXTIMAGE -		$create_textimage = false; -  		// Determine if the table requires a sequence  		$create_sequence = false; @@ -486,6 +483,15 @@ class tools  			break;  		} +		if ($this->sql_layer == 'mssql' || $this->sql_layer == 'mssqlnative') +		{ +			if (!isset($table_data['PRIMARY_KEY'])) +			{ +				$table_data['COLUMNS']['mssqlindex'] = array('UINT', null, 'auto_increment'); +				$table_data['PRIMARY_KEY'] = 'mssqlindex'; +			} +		} +  		// Iterate through the columns to create a table  		foreach ($table_data['COLUMNS'] as $column_name => $column_data)  		{ @@ -516,12 +522,6 @@ class tools  				$primary_key_gen = isset($prepared_column['primary_key_set']) && $prepared_column['primary_key_set'];  			} -			// create textimage DDL based off of the existance of certain column types -			if (!$create_textimage) -			{ -				$create_textimage = isset($prepared_column['textimage']) && $prepared_column['textimage']; -			} -  			// create sequence DDL based off of the existance of auto incrementing columns  			if (!$create_sequence && isset($prepared_column['auto_increment']) && $prepared_column['auto_increment'])  			{ @@ -536,13 +536,9 @@ class tools  		switch ($this->sql_layer)  		{  			case 'firebird': -				$table_sql .= "\n);"; -				$statements[] = $table_sql; -			break; -  			case 'mssql':  			case 'mssqlnative': -				$table_sql .= "\n) ON [PRIMARY]" . (($create_textimage) ? ' TEXTIMAGE_ON [PRIMARY]' : ''); +				$table_sql .= "\n);";  				$statements[] = $table_sql;  			break;  		} @@ -1850,22 +1846,49 @@ class tools  			case 'mssql':  			case 'mssqlnative': -				// remove default cosntraints first -				// http://msdn.microsoft.com/en-us/library/aa175912%28v=sql.80%29.aspx -				$statements[] = "DECLARE @drop_default_name VARCHAR(100), @cmd VARCHAR(1000) -					SET @drop_default_name = -						(SELECT so.name FROM sysobjects so -						JOIN sysconstraints sc ON so.id = sc.constid -						WHERE object_name(so.parent_obj) = '{$table_name}' -							AND so.xtype = 'D' -							AND sc.colid = (SELECT colid FROM syscolumns -								WHERE id = object_id('{$table_name}') -									AND name = '{$column_name}')) -					IF @drop_default_name <> '' -					BEGIN -						SET @cmd = 'ALTER TABLE [{$table_name}] DROP CONSTRAINT [' + @drop_default_name + ']' -						EXEC(@cmd) -					END"; +				$sql = "SELECT CAST(SERVERPROPERTY('productversion') AS VARCHAR(25)) AS mssql_version"; +				$result = $this->db->sql_query($sql); +				$row = $this->db->sql_fetchrow($result); +				$this->db->sql_freeresult($result); + +				// Remove default constraints +				if ($row['mssql_version'][0] == '8')	// SQL Server 2000 +				{ +					// http://msdn.microsoft.com/en-us/library/aa175912%28v=sql.80%29.aspx +					// Deprecated in SQL Server 2005 +					$statements[] = "DECLARE @drop_default_name VARCHAR(100), @cmd VARCHAR(1000) +						SET @drop_default_name = +							(SELECT so.name FROM sysobjects so +							JOIN sysconstraints sc ON so.id = sc.constid +							WHERE object_name(so.parent_obj) = '{$table_name}' +								AND so.xtype = 'D' +								AND sc.colid = (SELECT colid FROM syscolumns +									WHERE id = object_id('{$table_name}') +										AND name = '{$column_name}')) +						IF @drop_default_name <> '' +						BEGIN +							SET @cmd = 'ALTER TABLE [{$table_name}] DROP CONSTRAINT [' + @drop_default_name + ']' +							EXEC(@cmd) +						END"; +				} +				else +				{ +					$sql = "SELECT dobj.name AS def_name +					FROM sys.columns col  +						LEFT OUTER JOIN sys.objects dobj ON (dobj.object_id = col.default_object_id AND dobj.type = 'D') +					WHERE col.object_id = object_id('{$table_name}')  +					AND col.name = '{$column_name}' +					AND dobj.name IS NOT NULL"; +					$result = $this->db->sql_query($sql); +					$row = $this->db->sql_fetchrow($result); +					$this->db->sql_freeresult($result); + +					if ($row) +					{ +						$statements[] = 'ALTER TABLE [' . $table_name . '] DROP CONSTRAINT [' . $row['def_name'] . ']'; +					} +				} +  				$statements[] = 'ALTER TABLE [' . $table_name . '] DROP COLUMN [' . $column_name . ']';  			break; @@ -2069,7 +2092,7 @@ class tools  				$sql = "ALTER TABLE [{$table_name}] WITH NOCHECK ADD ";  				$sql .= "CONSTRAINT [PK_{$table_name}] PRIMARY KEY  CLUSTERED (";  				$sql .= '[' . implode("],\n\t\t[", $column) . ']'; -				$sql .= ') ON [PRIMARY]'; +				$sql .= ')';  				$statements[] = $sql;  			break; @@ -2167,7 +2190,7 @@ class tools  			case 'mssql':  			case 'mssqlnative': -				$statements[] = 'CREATE UNIQUE INDEX ' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ') ON [PRIMARY]'; +				$statements[] = 'CREATE UNIQUE INDEX [' . $index_name . '] ON [' . $table_name . ']([' . implode('], [', $column) . '])';  			break;  		} @@ -2220,7 +2243,7 @@ class tools  			case 'mssql':  			case 'mssqlnative': -				$statements[] = 'CREATE INDEX ' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ') ON [PRIMARY]'; +				$statements[] = 'CREATE INDEX [' . $index_name . '] ON [' . $table_name . ']([' . implode('], [', $column) . '])';  			break;  		} @@ -2352,23 +2375,48 @@ class tools  				if (!empty($column_data['default']))  				{ +					$sql = "SELECT CAST(SERVERPROPERTY('productversion') AS VARCHAR(25)) AS mssql_version"; +					$result = $this->db->sql_query($sql); +					$row = $this->db->sql_fetchrow($result); +					$this->db->sql_freeresult($result); +  					// Using TRANSACT-SQL for this statement because we do not want to have colliding data if statements are executed at a later stage -					$statements[] = "DECLARE @drop_default_name VARCHAR(100), @cmd VARCHAR(1000) -						SET @drop_default_name = -							(SELECT so.name FROM sysobjects so -							JOIN sysconstraints sc ON so.id = sc.constid -							WHERE object_name(so.parent_obj) = '{$table_name}' -								AND so.xtype = 'D' -								AND sc.colid = (SELECT colid FROM syscolumns -									WHERE id = object_id('{$table_name}') -										AND name = '{$column_name}')) -						IF @drop_default_name <> '' -						BEGIN -							SET @cmd = 'ALTER TABLE [{$table_name}] DROP CONSTRAINT [' + @drop_default_name + ']' -							EXEC(@cmd) -						END -						SET @cmd = 'ALTER TABLE [{$table_name}] ADD CONSTRAINT [DF_{$table_name}_{$column_name}_1] {$column_data['default']} FOR [{$column_name}]' -						EXEC(@cmd)"; +					if ($row['mssql_version'][0] == '8')	// SQL Server 2000 +					{ +						$statements[] = "DECLARE @drop_default_name VARCHAR(100), @cmd VARCHAR(1000) +							SET @drop_default_name = +								(SELECT so.name FROM sysobjects so +								JOIN sysconstraints sc ON so.id = sc.constid +								WHERE object_name(so.parent_obj) = '{$table_name}' +									AND so.xtype = 'D' +									AND sc.colid = (SELECT colid FROM syscolumns +										WHERE id = object_id('{$table_name}') +											AND name = '{$column_name}')) +							IF @drop_default_name <> '' +							BEGIN +								SET @cmd = 'ALTER TABLE [{$table_name}] DROP CONSTRAINT [' + @drop_default_name + ']' +								EXEC(@cmd) +							END +							SET @cmd = 'ALTER TABLE [{$table_name}] ADD CONSTRAINT [DF_{$table_name}_{$column_name}_1] {$column_data['default']} FOR [{$column_name}]' +							EXEC(@cmd)"; +					} +					else +					{ +						$statements[] = "DECLARE @drop_default_name VARCHAR(100), @cmd VARCHAR(1000) +							SET @drop_default_name = +								(SELECT dobj.name FROM sys.columns col  +									LEFT OUTER JOIN sys.objects dobj ON (dobj.object_id = col.default_object_id AND dobj.type = 'D') +								WHERE col.object_id = object_id('{$table_name}')  +								AND col.name = '{$column_name}' +								AND dobj.name IS NOT NULL) +							IF @drop_default_name <> '' +							BEGIN +								SET @cmd = 'ALTER TABLE [{$table_name}] DROP CONSTRAINT [' + @drop_default_name + ']' +								EXEC(@cmd) +							END +							SET @cmd = 'ALTER TABLE [{$table_name}] ADD CONSTRAINT [DF_{$table_name}_{$column_name}_1] {$column_data['default']} FOR [{$column_name}]' +							EXEC(@cmd)"; +					}  				}  			break; diff --git a/phpBB/phpbb/extension/metadata_manager.php b/phpBB/phpbb/extension/metadata_manager.php index 66cdb86513..c90445ee09 100644 --- a/phpBB/phpbb/extension/metadata_manager.php +++ b/phpBB/phpbb/extension/metadata_manager.php @@ -196,7 +196,7 @@ class metadata_manager  		$fields = array(  			'name'		=> '#^[a-zA-Z0-9_\x7f-\xff]{2,}/[a-zA-Z0-9_\x7f-\xff]{2,}$#',  			'type'		=> '#^phpbb-extension$#', -			'licence'	=> '#.+#', +			'license'	=> '#.+#',  			'version'	=> '#.+#',  		); @@ -351,7 +351,7 @@ class metadata_manager  			'META_HOMEPAGE'		=> (isset($this->metadata['homepage'])) ? $this->metadata['homepage'] : '',  			'META_VERSION'		=> (isset($this->metadata['version'])) ? htmlspecialchars($this->metadata['version']) : '',  			'META_TIME'			=> (isset($this->metadata['time'])) ? htmlspecialchars($this->metadata['time']) : '', -			'META_LICENCE'		=> htmlspecialchars($this->metadata['licence']), +			'META_LICENSE'		=> htmlspecialchars($this->metadata['license']),  			'META_REQUIRE_PHP'		=> (isset($this->metadata['require']['php'])) ? htmlspecialchars($this->metadata['require']['php']) : '',  			'META_REQUIRE_PHP_FAIL'	=> !$this->validate_require_php(), diff --git a/phpBB/phpbb/notification/type/bookmark.php b/phpBB/phpbb/notification/type/bookmark.php index 5e6fdd2523..003998677d 100644 --- a/phpBB/phpbb/notification/type/bookmark.php +++ b/phpBB/phpbb/notification/type/bookmark.php @@ -75,7 +75,7 @@ class bookmark extends \phpbb\notification\type\post  		$result = $this->db->sql_query($sql);  		while ($row = $this->db->sql_fetchrow($result))  		{ -			$users[] = $row['user_id']; +			$users[] = (int) $row['user_id'];  		}  		$this->db->sql_freeresult($result); diff --git a/phpBB/phpbb/notification/type/post.php b/phpBB/phpbb/notification/type/post.php index bc42c4422b..f973becc3b 100644 --- a/phpBB/phpbb/notification/type/post.php +++ b/phpBB/phpbb/notification/type/post.php @@ -103,7 +103,7 @@ class post extends \phpbb\notification\type\base  		$result = $this->db->sql_query($sql);  		while ($row = $this->db->sql_fetchrow($result))  		{ -			$users[] = $row['user_id']; +			$users[] = (int) $row['user_id'];  		}  		$this->db->sql_freeresult($result); @@ -115,7 +115,7 @@ class post extends \phpbb\notification\type\base  		$result = $this->db->sql_query($sql);  		while ($row = $this->db->sql_fetchrow($result))  		{ -			$users[] = $row['user_id']; +			$users[] = (int) $row['user_id'];  		}  		$this->db->sql_freeresult($result); @@ -205,18 +205,17 @@ class post extends \phpbb\notification\type\base  				$usernames[] = $this->user_loader->get_username($responder['poster_id'], 'no_profile');  			}  		} -		$lang_key = $this->language_key;  		if ($trimmed_responders_cnt)  		{ -			$lang_key .= '_TRIMMED'; +			$usernames[] = $this->user->lang('NOTIFICATION_X_OTHERS', $trimmed_responders_cnt);  		}  		return $this->user->lang( -			$lang_key, -			implode($this->user->lang['COMMA_SEPARATOR'], $usernames), +			$this->language_key, +			phpbb_generate_string_list($usernames, $this->user),  			censor_text($this->get_data('topic_title')), -			$trimmed_responders_cnt +			$responders_cnt  		);  	} diff --git a/phpBB/phpbb/notification/type/quote.php b/phpBB/phpbb/notification/type/quote.php index e8527261d8..745430e114 100644 --- a/phpBB/phpbb/notification/type/quote.php +++ b/phpBB/phpbb/notification/type/quote.php @@ -94,7 +94,7 @@ class quote extends \phpbb\notification\type\post  		$result = $this->db->sql_query($sql);  		while ($row = $this->db->sql_fetchrow($result))  		{ -			$users[] = $row['user_id']; +			$users[] = (int) $row['user_id'];  		}  		$this->db->sql_freeresult($result); diff --git a/phpBB/phpbb/notification/type/topic.php b/phpBB/phpbb/notification/type/topic.php index 98f086a50b..635d05bccd 100644 --- a/phpBB/phpbb/notification/type/topic.php +++ b/phpBB/phpbb/notification/type/topic.php @@ -103,7 +103,7 @@ class topic extends \phpbb\notification\type\base  		$result = $this->db->sql_query($sql);  		while ($row = $this->db->sql_fetchrow($result))  		{ -			$users[] = $row['user_id']; +			$users[] = (int) $row['user_id'];  		}  		$this->db->sql_freeresult($result);  | 
