/** * Removes a table of a source * * @param $sourceId */ public static function removeTableOf($sourceId) { try { $usageCounter = ipDb()->selectValue(self::DATA_TABLE_REPOSITORY, 'usageCounter', array('sourceId' => $sourceId)); if (intval($usageCounter) > 1) { self::decrementUsageCounter($sourceId); return; } $dataTableEntry = ipDb()->selectRow(self::DATA_TABLE_REPOSITORY, '*', array('sourceId' => $sourceId)); if ($dataTableEntry == null) { return; } Table::deleteTable(json_decode($dataTableEntry['tableMetaData'], true)); ipDb()->delete(self::DATA_TABLE_REPOSITORY, array('sourceId' => $sourceId)); } catch (\Ip\Exception\Db $e) { ipLog()->error("Could not remove table, Message: " . $e->getMessage()); throw $e; } }