-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathscript.php
54 lines (47 loc) · 1.55 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
<?php
/**
* @version 2011-07-23 20:07:15$
* @author Marek Handze
* @package JomSocial Group Sync
* @copyright Copyright (C) 2011- . All rights reserved.
* @license GNU GPL
*/
defined( '_JEXEC' ) or die( 'Restricted access' );
/*
* Installer script for package
*/
class com_JomSocialGroupSyncInstallerScript {
/**
* method to run during installation
* installs and enables the plugin
*
* @return void
*/
function install($parent)
{
$manifest = $parent->get("manifest");
$parent = $parent->getParent();
$source = $parent->getPath("source");
$installer = new JInstaller();
// Install plugins
foreach($manifest->plugins->plugin as $plugin) {
$attributes = $plugin->attributes();
$plg = $source . DS . $attributes['folder'].DS.$attributes['plugin'];
$installer->install($plg);
}
$db = JFactory::getDbo();
$tableExtensions = $db->nameQuote("#__extensions");
$columnElement = $db->nameQuote("element");
$columnType = $db->nameQuote("type");
$columnEnabled = $db->nameQuote("enabled");
// Enable plugins
$db->setQuery( "UPDATE $tableExtensions
SET $columnEnabled = 1
WHERE ( $columnElement = 'jomsocialgroupsync' OR
$columnElement = 'jomsocialgroupsyncsystem' ) AND
AND $columnType = 'plugin'"
);
$db->query();
}
}
?>