Back to Updater class

Method getUpdateSites

private array
getUpdateSites
(mixed $eid = 0)
Returns the update site records for an extension with ID $eid. If $eid is zero all enabled update sites records will be returned.
Parameters
  • int $eid The extension ID to fetch.
Returns
  • array
Since
  • 3.6.0
Class: Updater
Project: Joomla

Method getUpdateSites - Source code

/**
 * Returns the update site records for an extension with ID $eid. If $eid is zero all enabled update sites records
 * will be returned.
 *
 * @param   int  $eid  The extension ID to fetch.
 *
 * @return  array
 *
 * @since   3.6.0
 */
private function getUpdateSites($eid = 0)
{
    $db = $this->getDbo();
    $query = $db->getQuery(true);
    $query->select(['DISTINCT ' . $db->quoteName('a.update_site_id'), $db->quoteName('a.type'), $db->quoteName('a.location'), $db->quoteName('a.last_check_timestamp'), $db->quoteName('a.extra_query')])->from($db->quoteName('#__update_sites', 'a'))->where($db->quoteName('a.enabled') . ' = 1');
    if ($eid) {
        $query->join('INNER', $db->quoteName('#__update_sites_extensions', 'b'), $db->quoteName('a.update_site_id') . ' = ' . $db->quoteName('b.update_site_id'));
        if (\is_array($eid)) {
            $query->whereIn($db->quoteName('b.extension_id'), $eid);
        } elseif ($eid = (int) $eid) {
            $query->where($db->quoteName('b.extension_id') . ' = :eid')->bind(':eid', $eid, ParameterType::INTEGER);
        }
    }
    $db->setQuery($query);
    $result = $db->loadAssocList();
    if (!\is_array($result)) {
        return array();
    }
    return $result;
}