[Customisation Database Commits] r211 - in /trunk/titania: includes/constants.php includes/functions.php includes/objects/attachments.php includes/objects/download.php includes/tools/diff.php install/index.php

Nathan Guse exreaction at phpbb.com
Fri Jun 12 01:19:18 UTC 2009


Author: exreaction
Date: Fri Jun 12 01:19:17 2009
New Revision: 211

Log:
Downloads -> Attachments

Added:
    trunk/titania/includes/objects/attachments.php
Removed:
    trunk/titania/includes/objects/download.php
Modified:
    trunk/titania/includes/constants.php
    trunk/titania/includes/functions.php
    trunk/titania/includes/tools/diff.php
    trunk/titania/install/index.php

Modified: trunk/titania/includes/constants.php
==============================================================================
*** trunk/titania/includes/constants.php (original)
--- trunk/titania/includes/constants.php Fri Jun 12 01:19:17 2009
***************
*** 24,34 ****
  
  // Table names
  $table_prefix = titania::$config->table_prefix;
  define('TITANIA_AUTHORS_TABLE',				$table_prefix . 'authors');
  define('TITANIA_CONTRIBS_TABLE',			$table_prefix . 'contribs');
  define('TITANIA_CONTRIB_TAGS_TABLE',		$table_prefix . 'contrib_tags');
  define('TITANIA_CONTRIB_COAUTHORS_TABLE',	$table_prefix . 'contrib_coauthors');
- define('TITANIA_DOWNLOADS_TABLE',			$table_prefix . 'downloads');
  define('TITANIA_QUEUE_TABLE',				$table_prefix . 'queue');
  define('TITANIA_QUEUE_HISTORY_TABLE',		$table_prefix . 'queue_history');
  define('TITANIA_REVISIONS_TABLE',			$table_prefix . 'revisions');
--- 24,34 ----
  
  // Table names
  $table_prefix = titania::$config->table_prefix;
+ define('TITANIA_ATTACHMENTS_TABLE',			$table_prefix . 'attachments');
  define('TITANIA_AUTHORS_TABLE',				$table_prefix . 'authors');
  define('TITANIA_CONTRIBS_TABLE',			$table_prefix . 'contribs');
  define('TITANIA_CONTRIB_TAGS_TABLE',		$table_prefix . 'contrib_tags');
  define('TITANIA_CONTRIB_COAUTHORS_TABLE',	$table_prefix . 'contrib_coauthors');
  define('TITANIA_QUEUE_TABLE',				$table_prefix . 'queue');
  define('TITANIA_QUEUE_HISTORY_TABLE',		$table_prefix . 'queue_history');
  define('TITANIA_REVISIONS_TABLE',			$table_prefix . 'revisions');

Modified: trunk/titania/includes/functions.php
==============================================================================
*** trunk/titania/includes/functions.php (original)
--- trunk/titania/includes/functions.php Fri Jun 12 01:19:17 2009
***************
*** 42,46 ****
  	$query = preg_replace('#LIMIT ([0-9]+)(, ([0-9]+))?#', '', $query);
  
  	phpbb::$db->sql_query($query);
! 	return (int) phpbb::$db->sql_fetchfield('cnt');
  }
\ No newline at end of file
--- 42,49 ----
  	$query = preg_replace('#LIMIT ([0-9]+)(, ([0-9]+))?#', '', $query);
  
  	phpbb::$db->sql_query($query);
! 	$cnt = (int) phpbb::$db->sql_fetchfield('cnt');
! 	phpbb::$db->sql_freeresult();
! 
! 	return $cnt;
  }
\ No newline at end of file

