/[smecontribs]/rpms/smeserver-freepbx/contribs10/smeserver-freepbx-14-bz11923-bz12256.patch
ViewVC logotype

Contents of /rpms/smeserver-freepbx/contribs10/smeserver-freepbx-14-bz11923-bz12256.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download)
Tue Dec 13 06:51:08 2022 UTC (22 months, 2 weeks ago) by jpp
Branch: MAIN
CVS Tags: smeserver-freepbx-14-10_el7_sme, smeserver-freepbx-14-11_el7_sme, smeserver-freepbx-14-13_el7_sme, smeserver-freepbx-14-12_el7_sme, smeserver-freepbx-14-14_el7_sme, HEAD
* Tue Dec 13 2022 Jean-Philippe Pialasse <tests@pialasse.com> 14-10.sme
- fix backup for FreePBX 15 and higher [SME: 12256]
- make compatible up to FreePBX 16 [SME: 11923]

1 diff -Nur --no-dereference smeserver-freepbx-14.old/root/etc/e-smith/events/actions/freepbx-backup smeserver-freepbx-14/root/etc/e-smith/events/actions/freepbx-backup
2 --- smeserver-freepbx-14.old/root/etc/e-smith/events/actions/freepbx-backup 2022-12-13 01:07:25.747000000 -0500
3 +++ smeserver-freepbx-14/root/etc/e-smith/events/actions/freepbx-backup 2022-12-13 01:15:52.204000000 -0500
4 @@ -1,3 +1,20 @@
5 #!/bin/bash
6
7 -su asterisk -s /bin/bash -c '/usr/sbin/php /var/lib/asterisk/bin/backup.php --id=1'
8 +#version
9 +version=$(/usr/bin/xmllint --xpath 'string(/module/version)' /opt/freepbx/admin/modules/backup/module.xml|cut -d. -f1)
10 +#if version >=15
11 +if [[ $version -ge 15 ]]
12 +then
13 +#backup id SELECT `id` FROM `kvstore_FreePBX_modules_Backup` WHERE `key` LIKE 'backup_name' and `val` LIKE 'Default-backup';
14 +backupid=$(echo 'SELECT `id` FROM `kvstore_FreePBX_modules_Backup` WHERE `key` LIKE "backup_name" and `val` LIKE "Default-backup"'| mysql -u root freepbxdb -s)
15 +#if backupid empty need to set one of manually backup something
16 + if [ -z $backupid ] ; then
17 + echo "missing backupid, we create the db entries"
18 + /etc/e-smith/events/actions/freepbx-checkinstall-backup pre-backup
19 + fi
20 + echo "backup for freepbx version 15 or above"
21 + /usr/sbin/fwconsole bu --backup $backupid 1>/dev/null
22 +else
23 + echo "backup for freepbx version 14 or below"
24 + su asterisk -s /bin/bash -c '/usr/sbin/php56 /var/lib/asterisk/bin/backup.php --id=1'
25 +fi
26 diff -Nur --no-dereference smeserver-freepbx-14.old/root/etc/e-smith/events/actions/freepbx-checkinstall smeserver-freepbx-14/root/etc/e-smith/events/actions/freepbx-checkinstall
27 --- smeserver-freepbx-14.old/root/etc/e-smith/events/actions/freepbx-checkinstall 2022-12-13 01:07:25.743000000 -0500
28 +++ smeserver-freepbx-14/root/etc/e-smith/events/actions/freepbx-checkinstall 2022-12-13 01:42:25.665000000 -0500
29 @@ -88,9 +88,26 @@
30 chown asterisk:asterisk /opt/freepbx/digium_phones
31 fi
32
33 +#change the links to get the right php
34 +ln -sf /usr/sbin/e-smith/fwconsole /usr/sbin/fwconsole
35 +ln -sf /usr/sbin/e-smith/fwconsole /usr/local/sbin/fwconsole
36 +version=$(/usr/bin/xmllint --xpath 'string(/module/version)' /opt/freepbx/admin/modules/core/module.xml|cut -d. -f1)
37 +php="/usr/bin/php74"
38 +if [[ $version -ge 16 ]]
39 +then
40 + php="/usr/bin/php80"
41 +elif [[ $version -lt 15 ]]
42 +then
43 + php="/usr/bin/php56"
44 +fi
45 +ln -sf $php /usr/sbin/php
46 +
47 +
48 # update modules
49 -/usr/sbin/fwconsole ma upgrade framework
50 -/usr/sbin/fwconsole ma upgradeall -R standard -R extended
51 -/usr/sbin/fwconsole ma refreshsignatures
52 -/usr/sbin/fwconsole ma downloadinstall userman certman ucp
53 +/usr/sbin/e-smith/fwconsole ma upgrade framework
54 +/usr/sbin/e-smith/fwconsole ma upgradeall -R standard -R extended
55 +/usr/sbin/e-smith/fwconsole ma refreshsignatures
56 +/usr/sbin/e-smith/fwconsole ma downloadinstall userman certman
57 +/usr/sbin/e-smith/fwconsole ma downloadinstall ucp 2>/dev/null
58 +
59 exit 0
60 diff -Nur --no-dereference smeserver-freepbx-14.old/root/etc/e-smith/events/actions/freepbx-checkinstall-backup smeserver-freepbx-14/root/etc/e-smith/events/actions/freepbx-checkinstall-backup
61 --- smeserver-freepbx-14.old/root/etc/e-smith/events/actions/freepbx-checkinstall-backup 2022-12-13 01:07:25.747000000 -0500
62 +++ smeserver-freepbx-14/root/etc/e-smith/events/actions/freepbx-checkinstall-backup 2022-12-13 01:15:45.666000000 -0500
63 @@ -19,44 +19,182 @@
64 /bin/mkdir -p $backuppath
65 fi
66
67 -# set first backup as the one for SME way
68 -# set destination
69 -mysql -e "use $DBNAME;UPDATE backup_server_details set value = '/home/e-smith/files/freepbx' WHERE server_id = 1;"
70 -# set info for backup 1
71 -#data = a:1:{s:10:"created_by";s:11:"install.php";}
72 -mysql -e "use $DBNAME;INSERT INTO backup (\`id\`, \`name\`, \`description\` , \`immortal\` ,\`data\`, \`email\` ) VALUES (1, 'Default backup', 'Default SME PBX backup; automatically installed', 'true','', 'admin' ) ON DUPLICATE KEY UPDATE \`description\` = 'Default SME PBX backup; automatically installed', \`immortal\` = 'true', \`email\` = 'admin' , \`name\`= 'Default backup' ;" 2>/dev/null || mysql -e "use $DBNAME;INSERT INTO backup (\`id\`, \`name\`, \`emailaddr\` ) VALUES (1, 'SMEbackup', 'admin' ) ON DUPLICATE KEY UPDATE \`name\` = 'SMEbackup', \`emailaddr\` = 'admin' ;"
73 -
74 -mysql -e "use $DBNAME;ALTER TABLE backup_details ADD UNIQUE uniq ( \`backup_id\` , \`key\` , \`index\` ) ;"
75 -mysql -e "use $DBNAME;INSERT INTO backup_details (\`backup_id\`, \`key\`, \`index\`, \`value\`) VALUES
76 -(1, 'delete_time_type', '', 'days'),
77 -(1, 'delete_amount', '', '2'),
78 -(1, 'desc', '', 'Default SME PBX backup; automatically installed'),
79 -(1, 'cron_schedule', '', 'weekly'),
80 -(1, 'cron_random', '', 'on'),
81 -(1, 'cron_month', '', ''),
82 -(1, 'cron_minute', '', '0'),
83 -(1, 'cron_hour', '', '0'),
84 -(1, 'cron_dow', '', '0'),
85 -(1, 'cron_dom', '', ''),
86 -(1, 'bu_server', '', '0'),
87 -(1, 'delete_time', '', '0'),
88 -(1, 'email', '', 'admin'),
89 -(1, 'emailfailonly', '', '1'),
90 -(1, 'storage_servers', '0', '1') ON DUPLICATE KEY UPDATE \`value\`=VALUES(\`value\`) ;"
91 -mysql -e "use $DBNAME;ALTER TABLE backup_details DROP INDEX uniq;"
92 -# set what to backup
93 -mysql -e "use $DBNAME;ALTER TABLE backup_items ADD UNIQUE \`uniq\` ( \`backup_id\` , \`type\` , \`path\` ( 15 ) ) ;"
94 -mysql -e "use freepbxdb;INSERT INTO backup_items (\`backup_id\`, \`type\`, \`path\`, \`exclude\`) VALUES
95 -(1, 'dir', '/etc/dahdi', 'a:0:{}'),
96 - (1, 'dir', '__ASTSPOOLDIR__/voicemail', 'a:0:{}'),
97 -(1, 'mysql', 'server-2', 'a:0:{}'),
98 -(1, 'astdb', 'astdb', 'a:0:{}'),
99 -(1, 'mysql', 'server-3', 'a:0:{}'),
100 -(1, 'dir', '__ASTETCDIR__', 'a:0:{}'),
101 -(1, 'dir', '__AMPWEBROOT__', 'a:0:{}'),
102 -(1, 'dir', '__AMPBIN__', 'a:0:{}'),
103 -(1, 'dir', '/tftpboot', 'a:0:{}') ON DUPLICATE KEY UPDATE \`exclude\`=VALUES(\`exclude\`) ;";
104 -mysql -e "use $DBNAME;ALTER TABLE backup_items DROP INDEX \`uniq\` ;"
105 +version=$(/usr/bin/xmllint --xpath 'string(/module/version)' /opt/freepbx/admin/modules/backup/module.xml|cut -d. -f1)
106 +#if version >=15
107 +if [[ $version -ge 15 ]]
108 +then
109 + ############
110 + # FILE STORE
111 + ############
112 + # check local space is defined, if not do it kvstore_FreePBX_modules_Filestore
113 + filestore=$(echo 'SELECT `id` FROM `kvstore_FreePBX_modules_Filestore` WHERE `key` LIKE "path" and `val` LIKE "/home/e-smith/files/freepbx/"'| mysql -u root freepbxdb -s)
114 + if [ -z $filestore ] ; then
115 + filestore=$(/usr/bin/uuidgen)
116 + echo "creating new filestore id $filestore"
117 + else
118 + echo "filestore $filestore will be used"
119 + fi
120 + # we need existing servers value to update it
121 + servers=$(echo 'SELECT `val` FROM `kvstore_FreePBX_modules_Filestore` WHERE `key` LIKE "servers" and `id` LIKE "noid"'| mysql -u root freepbxdb -s)
122 + servers=$(echo $servers| jq '. |= . + {"'$filestore'" : { "id": "'$filestore'","name": "Local Storage","desc": "Storage location for backups", "driver": "Local" }}')
123 + mysql -e "use $DBNAME; INSERT INTO \`kvstore_FreePBX_modules_Filestore\` (\`key\`, \`val\`, \`type\`, \`id\`) VALUES
124 + ('servers', '$servers', 'json-arr', 'noid')
125 + ON DUPLICATE KEY UPDATE val=VALUES(val);"
126 + mysql -e "use $DBNAME; INSERT INTO \`kvstore_FreePBX_modules_Filestore\` (\`key\`, \`val\`, \`type\`, \`id\`) VALUES
127 + ('name', 'Local Storage', NULL, '$filestore'),
128 + ('desc', 'Storage location for backups', NULL, '$filestore'),
129 + ('path', '/home/e-smith/files/freepbx/', NULL, '$filestore'),
130 + ('immortal', 'true', NULL, '$filestore'),
131 + ('driver', 'Local', NULL, '$filestore')
132 + ON DUPLICATE KEY UPDATE val=VALUES(val);"
133 +
134 + ###########
135 + # BACKUP
136 + ###########
137 + # check Default-backup exists, if not set it, else update it
138 + backupid=$(echo 'SELECT `id` FROM `kvstore_FreePBX_modules_Backup` WHERE `key` LIKE "backup_name" and `val` LIKE "Default-backup"'| mysql -u root freepbxdb -s)
139 + if [ -z $backupid ] ; then
140 + backupid=$(/usr/bin/uuidgen)
141 + echo "creating new backup id $backupid"
142 +
143 + ##TODO SELECT * FROM `kvblobstore` WHERE `uuid` LIKE 'a9fe727b-fc4c-40c4-ad45-bcabd075302a'
144 + ### TODO : list modules enabled and populate
145 + blobstore=$(/usr/bin/uuidgen)
146 + mysql -e "use $DBNAME;INSERT INTO kvstore_FreePBX_modules_Backup (\`key\`, \`val\`, \`type\`, \`id\`) VALUES
147 + ('backup_items', '$blobstore', 'blob', '$backupid')
148 + ON DUPLICATE KEY UPDATE val=VALUES(val);"
149 + # create an empty blob store, it seems to not be a problem to actually run the backup
150 + mysql -e "use $DBNAME;INSERT INTO kvblobstore (\`uuid\`, \`type\`, \`content\`) VALUES
151 + ('$blobstore', NULL, '');" || exit 1
152 + # we do this only if the other did not failed to avoid hitting one existing uuid
153 + mysql -e "use $DBNAME;INSERT INTO kvstore_FreePBX_modules_Backup (\`key\`, \`val\`, \`type\`, \`id\`) VALUES
154 + ('backup_items', '$blobstore', 'blob', '$backupid')
155 + ON DUPLICATE KEY UPDATE val=VALUES(val);"
156 +
157 + else
158 + echo "Updating backup $backupid"
159 + fi
160 +
161 + mysql -e "use $DBNAME;INSERT INTO kvstore_FreePBX_modules_Backup (\`key\`, \`val\`, \`type\`, \`id\`) VALUES
162 +('backup_name', 'Default-backup', NULL, '$backupid'),
163 +('backup_description', 'Default SME PBX backup; automatically installed', NULL, '$backupid'),
164 +('backup_email', 'admin', NULL, '$backupid'),
165 +('created_by', 'SME Server Event', NULL, '$backupid'),
166 +('desc', 'Default SME PBX backup; automatically installed', NULL, '$backupid'),
167 +('warmspare_remoteip', '', NULL, '$backupid'),
168 +('warmspare_user', '', NULL, '$backupid'),
169 +('maintruns', '2', NULL, '$backupid'),
170 +('backup_emailtype', 'failure', NULL, '$backupid'),
171 +('backup_schedule', '31 5 * * 0', NULL, '$backupid'),
172 +('schedule_enabled', 'yes', NULL, '$backupid'),
173 +('backup_storage', '[\\\"Local_$filestore\\\"]', 'json-arr', '$backupid'),
174 +('backup_items', 'a9fe727b-fc4c-40c4-ad45-bcabd075302a', 'blob', '$backupid'),
175 +('maintage', 'Unlimited', NULL, '$backupid'),
176 +('backup_emailinline', '', NULL, '$backupid'),
177 +('backup_addbjname', 'yes', NULL, '$backupid'),
178 +('warmspareenabled', 'on', NULL, '$backupid'),
179 +('warmspare_remotenat', 'on', NULL, '$backupid'),
180 +('warmspare_cert', 'on', NULL, '$backupid'),
181 +('warmspare_remotebind', 'on', NULL, '$backupid'),
182 +('warmspare_remotedns', 'on', NULL, '$backupid'),
183 +('warmspare_remoteapply', 'on', NULL, '$backupid'),
184 +('publickey', '', NULL, '$backupid'),
185 +('warmsparewayofrestore', 'API', NULL, '$backupid'),
186 +('warmspare_remoteapi_filestoreid', '', NULL, '$backupid'),
187 +('warmspare_remoteapi_accesstoken', '', NULL, '$backupid'),
188 +('warmspare_remoteapi_accesstokenurl', '', NULL, '$backupid'),
189 +('warmspare_remoteapi_accesstoken_expire', '', NULL, '$backupid'),
190 +('warmspare_remoteapi_clientid', '', NULL, '$backupid'),
191 +('warmspare_remoteapi_secret', '', NULL, '$backupid'),
192 +('warmspare_remoteapi_gql', '', NULL, '$backupid'),
193 +('warmspare_excludetrunks', 'on', NULL, '$backupid'),
194 +('warmspare_remotessh_filestoreid', '', NULL, '$backupid'),
195 +('custom_files', '[{\"type\":\"dir\",\"path\":\"__ASTETCDIR__\",\"exclude\":[]}]', NULL, '$backupid'),
196 +('prebu_hook', '', NULL, '$backupid'),
197 +('postbu_hook', '', NULL, '$backupid'),
198 +('prere_hook', '', NULL, '$backupid'),
199 +('postre_hook', '', NULL, '$backupid'),
200 +('core_disabletrunks', '', NULL, '$backupid'),
201 +('$backupid', '{\\\"id\\\":\\\"$backupid\\\",\\\"name\\\":\\\"Default-backup\\\",\\\"description\\\":\\\"Default SME PBX backup; automatically installed\\\"}', 'json-arr', 'backupList'),
202 +('bu_1', '{\\\"id\\\":\\\"1\\\",\\\"name\\\":\\\"Default backup\\\",\\\"description\\\":\\\"Default SME PBX backup; automatically installed\\\",\\\"immortal\\\":\\\"true\\\",\\\"data\\\":{\\\"created_by\\\":\\\"install.php\\\",\\\"desc\\\":\\\"Default SME PBX backup; automatically installed\\\",\\\"cron_schedule\\\":\\\"weekly\\\",\\\"storage_servers\\\":[\\\"1\\\"],\\\"bu_server\\\":\\\"0\\\",\\\"delete_amount\\\":\\\"2\\\",\\\"delete_time_type\\\":\\\"days\\\",\\\"cron_random\\\":\\\"on\\\",\\\"cron_month\\\":\\\"\\\",\\\"cron_minute\\\":\\\"0\\\",\\\"cron_hour\\\":\\\"0\\\",\\\"cron_dow\\\":\\\"0\\\",\\\"cron_dom\\\":\\\"\\\",\\\"delete_time\\\":\\\"0\\\",\\\"email\\\":\\\"admin\\\",\\\"emailfailonly\\\":\\\"1\\\"},\\\"email\\\":\\\"admin\\\",\\\"uuid\\\":\\\"$backupid\\\",\\\"items\\\":[{\\\"backup_id\\\":\\\"1\\\",\\\"type\\\":\\\"mysql\\\",\\\"path\\\":\\\"server-2\\\",\\\"exclude\\\":[]},{\\\"backup_id\\\":\\\"1\\\",\\\"type\\\":\\\"astdb\\\",\\\"path\\\":\\\"astdb\\\",\\\"exclude\\\":[]},{\\\"backup_id\\\":\\\"1\\\",\\\"type\\\":\\\"dir\\\",\\\"path\\\":\\\"\\/etc\\/dahdi\\\",\\\"exclude\\\":[]},{\\\"backup_id\\\":\\\"1\\\",\\\"type\\\":\\\"dir\\\",\\\"path\\\":\\\"__ASTSPOOLDIR__\\/voicemail\\\",\\\"exclude\\\":[]},{\\\"backup_id\\\":\\\"1\\\",\\\"type\\\":\\\"mysql\\\",\\\"path\\\":\\\"server-3\\\",\\\"exclude\\\":[]},{\\\"backup_id\\\":\\\"1\\\",\\\"type\\\":\\\"dir\\\",\\\"path\\\":\\\"__ASTETCDIR__\\\",\\\"exclude\\\":[]},{\\\"backup_id\\\":\\\"1\\\",\\\"type\\\":\\\"dir\\\",\\\"path\\\":\\\"__AMPWEBROOT__\\\",\\\"exclude\\\":[]},{\\\"backup_id\\\":\\\"1\\\",\\\"type\\\":\\\"dir\\\",\\\"path\\\":\\\"__AMPBIN__\\\",\\\"exclude\\\":[]},{\\\"backup_id\\\":\\\"1\\\",\\\"type\\\":\\\"dir\\\",\\\"path\\\":\\\"\\/tftpboot\\\",\\\"exclude\\\":[]}]}', 'json-arr', 'migratedbackups'),
203 +('arimanager', '1', NULL, 'modules_$backupid'),
204 +('backup', '1', NULL, 'modules_$backupid'),
205 +('blacklist', '1', NULL, 'modules_$backupid'),
206 +('callrecording', '1', NULL, 'modules_$backupid'),
207 +('cdr', '1', NULL, 'modules_$backupid'),
208 +('cel', '1', NULL, 'modules_$backupid'),
209 +('certman', '1', NULL, 'modules_$backupid'),
210 +('cidlookup', '1', NULL, 'modules_$backupid'),
211 +('conferences', '1', NULL, 'modules_$backupid'),
212 +('core', '1', NULL, 'modules_$backupid'),
213 +('customappsreg', '1', NULL, 'modules_$backupid'),
214 +('dashboard', '1', NULL, 'modules_$backupid'),
215 +('fax', '1', NULL, 'modules_$backupid'),
216 +('filestore', '1', NULL, 'modules_$backupid'),
217 +('findmefollow', '1', NULL, 'modules_$backupid'),
218 +('framework', '1', NULL, 'modules_$backupid'),
219 +('infoservices', '1', NULL, 'modules_$backupid'),
220 +('ivr', '1', NULL, 'modules_$backupid'),
221 +('languages', '1', NULL, 'modules_$backupid'),
222 +('logfiles', '1', NULL, 'modules_$backupid'),
223 +('manager', '1', NULL, 'modules_$backupid'),
224 +('music', '1', NULL, 'modules_$backupid'),
225 +('phonebook', '1', NULL, 'modules_$backupid'),
226 +('pm2', '1', NULL, 'modules_$backupid'),
227 +('recordings', '1', NULL, 'modules_$backupid'),
228 +('ringgroups', '1', NULL, 'modules_$backupid'),
229 +('sipsettings', '1', NULL, 'modules_$backupid'),
230 +('soundlang', '1', NULL, 'modules_$backupid'),
231 +('ucp', '1', NULL, 'modules_$backupid'),
232 +('userman', '1', NULL, 'modules_$backupid'),
233 +('voicemail', '1', NULL, 'modules_$backupid')
234 +ON DUPLICATE KEY UPDATE val=VALUES(val);"
235 +
236 +# TODO update
237 +#mysql -e "use $DBNAME;INSERT INTO kvstore_FreePBX_modules_Backup (\`key\`, \`val\`, \`type\`, \`id\`) VALUES
238 +#('backup_items', 'a9fe727b-fc4c-40c4-ad45-bcabd075302a', 'blob', '$backupid')
239 +#ON DUPLICATE KEY UPDATE val=VALUES(val);"
240 +
241 +else
242 + # set first backup as the one for SME way
243 + # set destination
244 + mysql -e "use $DBNAME;UPDATE backup_server_details set value = '/home/e-smith/files/freepbx' WHERE server_id = 1;"
245 + # set info for backup 1
246 + #data = a:1:{s:10:"created_by";s:11:"install.php";}
247 + mysql -e "use $DBNAME;INSERT INTO backup (\`id\`, \`name\`, \`description\` , \`immortal\` ,\`data\`, \`email\` ) VALUES (1, 'Default backup', 'Default SME PBX backup; automatically installed', 'true','', 'admin' ) ON DUPLICATE KEY UPDATE \`description\` = 'Default SME PBX backup; automatically installed', \`immortal\` = 'true', \`email\` = 'admin' , \`name\`= 'Default backup' ;" 2>/dev/null || mysql -e "use $DBNAME;INSERT INTO backup (\`id\`, \`name\`, \`emailaddr\` ) VALUES (1, 'SMEbackup', 'admin' ) ON DUPLICATE KEY UPDATE \`name\` = 'SMEbackup', \`emailaddr\` = 'admin' ;"
248 +
249 + mysql -e "use $DBNAME;ALTER TABLE backup_details ADD UNIQUE uniq ( \`backup_id\` , \`key\` , \`index\` ) ;"
250 + mysql -e "use $DBNAME;INSERT INTO backup_details (\`backup_id\`, \`key\`, \`index\`, \`value\`) VALUES
251 + (1, 'delete_time_type', '', 'days'),
252 + (1, 'delete_amount', '', '2'),
253 + (1, 'desc', '', 'Default SME PBX backup; automatically installed'),
254 + (1, 'cron_schedule', '', 'weekly'),
255 + (1, 'cron_random', '', 'on'),
256 + (1, 'cron_month', '', ''),
257 + (1, 'cron_minute', '', '0'),
258 + (1, 'cron_hour', '', '0'),
259 + (1, 'cron_dow', '', '0'),
260 + (1, 'cron_dom', '', ''),
261 + (1, 'bu_server', '', '0'),
262 + (1, 'delete_time', '', '0'),
263 + (1, 'email', '', 'admin'),
264 + (1, 'emailfailonly', '', '1'),
265 + (1, 'storage_servers', '0', '1') ON DUPLICATE KEY UPDATE \`value\`=VALUES(\`value\`) ;"
266 + mysql -e "use $DBNAME;ALTER TABLE backup_details DROP INDEX uniq;"
267 + # set what to backup
268 + mysql -e "use $DBNAME;ALTER TABLE backup_items ADD UNIQUE \`uniq\` ( \`backup_id\` , \`type\` , \`path\` ( 15 ) ) ;"
269 + mysql -e "use freepbxdb;INSERT INTO backup_items (\`backup_id\`, \`type\`, \`path\`, \`exclude\`) VALUES
270 + (1, 'dir', '/etc/dahdi', 'a:0:{}'),
271 + (1, 'dir', '__ASTSPOOLDIR__/voicemail', 'a:0:{}'),
272 + (1, 'mysql', 'server-2', 'a:0:{}'),
273 + (1, 'astdb', 'astdb', 'a:0:{}'),
274 + (1, 'mysql', 'server-3', 'a:0:{}'),
275 + (1, 'dir', '__ASTETCDIR__', 'a:0:{}'),
276 + (1, 'dir', '__AMPWEBROOT__', 'a:0:{}'),
277 + (1, 'dir', '__AMPBIN__', 'a:0:{}'),
278 + (1, 'dir', '/tftpboot', 'a:0:{}') ON DUPLICATE KEY UPDATE \`exclude\`=VALUES(\`exclude\`) ;";
279 + mysql -e "use $DBNAME;ALTER TABLE backup_items DROP INDEX \`uniq\` ;"
280 +fi
281
282 # make sure all perms are ok for backup
283 /usr/sbin/fwconsole chown > /dev/null 2>&1
284 diff -Nur --no-dereference smeserver-freepbx-14.old/root/sbin/e-smith/fwconsole smeserver-freepbx-14/root/sbin/e-smith/fwconsole
285 --- smeserver-freepbx-14.old/root/sbin/e-smith/fwconsole 1969-12-31 19:00:00.000000000 -0500
286 +++ smeserver-freepbx-14/root/sbin/e-smith/fwconsole 2022-12-13 01:40:13.673000000 -0500
287 @@ -0,0 +1,12 @@
288 +#!/bin/bash
289 +version=$(/usr/bin/xmllint --xpath 'string(/module/version)' /opt/freepbx/admin/modules/core/module.xml|cut -d. -f1)
290 +php="/usr/bin/php74"
291 +if [[ $version -ge 16 ]]
292 +then
293 + php="/usr/bin/php80"
294 +elif [[ $version -lt 15 ]]
295 +then
296 + php="/usr/bin/php56"
297 +fi
298 +
299 +$php --define sys_temp_dir=/var/spool/asterisk/tmp/ --define allow_url_fopen=1 /var/lib/asterisk/bin/fwconsole $@

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed