Skip to content

Commit

Permalink
move setQuery into check if query exists
Browse files Browse the repository at this point in the history
  • Loading branch information
nkissebe committed Feb 7, 2025
1 parent 94f2e41 commit 887bcd3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions core/components/com_tools/models/tool.php
Original file line number Diff line number Diff line change
Expand Up @@ -503,10 +503,10 @@ public function _sql_update($all = false)
$query = '';
}

$db->setQuery($query);

if (!empty($query))
{
$db->setQuery($query);

$result = $db->query();

if ($result === false)
Expand Down Expand Up @@ -1608,7 +1608,7 @@ public static function validate(&$tool, &$err, $id)
}
}

if (count($err) > 0)
if (is_array($err) && count($err) > 0)
{
return false;
}
Expand Down
6 changes: 3 additions & 3 deletions core/components/com_tools/models/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,6 @@ private function _sql_update($all = false)
{
$db = \App::get('db');

Log::debug('_sql_update() start');
$query = "UPDATE #__tool_version SET ";

$classvars = get_class_vars(__CLASS__);
Expand All @@ -693,6 +692,7 @@ private function _sql_update($all = false)

foreach ($classvars as $property => $value)
{

if (($property[0] == '_') || in_array($property, $this->_list_keys))
{
continue;
Expand Down Expand Up @@ -731,10 +731,10 @@ private function _sql_update($all = false)
$query = '';
}

$db->setQuery($query);

if (!empty($query))
{
$db->setQuery($query);

$result = $db->query();

if ($result === false)
Expand Down

0 comments on commit 887bcd3

Please sign in to comment.