FOF30\Container\Container::getDefaultMediaVersion PHP Method

getDefaultMediaVersion() protected method

Gets the default media version string for the component using the component's version and date, as well as the site's secret key.
protected getDefaultMediaVersion ( ) : string
return string
    protected function getDefaultMediaVersion()
    {
        // Initialise
        $version = '0.0.0';
        $date = '0000-00-00';
        $secret = '';
        // Get the version and date of the component from the manifest cache
        try {
            $db = $this->db;
            $query = $db->getQuery(true)->select(array($db->qn('manifest_cache')))->from($db->qn('#__extensions'))->where($db->qn('type') . ' = ' . $db->q('component'))->where($db->qn('name') . ' = ' . $db->q($this->componentName));
            $db->setQuery($query);
            $json = $db->loadResult();
            $params = new \JRegistry($json);
            $version = $params->get('version', $version);
            $date = $params->get('creationDate', $date);
        } catch (\Exception $e) {
        }
        // Get the site's secret
        try {
            $app = \JFactory::getApplication();
            if (method_exists($app, 'get')) {
                $secret = $app->get('secret');
            }
        } catch (\Exception $e) {
        }
        // Generate the version string
        return md5($version . $date . $secret);
    }