public static function extensions($names)
 {
     $missing = array();
     foreach ($names as $name) {
         if (!extension_loaded($name)) {
             $missing[] = $name;
         }
     }
     if (count($missing) > 0) {
         throw new Exception(Log::err(sprintf("Missing required extension(s): %s", Strings::format($missing))));
     }
 }
示例#2
0
 private static function regionName($regionIndex)
 {
     $html = "<span class='m-wrap'>{{name}}</span>";
     $region = SysRegion::findFirst("sys_region_index={$regionIndex}");
     $regionName = '';
     if ($region) {
         $regionName = $region->sys_region_name;
     }
     return Strings::format($html, array('name' => $regionName));
 }
 private static function prepareNetworkmap($networkmap)
 {
     $sourceKey = Strings::format($networkmap->getSourceNames());
     if (!isset(self::$sNetworkmapIndex[$sourceKey])) {
         foreach ($networkmap->getNetworks() as $network) {
             $networkName = $network->getName();
             $networkType = $network->getType();
             switch ($networkType) {
                 case MonitorNetwork::TYPE_INET:
                 case MonitorNetwork::TYPE_INET6:
                     self::prepareNetworkmapInet($sourceKey, $network);
                     break;
                 case MonitorNetwork::TYPE_IFCONFIG:
                     self::prepareNetworkmapIfconfig($sourceKey, $network);
                     break;
                 default:
                     throw new Exception(Log::err("Unknown network type '{$networkType}' for network '{$networkName}'"));
             }
         }
     }
 }