-
Notifications
You must be signed in to change notification settings - Fork 2
/
script.php
98 lines (92 loc) · 3.15 KB
/
script.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Language\Text;
/**
* Script file of QWHelloWorld component.
*
* The name of this class is dependent on the component being installed.
* The class name should have the component's name, directly followed by
* the text InstallerScript (ex:. Com_QwhelloworldInstallerScript).
*
* This class will be called by Joomla!'s installer, if specified in your component's
* manifest file, and is used for custom automation actions in its installation process.
*
* In order to use this automation script, you should reference it in your component's
* manifest file as follows:
* <scriptfile>script.php</scriptfile>
*
* @package Joomla.Administrator
* @subpackage com_qwhelloworld
*
* @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
class Com_QwhelloworldInstallerScript
{
/**
* This method is called after a component is installed.
*
* @param \stdClass $parent - Parent object calling this method.
*
* @return void
*/
public function install($parent)
{
//$parent->getParent()->setRedirectURL('index.php?option=com_qwhelloworld');
echo '<p>' . JText::_('COM_QWHELLOWORLD_INSTALL_TEXT') . '</p>';
}
/**
* This method is called after a component is uninstalled.
*
* @param \stdClass $parent - Parent object calling this method.
*
* @return void
*/
public function uninstall($parent)
{
echo '<p>' . Text::_('COM_QWHELLOWORLD_UNINSTALL_TEXT') . '</p>';
}
/**
* This method is called after a component is updated.
*
* @param \stdClass $parent - Parent object calling object.
*
* @return void
*/
public function update($parent)
{
echo '<p>' . Text::sprintf('COM_QWHELLOWORLD_UPDATE_TEXT', $parent->get('manifest')->version) . '</p>';
}
/**
* Runs just before any installation action is preformed on the component.
* Verifications and pre-requisites should run in this function.
*
* @param string $type - Type of PreFlight action. Possible values are:
* - * install
* - * update
* - * discover_install
* @param \stdClass $parent - Parent object calling object.
*
* @return void
*/
public function preflight($type, $parent)
{
echo '<p>' . Text::_('COM_QWHELLOWORLD_PREFLIGHT_' . $type . '_TEXT') . '</p>';
}
/**
* Runs right after any installation action is preformed on the component.
*
* @param string $type - Type of PostFlight action. Possible values are:
* - * install
* - * update
* - * discover_install
* @param \stdClass $parent - Parent object calling object.
*
* @return void
*/
function postflight($type, $parent)
{
echo '<p>' . JText::_('COM_QWHELLOWORLD_POSTFLIGHT_' . $type . '_TEXT') . '</p>';
}
}