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


PHP civicrmVersion函数代码示例

本文整理汇总了PHP中civicrmVersion函数的典型用法代码示例。如果您正苦于以下问题:PHP civicrmVersion函数的具体用法?PHP civicrmVersion怎么用?PHP civicrmVersion使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: __construct

 /**
  * Class constructor.
  */
 public function __construct()
 {
     global $civicrm_root;
     $config = CRM_Core_Config::singleton();
     $localFile = $civicrm_root . DIRECTORY_SEPARATOR . self::LOCALFILE_NAME;
     $this->cacheFile = $config->uploadDir . self::CACHEFILE_NAME;
     if (file_exists($localFile)) {
         require_once $localFile;
     }
     if (function_exists('civicrmVersion')) {
         $info = civicrmVersion();
         $this->localVersion = trim($info['version']);
         $this->localMajorVersion = $this->getMajorVersion($this->localVersion);
     }
     // Populate $versionInfo
     if (Civi::settings()->get('versionCheck')) {
         // Use cached data if available and not stale
         if (!$this->readCacheFile()) {
             // Collect stats for pingback
             $this->getSiteStats();
             // Get the latest version and send site info
             $this->pingBack();
         }
         // Sort version info in ascending order for easier comparisons
         ksort($this->versionInfo, SORT_NUMERIC);
     }
 }
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:30,代码来源:VersionCheck.php

示例2: is_civi_newer

function is_civi_newer($version)
{
    $installedVersion = civicrmVersion();
    $installedVersion = $installedVersion['version'];
    list($installedMajor, $installedMinor, ) = explode('.', $installedVersion);
    list($major, $minor) = explode('.', $version);
    if ($installedMajor == $major) {
        return $installedMinor >= $minor;
    } else {
        if ($installedMajor > $major) {
            return true;
        } else {
            return false;
        }
    }
    return true;
}
开发者ID:Agares4,项目名称:info.agares.contactpcp,代码行数:17,代码来源:contactpcp.php

示例3: __construct

 /**
  * Class constructor
  *
  * @access private
  */
 function __construct()
 {
     global $civicrm_root;
     $config = CRM_Core_Config::singleton();
     $localfile = $civicrm_root . DIRECTORY_SEPARATOR . self::LOCALFILE_NAME;
     $cachefile = $config->uploadDir . self::CACHEFILE_NAME;
     if (file_exists($localfile)) {
         require_once $localfile;
         if (function_exists('civicrmVersion')) {
             $info = civicrmVersion();
             $this->localVersion = trim($info['version']);
         }
     }
     if ($config->versionCheck) {
         $expiryTime = time() - self::CACHEFILE_EXPIRE;
         // if there's a cachefile and it's not stale use it to
         // read the latestVersion, else read it from the Internet
         if (file_exists($cachefile) && filemtime($cachefile) > $expiryTime) {
             $this->latestVersion = trim(file_get_contents($cachefile));
         } else {
             $siteKey = md5(defined('CIVICRM_SITE_KEY') ? CIVICRM_SITE_KEY : '');
             $this->stats = array('hash' => md5($siteKey . $config->userFrameworkBaseURL), 'version' => $this->localVersion, 'uf' => $config->userFramework, 'lang' => $config->lcMessages, 'co' => $config->defaultContactCountry, 'ufv' => $config->userFrameworkVersion, 'PHP' => phpversion(), 'MySQL' => CRM_CORE_DAO::singleValueQuery('SELECT VERSION()'), 'communityMessagesUrl' => CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'communityMessagesUrl', NULL, '*default*'));
             // Add usage stats
             $this->payProcStats();
             $this->entityStats();
             $this->extensionStats();
             // Get the latest version and send site info
             $this->pingBack();
             // Update cache file
             if ($this->latestVersion) {
                 $fp = @fopen($cachefile, 'w');
                 if (!$fp) {
                     if (CRM_Core_Permission::check('administer CiviCRM')) {
                         CRM_Core_Session::setStatus(ts('Unable to write file') . ":{$cachefile}<br />" . ts('Please check your system file permissions.'), ts('File Error'), 'error');
                     }
                     return;
                 }
                 fwrite($fp, $this->latestVersion);
                 fclose($fp);
             }
         }
     }
 }
