Skip to content

Commit

Permalink
Merge pull request #1142 from sergejey/alpha
Browse files Browse the repository at this point in the history
Delete object update
  • Loading branch information
sergejey authored Aug 24, 2024
2 parents f827824 + 1553664 commit 4b1e522
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions modules/devices/devices.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1053,6 +1053,8 @@ function delete_devices($id)
{
$rec = SQLSelectOne("SELECT * FROM devices WHERE ID='$id'");

if (!isset($rec['ID'])) return false;

$payload = array();
$payload['name'] = $rec['LINKED_OBJECT'];
sg('HomeBridge.to_remove', json_encode($payload));
Expand Down
2 changes: 2 additions & 0 deletions modules/objects/objects.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,8 @@ function delete_objects($id)
{
$rec = SQLSelectOne("SELECT * FROM objects WHERE ID='$id'");

if (!isset($rec['ID'])) return false;

// DELETE LINKED OBJECT FROM ALL TABLES
$tables = SQLSelect("SELECT DISTINCT TABLE_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME IN ('LINKED_OBJECT') AND TABLE_SCHEMA='" . DB_NAME . "';");
$total = count($tables);
Expand Down

0 comments on commit 4b1e522

Please sign in to comment.