View file mc-master/modules/private/helpers/private_installer.php

File size: 1.33Kb
<?php

/**
 * MobileCMS
 *
 * Open source content management system for mobile sites
 *
 * @author MobileCMS Team <[email protected]>
 * @copyright Copyright (c) 2011-2019, MobileCMS Team
 * @link https://mobilecms.pro Official site
 * @license MIT license
 */


//---------------------------------------------

/**
 * Хелпер установки модуля
 */
class private_installer
{

    /**
     * Установка модуля
     */
    public static function install($db)
    {
        $db->query("CREATE TABLE IF NOT EXISTS #__private_messages (
			  `message_id` int(11) NOT NULL auto_increment,
			  `user_id` int(11) NOT NULL,
			  `user_from_id` int(11) NOT NULL,
			  `user_to_id` int(11) NOT NULL,
			  `message` varchar(300) NOT NULL,
			  `folder` enum('new','inbox','outbox','saved') NOT NULL default 'new',
			  `time` int(11) NOT NULL,
			  PRIMARY KEY  (`message_id`),
			  KEY `user_id` (`user_id`,`user_from_id`,`user_to_id`)
			) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
		");

        main::add_event('private', 'pre_controller');
    }

    /**
     * Деинсталляция модуля
     */
    public static function uninstall($db)
    {
        $db->query("DROP TABLE #__private_messages ;");
        main::delete_event('private');
    }

}

?>