开发者ID:hguru,项目名称:224Civi,代码行数:48,代码来源:VersionCheck.php

示例4: ts

}
// Exit with error if CiviCRM has already been installed.
if ($alreadyInstalled) {
    $errorTitle = ts("Oops! CiviCRM is already installed");
    $settings_directory = $cmsPath;
    if ($installType == 'drupal') {
        $settings_directory = implode(CIVICRM_DIRECTORY_SEPARATOR, array(ts('[your Drupal root directory]'), 'sites', $siteDir));
    }
    $docLink = CRM_Utils_System::docURL2('Installation and Upgrades', FALSE, ts('Installation Guide'), NULL, NULL, "wiki");
    $errorMsg = ts("CiviCRM has already been installed. <ul><li>To <strong>start over</strong>, you must delete or rename the existing CiviCRM settings file - <strong>civicrm.settings.php</strong> - from <strong>%1</strong>.</li><li>To <strong>upgrade an existing installation</strong>, <a href='%2'>refer to the online documentation</a>.</li></ul>", array(1 => $settings_directory, 2 => $docLink));
    errorDisplayPage($errorTitle, $errorMsg, FALSE);
}
$versionFile = $crmPath . CIVICRM_DIRECTORY_SEPARATOR . 'civicrm-version.php';
if (file_exists($versionFile)) {
    require_once $versionFile;
    $civicrm_version = civicrmVersion();
} else {
    $civicrm_version = 'unknown';
}
if ($installType == 'drupal') {
    // Ensure that they have downloaded the correct version of CiviCRM
    if ($civicrm_version['cms'] != 'Drupal' && $civicrm_version['cms'] != 'Drupal6') {
        $errorTitle = ts("Oops! Incorrect CiviCRM version");
        $errorMsg = ts("This installer can only be used for the Drupal version of CiviCRM.");
        errorDisplayPage($errorTitle, $errorMsg);
    }
    define('DRUPAL_ROOT', $cmsPath);
    $drupalVersionFiles = array(implode(CIVICRM_DIRECTORY_SEPARATOR, array($cmsPath, 'modules', 'system', 'system.module')), implode(CIVICRM_DIRECTORY_SEPARATOR, array($cmsPath, 'includes', 'bootstrap.inc')));
    foreach ($drupalVersionFiles as $drupalVersionFile) {
        if (file_exists($drupalVersionFile)) {
            require_once $drupalVersionFile;
开发者ID:andrew-cormick-dockery,项目名称:civicrm-core,代码行数:31,代码来源:index.php

示例5: version

 /**
  * Return the running civicrm version.
  *
  * @return string
  *   civicrm version
  */
 public static function version()
 {
     static $version;
     if (!$version) {
         $verFile = implode(DIRECTORY_SEPARATOR, array(dirname(__FILE__), '..', '..', 'civicrm-version.php'));
         if (file_exists($verFile)) {
             require_once $verFile;
             if (function_exists('civicrmVersion')) {
                 $info = civicrmVersion();
                 $version = $info['version'];
             }
         } else {
             // svn installs don't have version.txt by default. In that case version.xml should help -
             $verFile = implode(DIRECTORY_SEPARATOR, array(dirname(__FILE__), '..', '..', 'xml', 'version.xml'));
             if (file_exists($verFile)) {
                 $str = file_get_contents($verFile);
                 $xmlObj = simplexml_load_string($str);
                 $version = (string) $xmlObj->version_no;
             }
         }
         // pattern check
         if (!CRM_Utils_System::isVersionFormatValid($version)) {
             CRM_Core_Error::fatal('Unknown codebase version.');
         }
     }
     return $version;
 }
开发者ID:rollox,项目名称:civicrm-core,代码行数:33,代码来源:System.php

示例6: __construct

 /**
  * Class constructor
  *
  * @access private
  */
 function __construct()
 {
     global $civicrm_root;
     $config = CRM_Core_Config::singleton();
     $localfile = $civicrm_root . DIRECTORY_SEPARATOR . self::LOCALFILE_NAME;
     $cachefile = $config->uploadDir . self::CACHEFILE_NAME;
     if ($config->versionCheck && file_exists($localfile)) {
         require_once $localfile;
         if (function_exists('civicrmVersion')) {
             $info = civicrmVersion();
             $this->localVersion = $info['version'];
         }
         $expiryTime = time() - self::CACHEFILE_EXPIRE;
         // if there's a cachefile and it's not stale use it to
         // read the latestVersion, else read it from the Internet
         if (file_exists($cachefile) and filemtime($cachefile) > $expiryTime) {
             $this->latestVersion = file_get_contents($cachefile);
         } else {
             // we have to set the error handling to a dummy function, otherwise
             // if the URL is not working (e.g., due to our server being down)
             // the users would be presented with an unsuppressable warning
             ini_set('default_socket_timeout', self::CHECK_TIMEOUT);
             set_error_handler(array('CRM_Utils_VersionCheck', 'downloadError'));
             $hash = md5($config->userFrameworkBaseURL);
             $url = self::LATEST_VERSION_AT . "?version={$this->localVersion}&uf={$config->userFramework}&hash={$hash}&lang={$config->lcMessages}&ufv={$config->userFrameworkVersion}";
             // add PHP and MySQL versions
             $dao = new CRM_Core_DAO();
             $dao->query('SELECT VERSION() AS version');
             $dao->fetch();
             $url .= '&MySQL=' . $dao->version . '&PHP=' . phpversion();
             $tables = array('CRM_Activity_DAO_Activity' => 'is_test = 0', 'CRM_Case_DAO_Case' => NULL, 'CRM_Contact_DAO_Contact' => NULL, 'CRM_Contact_DAO_Relationship' => NULL, 'CRM_Contribute_DAO_Contribution' => 'is_test = 0', 'CRM_Contribute_DAO_ContributionPage' => 'is_active = 1', 'CRM_Contribute_DAO_ContributionProduct' => NULL, 'CRM_Contribute_DAO_Widget' => 'is_active = 1', 'CRM_Core_DAO_Discount' => NULL, 'CRM_Price_DAO_SetEntity' => NULL, 'CRM_Core_DAO_UFGroup' => 'is_active = 1', 'CRM_Event_DAO_Event' => 'is_active = 1', 'CRM_Event_DAO_Participant' => 'is_test = 0', 'CRM_Friend_DAO_Friend' => 'is_active = 1', 'CRM_Grant_DAO_Grant' => NULL, 'CRM_Mailing_DAO_Mailing' => 'is_completed = 1', 'CRM_Member_DAO_Membership' => 'is_test = 0', 'CRM_Member_DAO_MembershipBlock' => 'is_active = 1', 'CRM_Pledge_DAO_Pledge' => 'is_test = 0', 'CRM_Pledge_DAO_PledgeBlock' => NULL);
             // add &key=count pairs to $url, where key is the last part of the DAO
             foreach ($tables as $daoName => $where) {
                 require_once str_replace('_', '/', $daoName) . '.php';
                 eval("\$dao = new {$daoName};");
                 if ($where) {
                     $dao->whereAdd($where);
                 }
                 $url .= '&' . array_pop(explode('_', $daoName)) . "={$dao->count()}";
             }
             // get active payment processor types
             $dao = new CRM_Core_DAO_PaymentProcessor();
             $dao->is_active = 1;
             $dao->find();
             $ppTypes = array();
             while ($dao->fetch()) {
                 $ppTypes[] = $dao->payment_processor_type;
             }
             // add the .-separated list of the processor types (urlencoded just in case)
             $url .= '&PPTypes=' . urlencode(implode('.', array_unique($ppTypes)));
             // get the latest version using the stats-carrying $url
             $this->latestVersion = file_get_contents($url);
             ini_restore('default_socket_timeout');
             restore_error_handler();
             if (!preg_match('/^\\d+\\.\\d+\\.\\d+$/', $this->latestVersion)) {
                 $this->latestVersion = NULL;
             }
             if (!$this->latestVersion) {
                 return;
             }
             $fp = @fopen($cachefile, 'w');
             if (!$fp) {
                 $message = ts('Do not have permission to write to file: %1', array(1 => $cachefile));
                 CRM_Core_Session::setStatus($message);
                 return;
             }
             fwrite($fp, $this->latestVersion);
             fclose($fp);
         }
     }
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:76,代码来源:VersionCheck.php


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