diff --git a/components/com_banners/Model/BannerModel.php b/components/com_banners/Model/BannerModel.php index fc8065061db0e..28036fc757f0c 100644 --- a/components/com_banners/Model/BannerModel.php +++ b/components/com_banners/Model/BannerModel.php @@ -12,6 +12,8 @@ use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\BaseDatabaseModel; +use Joomla\CMS\Cache\Exception\CacheExceptionInterface; +use Joomla\CMS\Factory; /** * Banner model for the Joomla Banners component. @@ -75,7 +77,7 @@ public function click() if ($trackClicks > 0) { - $trackDate = \JFactory::getDate()->format('Y-m-d H'); + $trackDate = Factory::getDate()->format('Y-m-d H'); $query->clear() ->select($db->quoteName('count')) @@ -146,7 +148,7 @@ public function &getItem() if (!isset($this->_item)) { /** @var \JCacheControllerCallback $cache */ - $cache = \JFactory::getCache('com_banners', 'callback'); + $cache = Factory::getCache('com_banners', 'callback'); $id = $this->getState('banner.id'); @@ -177,7 +179,7 @@ public function &getItem() { $this->_item = $cache->get($loader, array($id), md5(__METHOD__ . $id)); } - catch (\JCacheException $e) + catch (CacheExceptionInterface $e) { $this->_item = $loader($id); } diff --git a/components/com_banners/Model/BannersModel.php b/components/com_banners/Model/BannersModel.php index 8b92d47edd80b..2446c87086de4 100644 --- a/components/com_banners/Model/BannersModel.php +++ b/components/com_banners/Model/BannersModel.php @@ -14,6 +14,9 @@ use Joomla\CMS\MVC\Model\ListModel; use Joomla\Registry\Registry; use Joomla\Utilities\ArrayHelper; +use Joomla\Database\DatabaseQuery; +use Joomla\Database\Exception\ExecutionFailureException; +use Joomla\CMS\Factory; /** * Banners model for the Joomla Banners component. @@ -48,9 +51,9 @@ protected function getStoreId($id = '') } /** - * Method to get a \JDatabaseQuery object for retrieving the data set from a database. + * Method to get a DatabaseQuery object for retrieving the data set from a database. * - * @return \JDatabaseQuery A \JDatabaseQuery object to retrieve the data set. + * @return DatabaseQuery A DatabaseQuery object to retrieve the data set. * * @since 1.6 */ @@ -65,7 +68,7 @@ protected function getListQuery() $keywords = $this->getState('filter.keywords'); $randomise = ($ordering === 'random'); $nullDate = $db->quote($db->getNullDate()); - $nowDate = $db->quote(\JFactory::getDate()->toSql()); + $nowDate = $db->quote(Factory::getDate()->toSql()); $query->select( 'a.id as id,' @@ -184,7 +187,7 @@ protected function getListQuery() // Filter by language if ($this->getState('filter.language')) { - $query->where('a.language in (' . $db->quote(\JFactory::getLanguage()->getTag()) . ',' . $db->quote('*') . ')'); + $query->where('a.language in (' . $db->quote(Factory::getLanguage()->getTag()) . ',' . $db->quote('*') . ')'); } $query->order('a.sticky DESC,' . ($randomise ? $query->Rand() : 'a.ordering')); @@ -223,7 +226,7 @@ public function getItems() */ public function impress() { - $trackDate = \JFactory::getDate()->format('Y-m-d H'); + $trackDate = Factory::getDate()->format('Y-m-d H'); $items = $this->getItems(); $db = $this->getDbo(); $query = $db->getQuery(true); @@ -249,7 +252,7 @@ public function impress() { $db->execute(); } - catch (\JDatabaseExceptionExecuting $e) + catch (ExecutionFailureException $e) { throw new \Exception($e->getMessage(), 500); } @@ -287,7 +290,7 @@ public function impress() { $db->execute(); } - catch (\JDatabaseExceptionExecuting $e) + catch (ExecutionFailureException $e) { throw new \Exception($e->getMessage(), 500); } @@ -312,7 +315,7 @@ public function impress() { $db->execute(); } - catch (\JDatabaseExceptionExecuting $e) + catch (ExecutionFailureException $e) { throw new \Exception($e->getMessage(), 500); }