-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathscript.php
35 lines (25 loc) · 922 Bytes
/
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
<?php
//No direct access to this file
defined('_JEXEC') or die('Restricted access');
/**
* com_pbevents installer script
*/
class com_pbeventsInstallerScript
{
function postflight($type,$parent) {
$installer = new JInstaller();
//first check to see if the plugin is already installed needed to allow upgrade
$db = JFactory::getDbo();
$extension = $db->setQuery('select * from #__extensions where `type` = "plugin" and `element` = "pbevents" and `folder` = "content"')->loadObject();
if ($extension)
$installer->uninstall('plugin',$extension->extension_id);
//get dir.... some installs don't support __DIR__ constant...
$version = new JVersion();
if ($version->RELEASE != '2.5')
define('DS',DIRECTORY_SEPARATOR);
$dir_arr = explode(DS,__FILE__);
$dir_arr = array_slice($dir_arr, 0,(count($dir_arr)-1));
//now install.
$installer->install(implode(DS,$dir_arr).DS.'plugin');
}
}