Added: trunk/titania/includes/objects/attachments.php
==============================================================================
*** trunk/titania/includes/objects/attachments.php (added)
--- trunk/titania/includes/objects/attachments.php Fri Jun 12 01:19:17 2009
***************
*** 0 ****
--- 1,316 ----
+ <?php
+ /**
+ *
+ * @package Titania
+ * @version $Id$
+ * @copyright (c) 2008 phpBB Customisation Database Team
+ * @license http://opensource.org/licenses/gpl-license.php GNU Public License
+ *
+ */
+ 
+ /**
+ * @ignore
+ */
+ if (!defined('IN_TITANIA'))
+ {
+ 	exit;
+ }
+ 
+ if (!class_exists('titania_database_object'))
+ {
+ 	require TITANIA_ROOT . 'includes/core/object_database.' . PHP_EXT;
+ }
+ 
+ /**
+ * Class to abstract titania downloads.
+ * @package Titania
+ */
+ class titania_attachments extends titania_database_object
+ {
+ 	/**
+ 	 * SQL Table
+ 	 *
+ 	 * @var string
+ 	 */
+ 	protected $sql_table		= TITANIA_ATTACHMENTS_TABLE;
+ 
+ 	/**
+ 	 * SQL identifier field
+ 	 *
+ 	 * @var string
+ 	 */
+ 	protected $sql_id_field		= 'attachment_id';
+ 
+ 	/**
+ 	 * Constructor for download class
+ 	 *
+ 	 * @param unknown_type $download_id
+ 	 */
+ 	public function __construct($type, $object_id = false)
+ 	{
+ 		// Configure object properties
+ 		$this->object_config = array_merge($this->object_config, array(
+ 			'attachment_id'			=> array('default' => 0),
+ 			'attachment_type'		=> array('default' => 0),
+ 			'object_id'				=> array('default' => 0),
+ 
+ 			'attachment_status'		=> array('default' => 0),
+ 			'physical_filename'		=> array('default' => '',	'max' => 255),
+ 			'real_filename'			=> array('default' => '',	'max' => 255),
+ 
+ 			'download_count'		=> array('default' => 0),
+ 
+ 			'filesize'				=> array('default' => 0),
+ 			'filetime'				=> array('default' => 0),
+ 			'extension'				=> array('default' => '',	'max' => 100),
+ 			'mimetype'				=> array('default' => '',	'max' => 100),
+ 			'hash'					=> array('default' => '',	'max' => 32,	'multibyte' => false,	'readonly' => true),
+ 
+ 			'thumbnail'				=> array('default' => 0),
+ 		));
+ 
+ 		if ($object_id === false)
+ 		{
+ 			$this->filetime = titania::$time;
+ 		}
+ 		else
+ 		{
+ 			$this->object_id = $object_id;
+ 			$this->load_object($type, $object_id);
+ 		}
+ 	}
+ 
+ 	/**
+ 	 * Allows to load data identified by object_id
+ 	 *
+ 	 * @param int $download_type The type of download (check TITANIA_DOWNLOAD_ constants)
+ 	 * @param int $object_id The id of the item to download
+ 	 *
+ 	 * @return void
+ 	 */
+ 	public function load_object($download_type, $object_id)
+ 	{
+ 		$this->sql_id_field = 'object_id';
+ 
+ 		parent::load();
+ 
+ 		$this->sql_id_field = 'attachment_id';
+ 	}
+ 
+ 	/**
+ 	 * Gets the latest download data of a contribution
+ 	 *
+ 	 * @param int $contrib_id	The contrib_id of the contribution
+ 	 * @param bool $validated	Latest (false) or latest validated version (true)
+ 	 *
+ 	 * @return void
+ 	 */
+ 	public function load_contrib($contrib_id, $validated = true)
+ 	{
+ 		$sql = 'SELECT attachment_id
+ 			FROM ' . TITANIA_REVISIONS_TABLE . '
+ 			WHERE contrib_id = ' . $contrib_id .
+ 				(($validated) ? ' AND contrib_validated = 1' : '');
+ 		phpbb::$db->sql_query($sql);
+ 		$attachment_id = (int) phpbb::$db->sql_fetchfield($column);
+ 		phpbb::$db->sql_freeresult();
+ 
+ 		if ($attachment_id)
+ 		{
+ 			$this->attachment_id = $attachment_id;
+ 		}
+ 
+ 		parent::load();
+ 	}
+ 
+ 	/**
+ 	* Create a new download/upload
+ 	*
+ 	* @return void
+ 	*/
+ 	public function create()
+ 	{
+ 		// @todo
+ 	}
+ 
+ 	/**
+ 	* Checks if the user is authorized to download this file.
+ 	*
+ 	* @return void
+ 	*/
+ 	public function check_access()
+ 	{
+ 		// @todo
+ 		return;
+ 
+ 		throw new DownloadAccessDeniedException();
+ 	}
+ 
+ 	/**
+ 	* Triggers a 'download not found' message.
+ 	*
+ 	* @return void
+ 	*/
+ 	public function trigger_not_found()
+ 	{
+ 		header('HTTP/1.0 404 not found');
+ 
+ 		trigger_error('DOWNLOAD_NOT_FOUND');
+ 	}
+ 
+ 	/**
+ 	* Triggers a 'access denied' message.
+ 	*
+ 	* @return void
+ 	*/
+ 	public function trigger_forbidden()
+ 	{
+ 		header('HTTP/1.0 403 Forbidden');
+ 
+ 		trigger_error('DOWNLOAD_ACCESS_DENIED');
+ 	}
+ 
+ 	/**
+ 	* Stream the download to the browser
+ 	*
+ 	* @return void
+ 	*/
+ 	public function stream()
+ 	{
+ 		if (headers_sent())
+ 		{
+ 			trigger_error('UNABLE_TO_DELIVER_FILE');
+ 		}
+ 
+ 		// Lets try to keep the lid on the jar - Kellanved
+ 		if (isset($_SERVER['CONTENT_TYPE']))
+ 		{
+ 			if ($_SERVER['CONTENT_TYPE'] === 'application/x-java-archive')
+ 			{
+ 				exit;
+ 			}
+ 		}
+ 		else if (isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'Java') !== false)
+ 		{
+ 			exit;
+ 		}
+ 
+ 		$file = TITANIA_ROOT . 'files/' . $this->physical_filename;
+ 
+ 		if (!@file_exists($file) || !@is_readable($file))
+ 		{
+ 			throw new FileNotFoundException();
+ 		}
+ 
+ 		if (!phpbb::$user->data['is_bot'])
+ 		{
+ 			$this->increase_counter();
+ 		}
+ 
+ 		header('Pragma: public');
+ 		header('Content-Type: application/octet-stream');
+ 
+ 		$size = ($this->filesize) ? $this->filesize : @filesize($file);
+ 		if ($size)
+ 		{
+ 			header('Content-Length: ' . $size);
+ 		}
+ 
+ 		header('Content-Disposition: attachment; ' . $this->header_filename(htmlspecialchars_decode($this->real_filename)));
+ 
+ 		// Try to deliver in chunks
+ 		@set_time_limit(0);
+ 
+ 		$fp = @fopen($file, 'rb');
+ 
+ 		if ($fp !== false)
+ 		{
+ 			while (!feof($fp))
+ 			{
+ 				echo fread($fp, 8192);
+ 			}
+ 			fclose($fp);
+ 		}
+ 		else
+ 		{
+ 			@readfile($file);
+ 		}
+ 
+ 		flush();
+ 
+ 		exit;
+ 	}
+ 
+ 	/**
+ 	* Get a browser friendly UTF-8 encoded filename
+ 	*
+ 	* @param string $file
+ 	*
+ 	* @return string
+ 	*/
+ 	private function header_filename($file)
+ 	{
+ 		$user_agent = (!empty($_SERVER['HTTP_USER_AGENT'])) ? htmlspecialchars((string) $_SERVER['HTTP_USER_AGENT']) : '';
+ 
+ 		// There be dragons here.
+ 		// Not many follows the RFC...
+ 		if (strpos($user_agent, 'MSIE') !== false || strpos($user_agent, 'Safari') !== false || strpos($user_agent, 'Konqueror') !== false)
+ 		{
+ 			return 'filename=' . rawurlencode($file);
+ 		}
+ 
+ 		// Follow the RFC for extended filename for the rest
+ 		return "filename*=UTF-8''" . rawurlencode($file);
+ 	}
+ 
+ 	/**
+ 	* Immediately increases the download counter of this download
+ 	*
+ 	* @return void
+ 	*/
+ 	private function increase_counter()
+ 	{
+ 		$sql = 'UPDATE ' . $this->sql_table . '
+ 			SET download_count = download_count + 1
+ 			WHERE attachment_id = ' . $this->attachment_id;
+ 		phpbb::$db->sql_query($sql);
+ 
+ 		$this->download_count = $this->download_count + 1;
+ 	}
+ }
+ 
+ /**
+ * Exception thrown when a user is not allowed to access a download.
+ *
+ * @package Titania
+ */
+ class DownloadAccessDeniedException extends Exception
+ {
+ 	function __construct($message = '', $code = 0)
+ 	{
+ 		if (empty($message))
+ 		{
+ 			$name = 'Access denied.';
+ 		}
+ 
+ 		parent::__construct($message, $code);
+ 	}
+ }
+ 
+ /**
+ * Exception thrown when a download file is not found or is not accessible.
+ *
+ * @package Titania
+ */
+ class FileNotFoundException
+ {
+ 	function __construct($message = '', $code = 0)
+ 	{
+ 		if (empty($message))
+ 		{
+ 			$message = 'File not found or not accessible.';
+ 		}
+ 
+ 		parent::__construct($message, $code);
+ 	}
+ }
\ No newline at end of file

