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


PHP PhabricatorEnv::getRequiredClasses方法代码示例

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


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

示例1: runSetup


//.........这里部分代码省略.........
     self::write("[OKAY] Database and storage configuration OKAY\n");
     self::writeHeader("OUTBOUND EMAIL CONFIGURATION");
     $have_adapter = false;
     $is_ses = false;
     $adapter = PhabricatorEnv::getEnvConfig('metamta.mail-adapter');
     switch ($adapter) {
         case 'PhabricatorMailImplementationPHPMailerLiteAdapter':
             $have_adapter = true;
             if (!Filesystem::pathExists('/usr/bin/sendmail') && !Filesystem::pathExists('/usr/sbin/sendmail')) {
                 self::writeFailure();
                 self::write("Setup failure! You don't have a 'sendmail' binary on this system " . "but outbound email is configured to use sendmail. Install an MTA " . "(like sendmail, qmail or postfix) or use a different outbound " . "mail configuration. See this guide for configuring outbound " . "email:\n");
                 self::writeDoc('article/Configuring_Outbound_Email.html');
                 return;
             } else {
                 self::write(" okay  Sendmail is configured.\n");
             }
             break;
         case 'PhabricatorMailImplementationAmazonSESAdapter':
             $is_ses = true;
             $have_adapter = true;
             if (PhabricatorEnv::getEnvConfig('metamta.can-send-as-user')) {
                 self::writeFailure();
                 self::write("Setup failure! 'metamta.can-send-as-user' must be false when " . "configured with Amazon SES.");
                 return;
             } else {
                 self::write(" okay  Sender config looks okay.\n");
             }
             if (!PhabricatorEnv::getEnvConfig('amazon-ses.access-key')) {
                 self::writeFailure();
                 self::write("Setup failure! 'amazon-ses.access-key' is not set, but " . "outbound mail is configured to deliver via Amazon SES.");
                 return;
             } else {
                 self::write(" okay Amazon SES access key is set.\n");
             }
             if (!PhabricatorEnv::getEnvConfig('amazon-ses.secret-key')) {
                 self::writeFailure();
                 self::write("Setup failure! 'amazon-ses.secret-key' is not set, but " . "outbound mail is configured to deliver via Amazon SES.");
                 return;
             } else {
                 self::write(" okay Amazon SES secret key is set.\n");
             }
             if (PhabricatorEnv::getEnvConfig('metamta.send-immediately')) {
                 self::writeNote("Your configuration uses Amazon SES to deliver email but tries " . "to send it immediately. This will work, but it's slow. " . "Consider configuring the MetaMTA daemon.");
             }
             break;
         case 'PhabricatorMailImplementationTestAdapter':
             self::write(" skip  You have disabled outbound email.\n");
             break;
         default:
             self::write(" skip  Configured with a custom adapter.\n");
             break;
     }
     if ($have_adapter) {
         $default = PhabricatorEnv::getEnvConfig('metamta.default-address');
         if (!$default || $default == 'noreply@example.com') {
             self::writeFailure();
             self::write("Setup failure! You have not set 'metamta.default-address'.");
             return;
         } else {
             self::write(" okay  metamta.default-address is set.\n");
         }
         if ($is_ses) {
             self::writeNote("Make sure you've verified your 'from' address ('{$default}') with " . "Amazon SES. Until you verify it, you will be unable to send mail " . "using Amazon SES.");
         }
         $domain = PhabricatorEnv::getEnvConfig('metamta.domain');
         if (!$domain || $domain == 'example.com') {
             self::writeFailure();
             self::write("Setup failure! You have not set 'metamta.domain'.");
             return;
         } else {
             self::write(" okay  metamta.domain is set.\n");
         }
         self::write("[OKAY] Mail configuration OKAY\n");
     }
     self::writeHeader('CONFIG CLASSES');
     foreach (PhabricatorEnv::getRequiredClasses() as $key => $instanceof) {
         $config = PhabricatorEnv::getEnvConfig($key);
         if (!$config) {
             self::writeNote("'{$key}' is not set.");
         } else {
             try {
                 $r = new ReflectionClass($config);
                 if (!$r->isSubclassOf($instanceof)) {
                     throw new Exception("Config setting '{$key}' must be an instance of '{$instanceof}'.");
                 } else {
                     if (!$r->isInstantiable()) {
                         throw new Exception("Config setting '{$key}' must be instantiable.");
                     }
                 }
             } catch (Exception $ex) {
                 self::writeFailure();
                 self::write("Setup failure! " . $ex->getMessage());
                 return;
             }
         }
     }
     self::write("[OKAY] Config classes OKAY\n");
     self::writeHeader('SUCCESS!');
     self::write("Congratulations! Your setup seems mostly correct, or at least fairly " . "reasonable.\n\n" . "*** NEXT STEP ***\n" . "Edit your configuration file (conf/{$env}.conf.php) and remove the " . "'phabricator.setup' line to finish installation.");
 }
开发者ID:rudimk,项目名称:phabricator,代码行数:101,代码来源:PhabricatorSetup.php


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