Skip to content

Commit

Permalink
[bug][33116] Use query builder in JUpdater->findUpdates(). Fixes #2787
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Hunziker committed Jul 27, 2014
1 parent 1b195bb commit 52c4187
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions libraries/joomla/updater/updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,20 +70,29 @@ public static function getInstance()
*/
public function findUpdates($eid = 0, $cacheTimeout = 0)
{
$db = $this->getDBO();
$db = $this->getDBO();
$query = $db->getQuery(true);

$retval = false;

// Push it into an array
if (!is_array($eid))
{
$query = 'SELECT DISTINCT update_site_id, type, location, last_check_timestamp, extra_query FROM #__update_sites WHERE enabled = 1';
}
else
$query->select('DISTINCT a.update_site_id, a.type, a.location, a.last_check_timestamp, a.extra_query')
->from('#__update_sites AS a')
->where('a.enabled = 1');

if ($eid)
{
$query = 'SELECT DISTINCT update_site_id, type, location, last_check_timestamp, extra_query FROM #__update_sites' .
' WHERE update_site_id IN' .
' (SELECT update_site_id FROM #__update_sites_extensions WHERE extension_id IN (' . implode(',', $eid) . '))';
$query->join('INNER', '#__update_sites_extensions AS b ON a.update_site_id = b.update_site_id');

if (is_array($eid))
{
$query->where('b.extension_id IN (' . implode(',', $eid) . ')');
}
elseif ((int) $eid)
{
$query->where('b.extension_id = ' . $eid);
}
}

$db->setQuery($query);
$results = $db->loadAssocList();
$result_count = count($results);
Expand Down

0 comments on commit 52c4187

Please sign in to comment.