Removed: trunk/titania/includes/objects/download.php
==============================================================================
*** trunk/titania/includes/objects/download.php (original)
--- trunk/titania/includes/objects/download.php (removed)
***************
*** 1,325 ****
- <?php
- /**
- *
- * @package Titania
- * @version $Id$
- * @copyright (c) 2008 phpBB Customisation Database Team
- * @license http://opensource.org/licenses/gpl-license.php GNU Public License
- *
- */
- 
- /**
- * @ignore
- */
- if (!defined('IN_TITANIA'))
- {
- 	exit;
- }
- 
- if (!class_exists('titania_database_object'))
- {
- 	require TITANIA_ROOT . 'includes/core/object_database.' . PHP_EXT;
- }
- 
- /**
- * Class to abstract titania downloads.
- * @package Titania
- */
- class titania_download extends titania_database_object
- {
- 	/**
- 	 * SQL Table
- 	 *
- 	 * @var string
- 	 */
- 	protected $sql_table		= TITANIA_DOWNLOADS_TABLE;
- 
- 	/**
- 	 * SQL identifier field
- 	 *
- 	 * @var string
- 	 */
- 	protected $sql_id_field		= 'download_id';
- 
- 	/**
- 	 * Constructor for download class
- 	 *
- 	 * @param unknown_type $download_id
- 	 */
- 	public function __construct($download_id = false)
- 	{
- 		// Configure object properties
- 		$this->object_config = array_merge($this->object_config, array(
- 			'download_id'			=> array('default' => 0),
- 			'object_id'				=> array('default' => 0),
- 
- 			'download_type'			=> array('default' => 0),
- 			'download_status'		=> array('default' => 0),
- 
- 			'filesize'				=> array('default' => 0),
- 			'filetime'				=> array('default' => 0),
- 
- 			'physical_filename'		=> array('default' => '',	'max' => 255),
- 			'real_filename'			=> array('default' => '',	'max' => 255),
- 
- 			'download_count'		=> array('default' => 0),
- 
- 			'extension'				=> array('default' => '',	'max' => 100),
- 			'mimetype'				=> array('default' => '',	'max' => 100),
- 
- 			'download_url'			=> array('default' => '',	'max' => 255,	'multibyte' => false),
- 			'download_hash'			=> array('default' => '',	'max' => 32,	'multibyte' => false,	'readonly' => true),
- 
- 			'thumbnail'				=> array('default' => 0),
- 		));
- 
- 		if ($download_id === false)
- 		{
- 			$this->filetime = titania::$time;
- 		}
- 		else
- 		{
- 			$this->download_id = $download_id;
- 		}
- 	}
- 
- 	/**
- 	 * Allows to load data identified by object_id
- 	 *
- 	 * @param int $download_type The type of download (check TITANIA_DOWNLOAD_ constants)
- 	 * @param int $object_id The id of the item to download
- 	 *
- 	 * @return void
- 	 */
- 	public function load($download_type, $object_id)
- 	{
- 		if ($revision_id === false)
- 		{
- 			parent::load();
- 		}
- 		else
- 		{
- 			$identifier = $this->sql_id_field;
- 
- 			$this->sql_id_field = 'object_id';
- 			$this->object_id = $object_id;
- 
- 			parent::load();
- 
- 			$this->sql_id_field = $object_id;
- 		}
- 	}
- 
- 	/**
- 	 * Gets the latest download data of a contribution
- 	 *
- 	 * @param int $contrib_id	The contrib_id of the contribution
- 	 * @param bool $validated	Latest (false) or latest validated version (true)
- 	 *
- 	 * @return void
- 	 */
- 	public function load_contrib($contrib_id, $validated = true)
- 	{
- 		$column = ($validated) ? 'contrib_validated_revision' : 'contrib_revision';
- 
- 		$sql = 'SELECT ' . $column . '
- 			FROM ' . TITANIA_CONTRIBS_TABLE . '
- 			WHERE contrib_id = ' . $contrib_id;
- 		$result = phpbb::$db->sql_query($sql);
- 		$revision_id = (int) phpbb::$db->sql_fetchfield($column);
- 		phpbb::$db->sql_freeresult($result);
- 
- 		$this->load(TITANIA_DOWNLOAD_CONTRIB, $revision_id);
- 	}
- 
- 	/**
- 	* Create a new download/upload
- 	*
- 	* @return void
- 	*/
- 	public function create()
- 	{
- 		// @todo
- 	}
- 
- 	/**
- 	* Checks if the user is authorized to download this file.
- 	*
- 	* @return void
- 	*/
- 	public function check_access()
- 	{
- 		// @todo
- 		return;
- 
- 		throw new DownloadAccessDeniedException();
- 	}
- 
- 	/**
- 	* Triggers a 'download not found' message.
- 	*
- 	* @return void
- 	*/
- 	public function trigger_not_found()
- 	{
- 		header('HTTP/1.0 404 not found');
- 
- 		trigger_error('DOWNLOAD_NOT_FOUND');
- 	}
- 
- 	/**
- 	* Triggers a 'access denied' message.
- 	*
- 	* @return void
- 	*/
- 	public function trigger_forbidden()
- 	{
- 		header('HTTP/1.0 403 Forbidden');
- 
- 		trigger_error('DOWNLOAD_ACCESS_DENIED');
- 	}
- 
- 	/**
- 	* Stream the download to the browser
- 	*
- 	* @return void
- 	*/
- 	public function stream()
- 	{
- 		if (headers_sent())
- 		{
- 			trigger_error('UNABLE_TO_DELIVER_FILE');
- 		}
- 
- 		// Lets try to keep the lid on the jar - Kellanved
- 		if (isset($_SERVER['CONTENT_TYPE']))
- 		{
- 			if ($_SERVER['CONTENT_TYPE'] === 'application/x-java-archive')
- 			{
- 				exit;
- 			}
- 		}
- 		else if (isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'Java') !== false)
- 		{
- 			exit;
- 		}
- 
- 		$file = TITANIA_ROOT . 'files/' . $this->physical_filename;
- 
- 		if (!@file_exists($file) || !@is_readable($file))
- 		{
- 			throw new FileNotFoundException();
- 		}
- 
- 		if (!phpbb::$user->data['is_bot'])
- 		{
- 			$this->increase_counter();
- 		}
- 
- 		header('Pragma: public');
- 		header('Content-Type: application/octet-stream');
- 
- 		$size = ($this->filesize) ? $this->filesize : @filesize($file);
- 		if ($size)
- 		{
- 			header('Content-Length: ' . $size);
- 		}
- 
- 		header('Content-Disposition: attachment; ' . $this->header_filename(htmlspecialchars_decode($this->real_filename)));
- 
- 		// Try to deliver in chunks
- 		@set_time_limit(0);
- 
- 		$fp = @fopen($file, 'rb');
- 
- 		if ($fp !== false)
- 		{
- 			while (!feof($fp))
- 			{
- 				echo fread($fp, 8192);
- 			}
- 			fclose($fp);
- 		}
- 		else
- 		{
- 			@readfile($file);
- 		}
- 
- 		flush();
- 
- 		exit;
- 	}
- 
- 	/**
- 	* Get a browser friendly UTF-8 encoded filename
- 	*
- 	* @param string $file
- 	*
- 	* @return string
- 	*/
- 	private function header_filename($file)
- 	{
- 		$user_agent = (!empty($_SERVER['HTTP_USER_AGENT'])) ? htmlspecialchars((string) $_SERVER['HTTP_USER_AGENT']) : '';
- 
- 		// There be dragons here.
- 		// Not many follows the RFC...
- 		if (strpos($user_agent, 'MSIE') !== false || strpos($user_agent, 'Safari') !== false || strpos($user_agent, 'Konqueror') !== false)
- 		{
- 			return 'filename=' . rawurlencode($file);
- 		}
- 
- 		// Follow the RFC for extended filename for the rest
- 		return "filename*=UTF-8''" . rawurlencode($file);
- 	}
- 
- 	/**
- 	* Immediately increases the download counter of this download
- 	*
- 	* @return void
- 	*/
- 	private function increase_counter()
- 	{
- 		$sql = 'UPDATE ' . $this->sql_table . '
- 			SET download_count = download_count + 1
- 			WHERE download_id = ' . $this->download_id;
- 		phpbb::$db->sql_query($sql);
- 
- 		$this->download_count = $this->download_count + 1;
- 	}
- }
- 
- /**
- * Exception thrown when a user is not allowed to access a download.
- *
- * @package Titania
- */
- class DownloadAccessDeniedException extends Exception
- {
- 	function __construct($message = '', $code = 0)
- 	{
- 		if (empty($message))
- 		{
- 			$name = 'Access denied.';
- 		}
- 
- 		parent::__construct($message, $code);
- 	}
- }
- 
- /**
- * Exception thrown when a download file is not found or is not accessible.
- *
- * @package Titania
- */
- class FileNotFoundException
- {
- 	function __construct($message = '', $code = 0)
- 	{
- 		if (empty($message))
- 		{
- 			$message = 'File not found or not accessible.';
- 		}
- 
- 		parent::__construct($message, $code);
- 	}
- }
\ No newline at end of file
--- 0 ----

