85 \
Magento\Backend\
App\ConfigInterface $backendConfig,
86 \
Magento\AdminNotification\Model\InboxFactory $inboxFactory,
92 \
Magento\Framework\Data\Collection\AbstractDb $resourceCollection =
null,
96 $this->_backendConfig = $backendConfig;
97 $this->_inboxFactory = $inboxFactory;
120 $httpPath = $this->_backendConfig->isSetFlag(self::XML_USE_HTTPS_PATH) ?
'https://' :
'http://';
121 if ($this->_feedUrl ===
null) {
122 $this->_feedUrl = $httpPath . $this->_backendConfig->getValue(self::XML_FEED_URL_PATH);
144 if ($feedXml && $feedXml->channel && $feedXml->channel->item) {
145 foreach ($feedXml->channel->item as
$item) {
146 $itemPublicationDate = strtotime((
string)
$item->pubDate);
147 if ($installDate <= $itemPublicationDate) {
149 'severity' => (int)
$item->severity,
150 'date_added' => date(
'Y-m-d H:i:s', $itemPublicationDate),
151 'title' => $this->escapeString(
$item->title),
152 'description' => $this->escapeString(
$item->description),
153 'url' => $this->escapeString(
$item->link),
159 $this->_inboxFactory->create()->parse(array_reverse($feedData));
174 return $this->_backendConfig->getValue(self::XML_FREQUENCY_PATH) * 3600;
184 return $this->_cacheManager->load(
'admin_notifications_lastcheck');
194 $this->_cacheManager->save(
time(),
'admin_notifications_lastcheck');
205 $curl = $this->curlFactory->create();
209 'useragent' => $this->productMetadata->getName()
210 .
'/' . $this->productMetadata->getVersion()
211 .
' (' . $this->productMetadata->getEdition() .
')',
212 'referer' => $this->urlBuilder->getUrl(
'*/*/*')
216 $data = $curl->read();
222 $xml = new \SimpleXMLElement(
$data);
223 }
catch (\Exception $e) {
239 $xml = new \SimpleXMLElement(
$data);
240 }
catch (\Exception $e) {
241 $xml = new \SimpleXMLElement(
'<?xml version="1.0" encoding="utf-8" ?>');
253 private function escapeString(\SimpleXMLElement
$data)
255 return htmlspecialchars((
string)
$data);
const CONFIG_PATH_INSTALL_DATE
__construct(\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Backend\App\ConfigInterface $backendConfig, \Magento\AdminNotification\Model\InboxFactory $inboxFactory, \Magento\Framework\HTTP\Adapter\CurlFactory $curlFactory, \Magento\Framework\App\DeploymentConfig $deploymentConfig, \Magento\Framework\App\ProductMetadataInterface $productMetadata, \Magento\Framework\UrlInterface $urlBuilder, \Magento\Framework\Model\ResourceModel\AbstractResource $resource=null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection=null, array $data=[])
const XML_LAST_UPDATE_PATH