monthlyarchive.script.php
2.14 KB
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
85
86
87
88
89
90
91
92
93
94
95
<?php
/* ======================================================
# Monthly Archive - Joomla! Component v4.3.3 (PRO version)
# -------------------------------------------------------
# For Joomla! 3.x
# Author: Yiannis Christodoulou (yiannis@web357.eu)
# Copyright (©) 2009-2018 Web357. All rights reserved.
# License: GNU/GPLv3, http://www.gnu.org/licenses/gpl-3.0.html
# Website: https://www.web357.eu/
# Demo: http://demo.web357.eu/?item=monthlyarchive
# Support: support@web357.eu
# Last modified: 09 Feb 2018, 13:55:18
========================================================= */
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// http://docs.joomla.org/J2.5:Developing_a_MVC_Component/Adding_an_install-uninstall-update_script_file
class plgSystemMonthlyArchiveInstallerScript
{
/**
* method to install the component
*
* @return void
*/
function install($parent)
{
// $parent is the class calling this method
}
/**
* method to uninstall the component
*
* @return void
*/
function uninstall($parent)
{
// $parent is the class calling this method
}
/**
* method to update the component
*
* @return void
*/
function update($parent)
{
// $parent is the class calling this method
}
/**
* method to run before an install/update/uninstall method
*
* @return void
*/
function preflight($type, $parent)
{
// $parent is the class calling this method
// $type is the type of change (install, update or discover_install)
}
/**
* method to run after an install/update/uninstall method
*
* @return void
*/
function postflight($type, $parent)
{
// BEGIN: Enable Plugin
$db = JFactory::getDbo();
try
{
// Enable plugin by default
$q = $db->getQuery(true);
$q->update('#__extensions');
$q->set(array('enabled = 1', 'protected = 0', 'ordering = 9999'));
$q->where("element = 'monthlyarchive'");
$q->where("type = 'plugin'", 'AND');
$q->where("folder = 'system'", 'AND');
$db->setQuery($q);
method_exists($db, 'execute') ? $db->execute() : $db->query();
}
catch (Exception $e)
{
throw $e;
}
// END: Enable Plugin
}
}