Commit e8c6a6a81a3dafcf0f2a2685c810eb9d945d5c22
1 parent
2ceb7708
Exists in
master
Ajustes SQL e nome diretorio do update da base de dados
Showing
2 changed files
with
70 additions
and
0 deletions
Show diff stats
... | ... | @@ -0,0 +1,18 @@ |
1 | +-- | |
2 | +-- Table structure for table `core_config` | |
3 | +-- | |
4 | +CREATE TABLE IF NOT EXISTS `core_config` ( | |
5 | + `id` INTEGER PRIMARY KEY AUTO_INCREMENT, | |
6 | + `config_module` VARCHAR (255) NOT NULL, | |
7 | + `config_name` VARCHAR (255) NOT NULL, | |
8 | + `config_value` VARCHAR(255) NOT NULL | |
9 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |
10 | + | |
11 | +ALTER TABLE `regras_negocio` ADD COLUMN `type` ENUM('incoming','outgoing','others') NOT NULL DEFAULT 'others' ; | |
12 | + | |
13 | +ALTER TABLE `core_notifications` ADD COLUMN `id_itc` INT(11) DEFAULT 1; | |
14 | +ALTER TABLE `core_notifications` ADD COLUMN `from` VARCHAR(128) DEFAULT "Opens"; | |
15 | +INSERT INTO `core_config` (`config_module`, `config_name`, `config_value`) VALUES ('CORE', 'HOST_NOTIFICATION', 'http://api.opens.com.br:3003/notifications'); | |
16 | + | |
17 | + | |
18 | + | ... | ... |
... | ... | @@ -0,0 +1,52 @@ |
1 | +<?php | |
2 | +/** | |
3 | + * This file is part of SNEP. | |
4 | + * | |
5 | + * SNEP is free software: you can redistribute it and/or modify | |
6 | + * it under the terms of the GNU General Public License as published by | |
7 | + * the Free Software Foundation, either version 3 of the License, or | |
8 | + * (at your option) any later version. | |
9 | + * | |
10 | + * SNEP is distributed in the hope that it will be useful, | |
11 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | + * GNU General Public License for more details. | |
14 | + * | |
15 | + * You should have received a copy of the GNU General Public License | |
16 | + * along with SNEP. If not, see <http://www.gnu.org/licenses/>. | |
17 | + * | |
18 | + * This routine update callerid for used module billing and should | |
19 | + * be performed when migrating from versions prior to 3.0 stable release. | |
20 | + * | |
21 | + * @author : Opens Developers Team | |
22 | + * @package : snep | |
23 | + * @version : 3.0 - 2016, march | |
24 | + * | |
25 | + */ | |
26 | + | |
27 | +$conecta = mysql_connect("localhost", "snep", "sneppass") or print (mysql_error()); | |
28 | +mysql_select_db("snep", $conecta) or print(mysql_error()); | |
29 | + | |
30 | +$sql = "SELECT callerid,name FROM peers"; | |
31 | + | |
32 | +$result = mysql_query($sql, $conecta); | |
33 | +/* Escreve resultados até que não haja mais linhas na tabela */ | |
34 | +while($consulta = mysql_fetch_array($result)) { | |
35 | + | |
36 | + $nameValue = explode("<", $consulta['callerid']); | |
37 | + if(count($nameValue) <= 1){ | |
38 | + $new_callerid = $consulta['callerid']. " <".$consulta['name'].">"; | |
39 | + }else{ | |
40 | + $new_callerid = $consulta['callerid']; | |
41 | + }; | |
42 | + | |
43 | + $name = $consulta['name']; | |
44 | + $sql = "UPDATE peers SET callerid = '$new_callerid' WHERE name='$name'"; | |
45 | + | |
46 | + mysql_query($sql) or die(mysql_error()); | |
47 | + | |
48 | +}; | |
49 | + | |
50 | +mysql_free_result($result); | |
51 | +mysql_close($conecta); | |
52 | +?> | ... | ... |