-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathfile.script.php
More file actions
92 lines (71 loc) · 2.75 KB
/
Copy pathfile.script.php
File metadata and controls
92 lines (71 loc) · 2.75 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
<?php
class pkg_zooInstallerScript extends ZooInstallerScript {}
class ZooInstallerScript {
public function install($parent) {}
public function uninstall($parent) {}
public function update($parent) {}
public function preflight($type, $parent) {}
public function postflight($type, $parent, $results) {
if (class_exists('AppRequirements')) {
$requirements = new AppRequirements();
$requirements->checkRequirements();
$requirements->displayResults();
}
if (class_exists('App')) {
// get zoo instance
$app = App::getInstance('zoo');
$app->module->enable('mod_zooquickicon', 'icon');
$app->plugin->enable('zooshortcode');
$app->plugin->enable('zoosmartsearch');
$app->plugin->enable('zoosearch');
$app->plugin->enable('zooevent');
}
// updateservers url update workaround
if ('update' == $type) {
$db = JFactory::getDBO();
if ($parent->manifest->updateservers) {
$servers = $parent->manifest->updateservers->children();
$db->setQuery(
"UPDATE `#__update_sites` a" .
" LEFT JOIN `#__update_sites_extensions` b ON b.update_site_id = a.update_site_id" .
" SET location = " . $db->quote(trim((string) $servers[0])) . ', enabled = 1' .
" WHERE b.extension_id = (SELECT `extension_id` FROM `#__extensions` WHERE `type` = 'package' AND `element` = 'pkg_widgetkit')"
)->execute();
}
}
$extensions = array();
foreach($results as $result) {
$extensions[] = (object) array('name' => $result['name'] == 'com_zoo' ? 'ZOO extension' : $result['name'], 'status' => $result['result'], 'message' => $result['result'] ? ($type == 'update' ? 'Updated' : 'Installed').' successfully' : 'NOT Installed');
}
// display extension installation results
self::displayResults($extensions, 'Extensions', 'Extension');
}
protected function displayResults($result, $name, $type) { ?>
<h3><?php echo JText::_($name); ?></h3>
<table class="adminlist table table-bordered table-striped" width="100%">
<thead>
<tr>
<th class="title"><?php echo JText::_($type); ?></th>
<th width="60%"><?php echo JText::_('Status'); ?></th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="2"> </td>
</tr>
</tfoot>
<tbody>
<?php
foreach ($result as $i => $ext) : ?>
<tr class="row<?php echo $i++ % 2; ?>">
<td class="key"><?php echo $ext->name; ?></td>
<td>
<?php $style = $ext->status ? 'font-weight: bold; color: green;' : 'font-weight: bold; color: red;'; ?>
<span style="<?php echo $style; ?>"><?php echo JText::_($ext->message); ?></span>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php }
}