当前位置: 首页>>代码示例>>PHP>>正文


PHP MauticFactory::getVersion方法代码示例

本文整理汇总了PHP中Mautic\CoreBundle\Factory\MauticFactory::getVersion方法的典型用法代码示例。如果您正苦于以下问题:PHP MauticFactory::getVersion方法的具体用法?PHP MauticFactory::getVersion怎么用?PHP MauticFactory::getVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mautic\CoreBundle\Factory\MauticFactory的用法示例。


在下文中一共展示了MauticFactory::getVersion方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: fetchData

 /**
  * Retrieves the update data from our home server
  *
  * @param bool $overrideCache
  *
  * @return array
  */
 public function fetchData($overrideCache = false)
 {
     $cacheFile = $this->factory->getSystemPath('cache') . '/lastUpdateCheck.txt';
     // Check if we have a cache file and try to return cached data if so
     if (!$overrideCache && is_readable($cacheFile)) {
         $update = (array) json_decode(file_get_contents($cacheFile));
         // Check if the user has changed the update channel, if so the cache is invalidated
         if ($update['stability'] == $this->factory->getParameter('update_stability')) {
             // If we're within the cache time, return the cached data
             if ($update['checkedTime'] > strtotime('-3 hours')) {
                 return $update;
             }
         }
     }
     // Before processing the update data, send up our metrics
     try {
         // Generate a unique instance ID for the site
         $instanceId = hash('sha1', $this->factory->getParameter('secret_key') . 'Mautic' . $this->factory->getParameter('db_driver'));
         $data = array('application' => 'Mautic', 'version' => $this->factory->getVersion(), 'phpVersion' => PHP_VERSION, 'dbDriver' => $this->factory->getParameter('db_driver'), 'serverOs' => php_uname('s') . ' ' . php_uname('r'), 'instanceId' => $instanceId, 'installSource' => $this->factory->getParameter('install_source', 'Mautic'));
         $this->connector->post('https://updates.mautic.org/stats/send', $data, array(), 10);
     } catch (\Exception $exception) {
         // Not so concerned about failures here, move along
     }
     // Get the update data
     try {
         $appData = array('appVersion' => $this->factory->getVersion(), 'phpVersion' => PHP_VERSION, 'stability' => $this->factory->getParameter('update_stability'));
         $data = $this->connector->post('https://updates.mautic.org/index.php?option=com_mauticdownload&task=checkUpdates', $appData, array(), 10);
         $update = json_decode($data->body);
     } catch (\Exception $exception) {
         // Log the error
         $logger = $this->factory->getLogger();
         $logger->addError('An error occurred while attempting to fetch updates: ' . $exception->getMessage());
         return array('error' => true, 'message' => 'mautic.core.updater.error.fetching.updates');
     }
     if ($data->code != 200) {
         // Log the error
         $logger = $this->factory->getLogger();
         $logger->addError(sprintf('An unexpected %1$s code was returned while attempting to fetch updates.  The message received was: %2$s', $data->code, is_string($data->body) ? $data->body : implode('; ', $data->body)));
         return array('error' => true, 'message' => 'mautic.core.updater.error.fetching.updates');
     }
     // If the user's up-to-date, go no further
     if ($update->latest_version) {
         return array('error' => false, 'message' => 'mautic.core.updater.running.latest.version');
     }
     // Last sanity check, if the $update->version is older than our current version
     if (version_compare($this->factory->getVersion(), $update->version, 'ge')) {
         return array('error' => false, 'message' => 'mautic.core.updater.running.latest.version');
     }
     // The user is able to update to the latest version, cache the data first
     $data = array('error' => false, 'message' => 'mautic.core.updater.update.available', 'version' => $update->version, 'announcement' => $update->announcement, 'package' => $update->package, 'checkedTime' => time(), 'stability' => $this->factory->getParameter('update_stability'));
     file_put_contents($cacheFile, json_encode($data));
     return $data;
 }
开发者ID:Yame-,项目名称:mautic,代码行数:60,代码来源:UpdateHelper.php

示例2: setFactory

 /**
  * @param MauticFactory $factory
  *
  * @return void
  */
 public function setFactory(MauticFactory $factory)
 {
     $this->factory = $factory;
     $this->version = $factory->getVersion();
 }
开发者ID:Jandersolutions,项目名称:mautic,代码行数:10,代码来源:AssetsHelper.php

示例3: __construct

 /**
  * @param MauticFactory $factory
  */
 public function __construct(MauticFactory $factory)
 {
     $this->factory = $factory;
     $this->version = $this->factory->getVersion();
 }
开发者ID:HomeRefill,项目名称:mautic,代码行数:8,代码来源:AssetGenerationHelper.php

示例4: __construct

 /**
  * @param MauticFactory $factory
  */
 public function __construct(MauticFactory $factory)
 {
     $this->dateHelper = $factory->getHelper('template.date');
     $this->version = $factory->getVersion();
 }
开发者ID:dongilbert,项目名称:mautic,代码行数:8,代码来源:FormatterHelper.php

示例5: __construct

 /**
  * @param MauticFactory $factory
  */
 public function __construct(MauticFactory $factory)
 {
     $this->factory = $factory;
     $this->version = substr(hash('sha1', $this->factory->getParameter('secret_key') . $this->factory->getVersion()), 0, 8);
 }
开发者ID:Yame-,项目名称:mautic,代码行数:8,代码来源:AssetGenerationHelper.php


注:本文中的Mautic\CoreBundle\Factory\MauticFactory::getVersion方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。