-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.php
60 lines (52 loc) · 1.4 KB
/
install.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
<?php
/**
* @package Jmb_Donation
* @author Dmitry Rekun <[email protected]>
* @copyright Copyright (C) 2011 - 2015 NorrNext. All rights reserved.
* @license GNU General Public License version 3 or later; see license.txt
*/
defined('_JEXEC') or die;
/**
* Install script class
*
* @since 1.0
*/
class PlgContentJmb_DonationInstallerScript
{
/**
* Method to set message after installation
*
* @param string $route The type of the route: install, uninstall, discover_install, update
* @param JAdapterInstance $adapter The class who calls this method
*
* @return boolean
*
* @since 1.0
*/
public function postflight($route, JAdapterInstance $adapter)
{
if ($route == 'install')
{
$manifest = $adapter->getParent()->get('manifest');
$name = strtolower($adapter->get('name'));
$type = (string) $manifest->attributes()->type;
try
{
$db = $adapter->getParent()->getDbo();
$query = $db->getQuery(true)
->select($db->quoteName('extension_id'))
->from($db->quoteName('#__extensions'))
->where($db->quoteName('type') . ' = ' . $db->quote($type))
->where($db->quoteName('name') . ' = ' . $db->quote($name));
$db->setQuery($query);
$id = $db->loadResult();
}
catch (RuntimeException $e)
{
return false;
}
echo JText::sprintf('PLG_CONTENT_JMB_DONATION_INSTALL_TEXT', $id);
}
return true;
}
}