-
Notifications
You must be signed in to change notification settings - Fork 3
/
script.j2migrationchecker.php
executable file
·55 lines (51 loc) · 2.34 KB
/
script.j2migrationchecker.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
/*
* @package Emailbasket Application
* @subpackage J2Store
* @author Gokila Priya - Weblogicx India http://www.weblogicxindia.com
* @copyright Copyright (c) 2014 Weblogicx India Ltd. All rights reserved.
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
* --------------------------------------------------------------------------------
*/
// no direct access
defined('_JEXEC') or die('Restricted access');
require_once(JPATH_ADMINISTRATOR . '/components/com_j2store/version.php');
class Com_J2MigrationCheckerInstallerScript
{
function preflight($type, $parent)
{
jimport('joomla.filesystem.file');
$app = JFactory::getApplication();
$version_file = JPATH_ADMINISTRATOR . '/components/com_j2store/version.php';
if (JFile::exists($version_file)) {
require_once($version_file);
// abort if the current J2Store release is older
if (($type == 'install') && version_compare(J2STORE_VERSION, '3.99.99', 'ge')) {
$app->enqueueMessage('You are using an latest version of J2Store. No need to migrate', 'warning');
return false;
}
} else {
$app->enqueueMessage('J2Store not found or the version file is not found. Make sure that you have installed J2Store before installing this plugin', 'warning');
return false;
}
$db = JFactory::getDbo();
// get the table list
$tables = $db->getTableList();
// get prefix
$prefix = $db->getPrefix();
if (!in_array($prefix . 'extension_check', $tables)) {
$query = "CREATE TABLE IF NOT EXISTS `#__extension_check` (
`extension_check_id` int(11) NOT NULL AUTO_INCREMENT,
`component_status` varchar(50) NOT NULL,
`plugins_status` varchar(50) NOT NULL,
`modules_status` varchar(50) NOT NULL,
`template_status` varchar(50) NOT NULL,
`installation_status` int(11) NOT NULL,
PRIMARY KEY (`extension_check_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;";
$db->setQuery($query);
$db->execute();
}
return true;
}
}