Back to UpdateAdapter class

Method getUpdateSiteName

protected string
getUpdateSiteName
(mixed $updateSiteId)
Get the name of an update site. This is used in logging.
Parameters
  • int $updateSiteId The numeric ID of the update site
Returns
  • string The name of the update site or an empty string if it's not found
Class: UpdateAdapter
Project: Joomla

Method getUpdateSiteName - Source code

/**
 * Get the name of an update site. This is used in logging.
 *
 * @param   int  $updateSiteId  The numeric ID of the update site
 *
 * @return  string  The name of the update site or an empty string if it's not found
 */
protected function getUpdateSiteName($updateSiteId)
{
    $updateSiteId = (int) $updateSiteId;
    if (empty($updateSiteId)) {
        return '';
    }
    $db = $this->parent->getDbo();
    $query = $db->getQuery(true)->select($db->quoteName('name'))->from($db->quoteName('#__update_sites'))->where($db->quoteName('update_site_id') . ' = :id')->bind(':id', $updateSiteId, ParameterType::INTEGER);
    $db->setQuery($query);
    $name = '';
    try {
        $name = $db->loadResult();
    } catch (\RuntimeException $e) {
        // Do nothing
    }
    return $name;
}