-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.cw_quickblocks.php
84 lines (70 loc) · 1.81 KB
/
script.cw_quickblocks.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?php
/**
* @copyright Copyright (C) 2015-2016 Cory Webb Media, LLC. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
/**
* Script file of Quick Blocks component
*/
class com_cw_quickblocksInstallerScript
{
/**
* method to install the component
*
* @return void
*/
function install($parent)
{
}
/**
* method to uninstall the component
*
* @return void
*/
function uninstall($parent)
{
}
/**
* method to update the component
*
* @return void
*/
function update($parent)
{
}
/**
* method to run before an install/update/uninstall method
*
* @return void
*/
function preflight($type, $parent)
{
}
/**
* method to run after an install/update/uninstall method
*
* @return void
*/
function postflight($type, $parent)
{
if ($type == 'uninstall') {
return true;
}
$this->source = $parent->getParent()->getPath('source');
// Get a new installer
$installer = new JInstaller();
$db = JFactory::getDbo();
if ($installer->install($this->source.'/plugins/plg_installer_cw')) {
$query = $db->getQuery(true);
$query->update('#__extensions')
->set($db->qn('enabled').'='.$db->q(1))
->where($db->qn('element').'='.$db->q('cw'))
->where($db->qn('type').'='.$db->q('plugin'))
->where($db->qn('folder').'='.$db->q('installer'));
$db->setQuery($query);
$db->execute();
}
}
}