Update app_defaults.php

This commit is contained in:
FusionPBX 2019-07-25 09:03:48 -06:00 committed by GitHub
parent 0c0d1d4c9a
commit 04acc2ebbf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 18 deletions

View File

@ -17,7 +17,7 @@
The Initial Developer of the Original Code is The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com> Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012 Portions created by the Initial Developer are Copyright (C) 2008-2019
the Initial Developer. All Rights Reserved. the Initial Developer. All Rights Reserved.
Contributor(s): Contributor(s):
@ -33,31 +33,31 @@ if ($domains_processed == 1) {
//find rows that have a null group_uuid and set the correct group_uuid //find rows that have a null group_uuid and set the correct group_uuid
$sql = "select * from v_user_groups "; $sql = "select * from v_user_groups ";
$sql .= "where group_uuid is null; "; $sql .= "where group_uuid is null; ";
$prep_statement = $db->prepare(check_sql($sql)); $database = new database;
if ($prep_statement) { $result = $database->select($sql, null, 'all');
$prep_statement->execute(); if (is_array($result)) {
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$db->beginTransaction();
foreach($result as $row) { foreach($result as $row) {
if (strlen($row['group_name']) > 0) { if (strlen($row['group_name']) > 0) {
//get the group_uuid //get the group_uuid
$sql = "select group_uuid from v_groups "; $sql = "select group_uuid from v_groups ";
$sql .= "where group_name = '".$row['group_name']."' "; $sql .= "where group_name = :group_name ";
$prep_statement_sub = $db->prepare($sql); $parameters['group_name'] = $row['group_name'];
$prep_statement_sub->execute(); $database = new database;
$sub_result = $prep_statement_sub->fetch(PDO::FETCH_ASSOC); $group_uuid = $database->select($sql, null, 'column');
unset ($prep_statement_sub); unset($sql, $parameters);
$group_uuid = $sub_result['group_uuid'];
//set the group_uuid //set the group_uuid
$sql = "update v_user_groups set "; $sql = "update v_user_groups set ";
$sql .= "group_uuid = '".$group_uuid."' "; $sql .= "group_uuid = :group_uuid ";
$sql .= "where user_group_uuid = '".$row['user_group_uuid']."'; "; $sql .= "where user_group_uuid = :user_group_uuid; ";
$db->exec($sql); $parameters['group_uuid'] = $group_uuid;
unset($sql); $parameters['user_group_uuid'] = $row['user_group_uuid'];
$database = new database;
$database->execute($sql, $parameters);
unset($sql, $parameters);
} }
} }
$db->commit(); unset ($result);
unset ($prep_statement);
} }
} }