|
|
|
<?php
|
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* AVE.cms - Модуль импорта
|
|
|
|
*
|
|
|
|
* @package AVE.cms
|
|
|
|
* @subpackage module_Import
|
|
|
|
* @filesource
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* mySQL-запросы для установки, обновления и удаления модуля
|
|
|
|
*/
|
|
|
|
|
|
|
|
$module_sql_install = array();
|
|
|
|
$module_sql_deinstall = array();
|
|
|
|
$module_sql_update = array();
|
|
|
|
|
|
|
|
$module_sql_deinstall[] = "DROP TABLE IF EXISTS CPPREFIX_module_import;";
|
|
|
|
|
|
|
|
$module_sql_install[] = "CREATE TABLE CPPREFIX_module_import (
|
|
|
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
|
|
|
`name` varchar(255) NOT NULL,
|
|
|
|
`rub_id` int(10) unsigned NOT NULL,
|
|
|
|
`parser` varchar(255) NOT NULL,
|
|
|
|
`docs_disable` enum('0','1') NOT NULL default '0',
|
|
|
|
`docs_create` enum('0','1') NOT NULL default '0',
|
|
|
|
`file` varchar(255) NOT NULL,
|
|
|
|
`monitor` enum('0','1') NOT NULL default '0',
|
|
|
|
`tags` text NOT NULL,
|
|
|
|
`fields` longtext NOT NULL,
|
|
|
|
`time_edited` int(10) unsigned NOT NULL,
|
|
|
|
`time_run` int(10) unsigned NOT NULL,
|
|
|
|
PRIMARY KEY (`id`)
|
|
|
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8;";
|
|
|
|
|
|
|
|
$module_sql_install[] = "CREATE TABLE CPPREFIX_module_import (
|
|
|
|
`id` mediumint(5) unsigned NOT NULL auto_increment,
|
|
|
|
`import_name` varchar(255) NOT NULL,
|
|
|
|
`import_rub` int(10) unsigned default NULL,
|
|
|
|
`import_parser` varchar(255) NOT NULL,
|
|
|
|
`import_delete_docs` enum('0','1') NOT NULL default '0',
|
|
|
|
`import_docs_create` enum('0','1') NOT NULL default '0',
|
|
|
|
`import_default_file` varchar(255) NOT NULL,
|
|
|
|
`import_monitor_file` enum('0','1') NOT NULL,
|
|
|
|
|
|
|
|
`import_last_update` int(10) unsigned default NULL,
|
|
|
|
`import_text` longtext NOT NULL,
|
|
|
|
PRIMARY KEY (`id`)
|
|
|
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8;";
|
|
|
|
|
|
|
|
|
|
|
|
// Обновление модуля
|
|
|
|
$module_sql_update[] = "
|
|
|
|
UPDATE
|
|
|
|
`CPPREFIX_module`
|
|
|
|
SET
|
|
|
|
ModuleAveTag = '" . $modul['ModuleAveTag'] . "',
|
|
|
|
ModulePHPTag = '" . $modul['ModulePHPTag'] . "',
|
|
|
|
ModuleVersion = '" . $modul['ModuleVersion'] . "'
|
|
|
|
WHERE
|
|
|
|
ModuleSysName = '" . $modul['ModuleSysName'] . "'
|
|
|
|
LIMIT 1;
|
|
|
|
";
|
|
|
|
|
|
|
|
// Name
|
|
|
|
$module_sql_update[] = "
|
|
|
|
ALTER TABLE
|
|
|
|
`CPPREFIX_module_import`
|
|
|
|
CHANGE
|
|
|
|
`import_name` `name` varchar(255) NOT NULL;
|
|
|
|
";
|
|
|
|
// RubID
|
|
|
|
$module_sql_update[] = "
|
|
|
|
ALTER TABLE
|
|
|
|
`CPPREFIX_module_import`
|
|
|
|
CHANGE
|
|
|
|
`import_rub` `rub_id` int(10) unsigned NOT NULL;
|
|
|
|
";
|
|
|
|
// Parser
|
|
|
|
$module_sql_update[] = "
|
|
|
|
ALTER TABLE
|
|
|
|
`CPPREFIX_module_import`
|
|
|
|
CHANGE
|
|
|
|
`import_parser` `parser` varchar(255) NOT NULL;
|
|
|
|
";
|
|
|
|
// Docs off
|
|
|
|
$module_sql_update[] = "
|
|
|
|
ALTER TABLE
|
|
|
|
`CPPREFIX_module_import`
|
|
|
|
CHANGE
|
|
|
|
`import_delete_docs` `docs_disable` enum('0','1') NOT NULL default '0';
|
|
|
|
";
|
|
|
|
// Docs create
|
|
|
|
$module_sql_update[] = "
|
|
|
|
ALTER TABLE
|
|
|
|
`CPPREFIX_module_import`
|
|
|
|
CHANGE
|
|
|
|
`import_docs_create` `docs_create` enum('0','1') NOT NULL default '0';
|
|
|
|
";
|
|
|
|
// File
|
|
|
|
$module_sql_update[] = "
|
|
|
|
ALTER TABLE
|
|
|
|
`CPPREFIX_module_import`
|
|
|
|
CHANGE
|
|
|
|
`import_default_file` `file` varchar(255) NOT NULL;
|
|
|
|
";
|
|
|
|
// Monitor
|
|
|
|
$module_sql_update[] = "
|
|
|
|
ALTER TABLE
|
|
|
|
`CPPREFIX_module_import`
|
|
|
|
CHANGE
|
|
|
|
`import_monitor_file` `monitor` enum('0','1') NOT NULL default '0';
|
|
|
|
";
|
|
|
|
// Tags
|
|
|
|
$module_sql_update[] = "
|
|
|
|
ALTER TABLE
|
|
|
|
`CPPREFIX_module_import`
|
|
|
|
ADD
|
|
|
|
`tags` text NOT NULL
|
|
|
|
AFTER
|
|
|
|
`monitor`
|
|
|
|
";
|
|
|
|
// Fields
|
|
|
|
$module_sql_update[] = "
|
|
|
|
ALTER TABLE
|
|
|
|
`CPPREFIX_module_import`
|
|
|
|
CHANGE
|
|
|
|
`import_text` `fields` LONGTEXT NOT NULL AFTER `tags`;
|
|
|
|
";
|
|
|
|
// Time Edit
|
|
|
|
$module_sql_update[] = "
|
|
|
|
ALTER TABLE
|
|
|
|
`CPPREFIX_module_import`
|
|
|
|
CHANGE
|
|
|
|
`import_last_update` `time_edited` int(10) unsigned NOT NULL;
|
|
|
|
";
|
|
|
|
// LastRun
|
|
|
|
$module_sql_update[] = "
|
|
|
|
ALTER TABLE
|
|
|
|
`CPPREFIX_module_import`
|
|
|
|
ADD
|
|
|
|
`time_run` int(10) unsigned NOT NULL
|
|
|
|
AFTER
|
|
|
|
`time_edited`
|
|
|
|
";
|