forked from Ivinco/Joomla-Sphinx-Search-component
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sphinxsearch.php
86 lines (70 loc) · 2.41 KB
/
install.sphinxsearch.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
<?php
/**
*
*
* @author Ivinco LTD.
* @package Ivinco
* @subpackage SphinxSearch
* @copyright Copyright (C) 2011 Ivinco Ltd. All rights reserved.
* @license This file is part of the SphinxSearch component for Joomla!.
The SphinxSearch component for Joomla! is free software: you can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the License,
or (at your option) any later version.
The SphinxSearch component for Joomla! is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with the SphinxSearch component for Joomla!. If not, see
<http://www.gnu.org/licenses/>.
* Contributors
* Please feel free to add your name and email (optional) here if you have
* contributed any source code changes.
* Name Email
* Ivinco <[email protected]>
*
*/
defined('_JEXEC') or die('Restricted access');
jimport('joomla.installer.helper');
function com_install()
{
$installer = new SphinxSearchInstaller();
$installer->install();
}
class SphinxSearchInstaller
{
const COM_SPHINXSEARCH = "com_sphinxsearch";
public function __construct()
{
}
public function install()
{
$installer = new JInstaller();
$installer->_overwrite = true;
$pkg_path = JPATH_ADMINISTRATOR.DS.'components'.DS.self::COM_SPHINXSEARCH.DS.'extensions'.DS;
if ($handle = opendir($pkg_path)) {
while ($pkg = readdir($handle)) {
if ($pkg != "." && $pkg != "..") {
$package = JInstallerHelper::unpack($pkg_path.$pkg);
if ($installer->install($package['dir'])) {
$msgcolor = "#E0FFE0";
$msgtext = "$pkg successfully installed.";
} else {
$msgcolor = "#FFD0D0";
$msgtext = "ERROR: Could not install $pkg. Please install manually.";
}
?>
<table bgcolor="<?php echo $msgcolor; ?>" width ="100%">
<tr style="height:30px">
<td width="50px"><img src="/administrator/images/tick.png" height="20px" width="20px"></td>
<td><font size="2"><b><?php echo $msgtext; ?></b></font></td>
</tr>
</table>
<?php
JInstallerHelper::cleanupInstall($pkg_path.$pkg, $package['dir']);
}
}
}
}
}