Modified: trunk/titania/includes/tools/diff.php
==============================================================================
*** trunk/titania/includes/tools/diff.php (original)
--- trunk/titania/includes/tools/diff.php Fri Jun 12 01:19:17 2009
***************
*** 182,192 ****
  	public function from_revision($rev_old, $rev_new)
  	{
  		// get filenames
! 		$sql = 'SELECT d.physical_filename
! 			FROM ' . TITANIA_DOWNLOADS_TABLE . ' d
  			JOIN ' . TITANIA_REVISIONS_TABLE . ' r
! 				ON d.revision_id = r.revision_id
! 			WHERE ' . phpbb::$db->sql_in_set('d.revision_id', array($rev_old, $rev_new)) . '
  			ORDER BY r.revision_time ASC';
  		$result = phpbb::$db->sql_query($sql);
  		$filename_old = phpbb::$db->sql_fetchfield('physical_filename');
--- 182,192 ----
  	public function from_revision($rev_old, $rev_new)
  	{
  		// get filenames
! 		$sql = 'SELECT a.physical_filename
! 			FROM ' . TITANIA_ATTACHMENTS_TABLE . ' a
  			JOIN ' . TITANIA_REVISIONS_TABLE . ' r
! 				ON a.attachment_id = r.attachment_id
! 			WHERE ' . phpbb::$db->sql_in_set('r.revision_id', array($rev_old, $rev_new)) . '
  			ORDER BY r.revision_time ASC';
  		$result = phpbb::$db->sql_query($sql);
  		$filename_old = phpbb::$db->sql_fetchfield('physical_filename');

Modified: trunk/titania/install/index.php
==============================================================================
*** trunk/titania/install/index.php (original)
--- trunk/titania/install/index.php Fri Jun 12 01:19:17 2009
***************
*** 31,36 ****
--- 31,59 ----
  $versions = array(
  	'0.1.0'	=> array(
  		'table_add' => array(
+ 			array('customisation_attachments', array(
+ 				'COLUMNS'		=> array(
+ 					'attachment_id'			=> array('UINT', NULL, 'auto_increment'),
+ 					'attachment_type'		=> array('TINT:1', 0),
+ 					'object_id'				=> array('UINT', 0),
+ 					'attachment_status'		=> array('TINT:1', 0),
+ 					'physical_filename'		=> array('VCHAR', ''),
+ 					'real_filename'			=> array('VCHAR', ''),
+ 					'download_count'		=> array('UINT', 0),
+ 					'filesize'				=> array('INT:11', 0),
+ 					'filetime'				=> array('INT:11', 0),
+ 					'extension'				=> array('VCHAR:100', ''),
+ 					'mimetype'				=> array('VCHAR:100', ''),
+ 					'hash'					=> array('VCHAR:32', ''),
+ 					'thumbnail'				=> array('BOOL', 0),
+ 				),
+ 				'PRIMARY_KEY'	=> 'attachment_id',
+ 				'KEYS'			=> array(
+ 					'attachment_type'		=> array('INDEX', 'attachment_type'),
+ 					'object_id'				=> array('INDEX', 'object_id'),
+ 					'attachment_status'		=> array('INDEX', 'attachment_status'),
+ 				),
+ 			)),
  			array('customisation_authors', array(
  				'COLUMNS'		=> array(
  					'author_id'				=> array('UINT', NULL, 'auto_increment'),
***************
*** 108,137 ****
  				),
  				'PRIMARY_KEY'	=> array('contrib_id', 'author_id'),
  			)),
- 			array('customisation_downloads', array(
- 				'COLUMNS'		=> array(
- 					'download_id'			=> array('UINT', NULL, 'auto_increment'),
- 					'download_type'			=> array('TINT:1', 0),
- 					'object_id'				=> array('UINT', 0),
- 					'download_status'		=> array('TINT:1', 0),
- 					'filesize'				=> array('INT:11', 0),
- 					'filetime'				=> array('INT:11', 0),
- 					'physical_filename'		=> array('VCHAR', ''),
- 					'real_filename'			=> array('VCHAR', ''),
- 					'download_count'		=> array('UINT', 0),
- 					'extension'				=> array('VCHAR:100', ''),
- 					'mimetype'				=> array('VCHAR:100', ''),
- 					'download_hash'			=> array('VCHAR:32', ''),
- 					'download_url'			=> array('VCHAR:255', ''), // What is this for?
- 					'thumbnail'				=> array('BOOL', 0),
- 				),
- 				'PRIMARY_KEY'	=> 'download_id',
- 				'KEYS'			=> array(
- 					'download_type'		=> array('INDEX', 'download_type'),
- 					'object_id'			=> array('INDEX', 'object_id'),
- 					'download_status'	=> array('INDEX', 'download_status'),
- 				),
- 			)),
  			array('customisation_contrib_faq', array(
  				'COLUMNS'		=> array(
  					'faq_id'				=> array('UINT', NULL, 'auto_increment'),
--- 131,136 ----
***************
*** 202,213 ****
--- 201,215 ----
  				'COLUMNS'		=> array(
  					'revision_id'			=> array('UINT', NULL, 'auto_increment'),
  					'contrib_id'			=> array('UINT', 0),
+ 					'contrib_validated'		=> array('BOOL', 0),
+ 					'attachment_id'			=> array('UINT', 0),
  					'revision_name'			=> array('STEXT_UNI', '', 'true_sort'),
  					'revision_time'			=> array('UINT:11', 0),
  				),
  				'PRIMARY_KEY'	=> 'revision_id',
  				'KEYS'			=> array(
  					'contrib_id'			=> array('INDEX', 'contrib_id'),
+ 					'contrib_validated'		=> array('INDEX', 'contrib_validated'),
  				),
  			)),
  			array('customisation_tag_fields', array(




More information about the customisationdb-commits mailing list