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


PHP ZPush::policies方法代码示例

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


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

示例1: CheckConfig

 /**
  * Verifies configuration
  *
  * @access public
  * @return boolean
  * @throws FatalMisconfigurationException
  */
 public static function CheckConfig()
 {
     // check the php version
     if (version_compare(phpversion(), '5.4.0') < 0) {
         throw new FatalException("The configured PHP version is too old. Please make sure at least PHP 5.4 is used.");
     }
     // some basic checks
     if (!defined('BASE_PATH')) {
         throw new FatalMisconfigurationException("The BASE_PATH is not configured. Check if the config.php file is in place.");
     }
     if (substr(BASE_PATH, -1, 1) != "/") {
         throw new FatalMisconfigurationException("The BASE_PATH should terminate with a '/'");
     }
     if (!file_exists(BASE_PATH)) {
         throw new FatalMisconfigurationException("The configured BASE_PATH does not exist or can not be accessed.");
     }
     if (defined('BASE_PATH_CLI') && file_exists(BASE_PATH_CLI)) {
         define('REAL_BASE_PATH', BASE_PATH_CLI);
     } else {
         define('REAL_BASE_PATH', BASE_PATH);
     }
     if (!defined('LOGBACKEND')) {
         define('LOGBACKEND', 'filelog');
     }
     if (strtolower(LOGBACKEND) == 'syslog') {
         define('LOGBACKEND_CLASS', 'Syslog');
         if (!defined('LOG_SYSLOG_FACILITY')) {
             define('LOG_SYSLOG_FACILITY', LOG_LOCAL0);
         }
         if (!defined('LOG_SYSLOG_HOST')) {
             define('LOG_SYSLOG_HOST', false);
         }
         if (!defined('LOG_SYSLOG_PORT')) {
             define('LOG_SYSLOG_PORT', 514);
         }
         if (!defined('LOG_SYSLOG_PROGRAM')) {
             define('LOG_SYSLOG_PROGRAM', 'z-push');
         }
         if (!is_numeric(LOG_SYSLOG_PORT)) {
             throw new FatalMisconfigurationException("The LOG_SYSLOG_PORT must a be a number.");
         }
         if (LOG_SYSLOG_HOST && LOG_SYSLOG_PORT <= 0) {
             throw new FatalMisconfigurationException("LOG_SYSLOG_HOST is defined but the LOG_SYSLOG_PORT does not seem to be valid.");
         }
     } elseif (strtolower(LOGBACKEND) == 'filelog') {
         define('LOGBACKEND_CLASS', 'FileLog');
         if (!defined('LOGFILEDIR')) {
             throw new FatalMisconfigurationException("The LOGFILEDIR is not configured. Check if the config.php file is in place.");
         }
         if (substr(LOGFILEDIR, -1, 1) != "/") {
             throw new FatalMisconfigurationException("The LOGFILEDIR should terminate with a '/'");
         }
         if (!file_exists(LOGFILEDIR)) {
             throw new FatalMisconfigurationException("The configured LOGFILEDIR does not exist or can not be accessed.");
         }
         if (!file_exists(LOGFILE) && !touch(LOGFILE) || !is_writable(LOGFILE)) {
             throw new FatalMisconfigurationException("The configured LOGFILE can not be modified.");
         }
         if (!file_exists(LOGERRORFILE) && !touch(LOGERRORFILE) || !is_writable(LOGERRORFILE)) {
             throw new FatalMisconfigurationException("The configured LOGERRORFILE can not be modified.");
         }
         // check ownership on the (eventually) just created files
         Utils::FixFileOwner(LOGFILE);
         Utils::FixFileOwner(LOGERRORFILE);
     } else {
         define('LOGBACKEND_CLASS', LOGBACKEND);
     }
     // set time zone
     // code contributed by Robert Scheck (rsc)
     if (defined('TIMEZONE') ? constant('TIMEZONE') : false) {
         if (!@date_default_timezone_set(TIMEZONE)) {
             throw new FatalMisconfigurationException(sprintf("The configured TIMEZONE '%s' is not valid. Please check supported timezones at http://www.php.net/manual/en/timezones.php", constant('TIMEZONE')));
         }
     } else {
         if (!ini_get('date.timezone')) {
             date_default_timezone_set('Europe/Amsterdam');
         }
     }
     // check if Provisioning is enabled and the default policies are available
     if (PROVISIONING) {
         if (file_exists(REAL_BASE_PATH . PROVISIONING_POLICYFILE)) {
             $policyfile = REAL_BASE_PATH . PROVISIONING_POLICYFILE;
         } else {
             $policyfile = PROVISIONING_POLICYFILE;
         }
         ZPush::$policies = parse_ini_file($policyfile, true);
         if (!isset(ZPush::$policies['default'])) {
             throw new FatalMisconfigurationException(sprintf("Your policies' configuration file doesn't contain the required [default] section. Please check the '%s' file.", $policyfile));
         }
     }
     return true;
 }
开发者ID:EGroupware,项目名称:z-push,代码行数:99,代码来源:zpush.php


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