You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
107 lines
4.6 KiB
107 lines
4.6 KiB
<?php |
|
|
|
/** |
|
* AVE.cms - Модуль Рейтинг документов. |
|
* |
|
* @package AVE.cms |
|
* @subpackage mod_rating |
|
* @since 1.1 |
|
* @filesource |
|
*/ |
|
|
|
/** |
|
* mySQL-запросы для установки, обновления и удаления модуля |
|
*/ |
|
|
|
$module_sql_install = array(); |
|
$module_sql_deinstall = array(); |
|
$module_sql_update = array(); |
|
|
|
// Удаление модуля |
|
$module_sql_deinstall[] = "DROP TABLE IF EXISTS `CPPREFIX_module_rating_details`;"; |
|
$module_sql_deinstall[] = "DROP TABLE IF EXISTS `CPPREFIX_module_rating_summary`;"; |
|
$module_sql_deinstall[] = "DROP TABLE IF EXISTS `CPPREFIX_module_rating_settings`;"; |
|
|
|
// Установка модуля |
|
$module_sql_install[] = "CREATE TABLE `CPPREFIX_module_rating_details` ( |
|
`Id` int(10) unsigned NOT NULL auto_increment, |
|
`rating_id_doc` mediumint(5) unsigned NOT NULL default '0', #Id документа |
|
`rating_id_user` mediumint(5) unsigned NOT NULL default '0', #Id пользователя |
|
`rating_vote` mediumint(5) unsigned NOT NULL default '0', #Голос пользователя |
|
`rating_date` int(10) unsigned NOT NULL default '0', #Дата голоса |
|
`rating_user_ip` varchar(255) NOT NULL, #IP пользователя |
|
PRIMARY KEY (`Id`) |
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8;"; |
|
|
|
$module_sql_install[] = "CREATE TABLE `CPPREFIX_module_rating_settings` ( |
|
`Id` tinyint(1) unsigned NOT NULL auto_increment, |
|
`rating_user_groups` varchar(255) NOT NULL default '1,2,3,4,5', #Группы пользователей |
|
`rating_stars` enum('1','2','3','4','5','6','7','8','9','10') NOT NULL default '5', #Кол-во звезд |
|
`rating_round` enum('0','1','2','3') NOT NULL default '0', #Округление //0: Целое число// 1: Десятые //2: Сотые //3: Тысячные |
|
`rating_active` enum('1','0') NOT NULL default '1', #Активность рейтинга |
|
PRIMARY KEY (`Id`) |
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8;"; |
|
|
|
$module_sql_install[] = "CREATE TABLE `CPPREFIX_module_rating_summary` ( |
|
`Id` int(10) unsigned NOT NULL auto_increment, |
|
`rating_id_doc` int(10) unsigned NOT NULL default '0', #Id документа |
|
`rating_total` int(10) unsigned NOT NULL default '0', #Кол-во голосов |
|
`rating_sum` int(10) unsigned NOT NULL default '0', #Общая сумма голосов |
|
PRIMARY KEY (`Id`) |
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8;"; |
|
|
|
$module_sql_install[] = "INSERT INTO `CPPREFIX_module_rating_settings` VALUES ('1', '1,2,3,4,5', '5', '0', '1');"; |
|
|
|
// Обновление модуля |
|
$module_sql_update[] = " |
|
RENAME TABLE |
|
`CPPREFIX_module_rating` |
|
TO |
|
`CPPREFIX_module_rating_summary` |
|
"; |
|
|
|
$module_sql_update[] = " |
|
ALTER TABLE `CPPREFIX_module_rating_summary` CHANGE `Id` `rating_id_doc` INT( 10 ) UNSIGNED NOT NULL; |
|
"; |
|
|
|
$module_sql_update[] = " |
|
ALTER TABLE `CPPREFIX_module_rating_summary` CHANGE `rating_count` `rating_total` INT( 10 ) UNSIGNED NOT NULL; |
|
"; |
|
|
|
$module_sql_update[] = " |
|
ALTER TABLE `CPPREFIX_module_rating_summary` DROP `lastip`; |
|
"; |
|
|
|
$module_sql_update[] = "CREATE TABLE `CPPREFIX_module_rating_details` ( |
|
`Id` int(10) unsigned NOT NULL auto_increment, |
|
`rating_id_doc` mediumint(5) unsigned NOT NULL default '0', #Id документа |
|
`rating_id_user` mediumint(5) unsigned NOT NULL default '0', #Id пользователя |
|
`rating_vote` mediumint(5) unsigned NOT NULL default '0', #Голос пользователя |
|
`rating_date` int(10) unsigned NOT NULL default '0', #Дата голоса |
|
`rating_user_ip` varchar(255) NOT NULL, #IP пользователя |
|
PRIMARY KEY (`Id`) |
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8;"; |
|
|
|
$module_sql_update[] = "CREATE TABLE `CPPREFIX_module_rating_settings` ( |
|
`Id` tinyint(1) unsigned NOT NULL auto_increment, |
|
`rating_user_groups` varchar(255) NOT NULL default '1,2,3,4,5', #Группы пользователей |
|
`rating_stars` enum('1','2','3','4','5','6','7','8','9','10') NOT NULL default '5', #Кол-во звезд |
|
`rating_round` enum('0','1','2','3') NOT NULL default '0', #Округление //0: Целое число// 1: Десятые //2: Сотые //3: Тысячные |
|
`rating_active` enum('1','0') NOT NULL default '1', #Активность рейтинга |
|
PRIMARY KEY (`Id`) |
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8;"; |
|
|
|
$module_sql_update[] = "INSERT INTO `CPPREFIX_module_rating_settings` VALUES ('1', '1,2,3,4,5', '5', '0', '1');"; |
|
|
|
$module_sql_update[] = " |
|
UPDATE |
|
`CPPREFIX_module` |
|
SET |
|
ModuleAveTag = '" . $modul['ModuleAveTag'] . "', |
|
ModulePHPTag = '" . $modul['ModulePHPTag'] . "', |
|
ModuleVersion = '" . $modul['ModuleVersion'] . "' |
|
WHERE |
|
ModuleSysName = '" . $modul['ModuleSysName'] . "' |
|
LIMIT 1; |
|
"; |
|
?>
|