<?php
class TotalResourceDownloads_Installer_Installer
{
protected static $table = array(
'createQuery' => 'CREATE TABLE IF NOT EXISTS `xf_total_resource_downloads` (
SELECT sum( res.download_count ) AS totaldownloads
FROM `xf_resource` AS res
WHERE user_id =1
)
ENGINE = InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci;',
'dropQuery' => 'DROP TABLE IF EXISTS `xf_total_resource_downloads`'
);
/**
* This is the function to create a table in the database so our addon will work.
*
* @since Version 1.0.0
* @version 1.0.0
* @ Matthew Hawley
*/
public static function install()
{
$db = XenForo_Application::get('db');
$db->query(self::$table['createQuery']);
}
/**
* This is the function to DELETE the table of our addon in the database.
*
* @since Version 1.0.0
* @version 1.0.0
* @ Matthew Hawley
*/
public static function uninstall()
{
$db = XenForo_Application::get('db');
$db->query(self::$table['dropQuery']);
}
}
?>