-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinstall.php
114 lines (98 loc) · 3.05 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
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<?php
/**
* @version 0.7 stable $Id: install.php yannick berges
* @package Joomla
* @subpackage FLEXIcontent
* @copyright (C) 2015 Berges Yannick - www.com3elles.com
* @license GNU/GPL v2
* special thanks to ggppdk and emmanuel dannan for flexicontent
* special thanks to my master Marc Studer
* FLEXIadmin module 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.
**/
// No direct access to this file
defined('_JEXEC') or die;
/**
* Script file of HelloWorld module
*/
class mod_flexigooglemapInstallerScript
{
/**
* Method to install the extension
* $parent is the class calling this method
*
* @return void
*/
function install($parent)
{
}
/**
* Method to uninstall the extension
* $parent is the class calling this method
*
* @return void
*/
function uninstall($parent)
{
echo '<p>The module has been uninstalled</p>';
}
/**
* Method to update the extension
* $parent is the class calling this method
*
* @return void
*/
function update($parent)
{
//echo '<p>The module has been updated to version' . $parent->get('manifest')->version) . '</p>';
}
/**
* Method to run before an install/update/uninstall method
* $parent is the class calling this method
* $type is the type of change (install, update or discover_install)
*
* @return void
*/
function preflight($type, $parent)
{
echo '<p>Update is good</p>';
}
/**
* Method to run after an install/update/uninstall method
* $parent is the class calling this method
* $type is the type of change (install, update or discover_install)
*
* @return void
*/
function postflight($type, $parent)
{
/** marker copy **/
$pathSourceName = JPath::clean(JPATH_ROOT.'/modules/mod_flexigooglemap/assets/marker');
$pathDestName = JPath::clean(JPATH_ROOT.'/images/mod_flexigooglemap/marker');
// 1. Check DESTINATION folder
if ( !JFolder::exists($pathDestName) && !JFolder::create($pathDestName) ) {
echo '<span class="alert alert-warning"> Error, unable to create folder: '. $pathDestName.'</span>';
}
// 2. Copy all files
$files = glob($pathSourceName."/*.*");
foreach($files as $file){
$file_dest = basename($file);
copy($file, $pathDestName.'/'.$file_dest);
}
/** cluster copy **/
$pathSourceName2 = JPath::clean(JPATH_ROOT.'/modules/mod_flexigooglemap/assets/cluster');
$pathDestName2 = JPath::clean(JPATH_ROOT.'/images/mod_flexigooglemap/cluster');
// 1. Check DESTINATION folder
if ( !JFolder::exists($pathDestName2) && !JFolder::create($pathDestName2) ) {
echo '<span class="alert alert-warning"> Error, unable to create folder: '. $pathDestName2.'</span>';
}
// 2. Copy all files
$files2 = glob($pathSourceName2."/*.*");
foreach($files2 as $file2){
$file_dest2 = basename($file2);
copy($file2, $pathDestName2.'/'.$file_dest2);
}
}
}