當前位置: 首頁>>代碼示例>>PHP>>正文


PHP IPSDebug::getServerLoad方法代碼示例

本文整理匯總了PHP中IPSDebug::getServerLoad方法的典型用法代碼示例。如果您正苦於以下問題:PHP IPSDebug::getServerLoad方法的具體用法?PHP IPSDebug::getServerLoad怎麽用?PHP IPSDebug::getServerLoad使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在IPSDebug的用法示例。


在下文中一共展示了IPSDebug::getServerLoad方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: init


//.........這裏部分代碼省略.........
             /* Are we banned: Via IP Address? */
             if (IPSMember::isBanned('ipAddress', self::$handles['member']->ip_address) === TRUE) {
                 self::instance()->getClass('output')->showError('you_are_banned', 2000, true, null, 403);
             }
             /* Are we banned: By DB */
             if (self::$handles['member']->getProperty('member_banned') == 1 or self::$handles['member']->getProperty('temp_ban')) {
                 /* Don't show this message if we're viewing the warn log */
                 if (ipsRegistry::$request['module'] != 'ajax' or ipsRegistry::$request['section'] != 'warnings') {
                     self::getClass('class_localization')->loadLanguageFile('public_error', 'core');
                     $message = '';
                     if (self::$handles['member']->getProperty('member_banned')) {
                         $message = self::getClass('class_localization')->words['no_view_board_b'];
                     } else {
                         $ban_arr = IPSMember::processBanEntry(self::$handles['member']->getProperty('temp_ban'));
                         /* No longer banned */
                         if (time() >= $ban_arr['date_end']) {
                             self::DB()->update('members', array('temp_ban' => ''), 'member_id=' . self::$handles['member']->getProperty('member_id'));
                         } else {
                             $message = sprintf(self::getClass('class_localization')->words['account_susp'], self::getClass('class_localization')->getDate($ban_arr['date_end'], 'LONG', 1));
                         }
                     }
                     /* Get anything? */
                     if ($message) {
                         $warn = ipsRegistry::DB()->buildAndFetch(array('select' => '*', 'from' => 'members_warn_logs', 'where' => 'wl_member=' . self::$handles['member']->getProperty('member_id') . ' AND wl_suspend<>0 AND wl_suspend<>-2', 'order' => 'wl_date DESC', 'limit' => 1));
                         if ($warn['wl_id'] and ipsRegistry::$settings['warn_show_own']) {
                             $moredetails = "<a href='javascript:void(0);' onclick='warningPopup( this, {$warn['wl_id']} );'>" . self::getClass('class_localization')->words['warnings_moreinfo'] . "</a>";
                         }
                         self::instance()->getClass('output')->showError("{$message} {$moredetails}", 1001, true, null, 403);
                     }
                 }
             }
             /* Check server load */
             if (ipsRegistry::$settings['load_limit'] > 0) {
                 $server_load = IPSDebug::getServerLoad();
                 if ($server_load) {
                     $loadinfo = explode("-", $server_load);
                     if (count($loadinfo)) {
                         self::$server_load = $loadinfo[0];
                         if (self::$server_load > ipsRegistry::$settings['load_limit']) {
                             self::instance()->getClass('output')->showError('server_too_busy', 2001);
                         }
                     }
                 }
             }
             /* Specific Ajax Check */
             if (IPS_IS_AJAX and ipsRegistry::$request['section'] != 'warnings') {
                 if (self::$handles['member']->getProperty('g_view_board') != 1 || ipsRegistry::$settings['board_offline'] && !self::$handles['member']->getProperty('g_access_offline')) {
                     @header("Content-type: application/json;charset=" . IPS_DOC_CHAR_SET);
                     print json_encode(array('error' => 'no_permission', '__board_offline__' => 1));
                     exit;
                 }
             }
             /* Other public check */
             if (IPB_THIS_SCRIPT == 'public' and IPS_ENFORCE_ACCESS === FALSE and (ipsRegistry::$request['section'] != 'login' and ipsRegistry::$request['section'] != 'lostpass' and IPS_IS_AJAX === FALSE and ipsRegistry::$request['section'] != 'rss' and ipsRegistry::$request['section'] != 'attach' and ipsRegistry::$request['module'] != 'task' and ipsRegistry::$request['section'] != 'captcha')) {
                 //-----------------------------------------
                 // Permission to see the board?
                 //-----------------------------------------
                 if (self::$handles['member']->getProperty('g_view_board') != 1) {
                     self::getClass('output')->showError('no_view_board', 1000, null, null, 403);
                 }
                 //--------------------------------
                 //  Is the board offline?
                 //--------------------------------
                 if (ipsRegistry::$settings['board_offline'] == 1 and !IPS_IS_SHELL) {
                     if (self::$handles['member']->getProperty('g_access_offline') != 1) {
                         ipsRegistry::$settings['no_reg'] = 1;
開發者ID:ConnorChristie,項目名稱:GrabViews,代碼行數:67,代碼來源:ipsRegistry.php

示例2: _listFunctions

 /**
  * Show the overview page
  *
  * @return	@e void		[Outputs to screen]
  */
 public function _listFunctions()
 {
     //-----------------------------------------
     // PHP INFO?
     //-----------------------------------------
     if ($this->request['phpinfo'] and $this->request['phpinfo']) {
         @ob_start();
         phpinfo();
         $parsed = @ob_get_contents();
         @ob_end_clean();
         preg_match("#<body>(.*)</body>#is", $parsed, $match1);
         $php_body = $match1[1];
         # PREVENT WRAP: Most cookies
         $php_body = str_replace("; ", ";<br />", $php_body);
         # PREVENT WRAP: Very long string cookies
         $php_body = str_replace("%3B", "<br />", $php_body);
         # PREVENT WRAP: Serialized array string cookies
         $php_body = str_replace(";i:", ";<br />i:", $php_body);
         # PREVENT WRAP: LS_COLORS env
         $php_body = str_replace(":*.", "<br />:*.", $php_body);
         # PREVENT WRAP: PATH env
         $php_body = str_replace("bin:/", "bin<br />:/", $php_body);
         # PREVENT WRAP: Cookie %2C split
         $php_body = str_replace("%2C", "%2C<br />", $php_body);
         #PREVENT WRAP: Cookie , split
         $php_body = preg_replace("#,(\\d+),#", ",<br />\\1,", $php_body);
         $this->registry->output->html .= $this->html->phpInfo($php_body);
         return;
     }
     //-----------------------------------------
     // Stats
     //-----------------------------------------
     $reg = $this->DB->buildAndFetch(array('select' => 'COUNT(*) as reg', 'from' => array('validating' => 'v'), 'where' => 'v.lost_pass <> 1 AND m.member_group_id=' . $this->settings['auth_group'], 'add_join' => array(array('from' => array('members' => 'm'), 'where' => 'm.member_id=v.member_id', 'type' => 'left'))));
     if ($this->settings['ipb_bruteforce_attempts']) {
         $lock = $this->DB->buildAndFetch(array('select' => 'COUNT(*) as mems', 'from' => 'members', 'where' => 'failed_login_count >= ' . $this->settings['ipb_bruteforce_attempts']));
     }
     $my_timestamp = time() - $this->settings['au_cutoff'] * 60;
     $online = $this->DB->buildAndFetch(array('select' => 'COUNT(*) as sessions', 'from' => 'sessions', 'where' => 'running_time>' . $my_timestamp));
     $pending = $this->DB->buildAndFetch(array('select' => 'SUM(queued_topics) as topics, SUM(queued_posts) as posts', 'from' => 'forums'));
     $spammers = $this->DB->buildAndFetch(array('select' => 'COUNT(*) as count', 'from' => 'members', 'where' => "members_bitoptions = '1'"));
     $statsbox = $this->html->acp_stats_wrapper(array('topics' => ipsRegistry::getClass('class_localization')->formatNumber($this->caches['stats']['total_topics']), 'replies' => ipsRegistry::getClass('class_localization')->formatNumber($this->caches['stats']['total_replies']), 'topics_mod' => ipsRegistry::getClass('class_localization')->formatNumber($pending['topics']), 'posts_mod' => ipsRegistry::getClass('class_localization')->formatNumber($pending['posts']), 'members' => ipsRegistry::getClass('class_localization')->formatNumber($this->caches['stats']['mem_count']), 'validate' => ipsRegistry::getClass('class_localization')->formatNumber($reg['reg']), 'spammer' => ipsRegistry::getClass('class_localization')->formatNumber($spammers['count']), 'locked' => ipsRegistry::getClass('class_localization')->formatNumber($lock['mems']), 'sql_driver' => strtoupper(SQL_DRIVER), 'sql_version' => $this->DB->true_version, 'php_version' => phpversion(), 'sessions' => ipsRegistry::getClass('class_localization')->formatNumber($online['sessions']), 'php_sapi' => @php_sapi_name(), 'ipb_version' => ipsRegistry::$version, 'ipb_id' => ipsRegistry::$vn_full));
     //-----------------------------------------
     // Server stuff
     //-----------------------------------------
     $this->DB->getSqlVersion();
     $sql_version = strtoupper($this->settings['sql_driver']) . " " . $this->DB->true_version;
     $php_version = phpversion() . " (" . @php_sapi_name() . ")  ( <a href='{$this->settings['base_url']}{$this->form_code}&amp;phpinfo=1'>{$this->lang->words['d_aphpinfo']}</a> )";
     $server_software = @php_uname();
     $load_limit = IPSDebug::getServerLoad();
     $server_load_found = 0;
     $total_memory = "--";
     $avail_memory = "--";
     $_disabled = @ini_get('disable_functions') ? explode(',', @ini_get('disable_functions')) : array();
     $_shellExecAvail = in_array('shell_exec', $_disabled) ? false : true;
     //-----------------------------------------
     // Check memory
     //-----------------------------------------
     if (strpos(strtolower(PHP_OS), 'win') === 0) {
         $mem = $_shellExecAvail ? @shell_exec('systeminfo') : null;
         if ($mem) {
             $server_reply = explode("\n", str_replace("\r", "", $mem));
             if (count($server_reply)) {
                 foreach ($server_reply as $info) {
                     if (strstr($info, $this->lang->words['d_atotal'])) {
                         $total_memory = trim(str_replace(":", "", strrchr($info, ":")));
                     }
                     if (strstr($info, $this->lang->words['d_aavail'])) {
                         $avail_memory = trim(str_replace(":", "", strrchr($info, ":")));
                     }
                 }
             }
         }
     } else {
         $mem = $_shellExecAvail ? @shell_exec("free -m") : null;
         if ($mem) {
             $server_reply = explode("\n", str_replace("\r", "", $mem));
             $mem = array_slice($server_reply, 1, 1);
             $mem = preg_split("#\\s+#", $mem[0]);
             $total_memory = $mem[1] ? $mem[1] . ' MB' : '--';
             $avail_memory = $mem[3] ? $mem[3] . ' MB' : '--';
         } else {
             $total_memory = '--';
             $avail_memory = '--';
         }
     }
     $disabled_functions = is_array($_disabled) && count($_disabled) ? implode(', ', $_disabled) : $this->lang->words['d_anoinfo'];
     $extensions = get_loaded_extensions();
     $extensions = array_combine($extensions, $extensions);
     sort($extensions, SORT_STRING);
     //-----------------------------------------
     // Set variables and pass to skin
     //-----------------------------------------
     $data = array('version' => 'v' . IPB_VERSION, 'version_full' => IPB_LONG_VERSION, 'version_sql' => $sql_version, 'driver_type' => strtoupper($this->settings['sql_driver']), 'version_php' => $php_version, 'disabled' => $disabled_functions, 'extensions' => str_replace("suhosin", "<strong>suhosin</strong>", implode(", ", $extensions)), 'safe_mode' => SAFE_MODE_ON == 1 ? "<span style='color:red;font-weight:bold;'>{$this->lang->words['d_aon']}</span>" : "<span style='color:green;font-weight:bold;'>{$this->lang->words['d_aoff']}</span>", 'server' => $server_software, 'load' => $load_limit, 'total_memory' => $total_memory, 'avail_memory' => $avail_memory);
     if ($_shellExecAvail) {
         if (strpos(strtolower(PHP_OS), 'win') === 0) {
//.........這裏部分代碼省略.........
開發者ID:ConnorChristie,項目名稱:GrabViews-Live,代碼行數:101,代碼來源:diagnostics.php

示例3: _listFunctions

 /**
  * Show the overview page
  *
  * @access	private
  * @return	void		[Outputs to screen]
  */
 private function _listFunctions()
 {
     //-----------------------------------------
     // PHP INFO?
     //-----------------------------------------
     if ($this->request['phpinfo'] and $this->request['phpinfo']) {
         @ob_start();
         phpinfo();
         $parsed = @ob_get_contents();
         @ob_end_clean();
         preg_match("#<body>(.*)</body>#is", $parsed, $match1);
         $php_body = $match1[1];
         # PREVENT WRAP: Most cookies
         $php_body = str_replace("; ", ";<br />", $php_body);
         # PREVENT WRAP: Very long string cookies
         $php_body = str_replace("%3B", "<br />", $php_body);
         # PREVENT WRAP: Serialized array string cookies
         $php_body = str_replace(";i:", ";<br />i:", $php_body);
         # PREVENT WRAP: LS_COLORS env
         $php_body = str_replace(":*.", "<br />:*.", $php_body);
         # PREVENT WRAP: PATH env
         $php_body = str_replace("bin:/", "bin<br />:/", $php_body);
         # PREVENT WRAP: Cookie %2C split
         $php_body = str_replace("%2C", "%2C<br />", $php_body);
         #PREVENT WRAP: Cookie , split
         $php_body = preg_replace("#,(\\d+),#", ",<br />\\1,", $php_body);
         $this->registry->output->html = $this->html->phpInfo($php_body);
         return;
     }
     //-----------------------------------------
     // Server stuff
     //-----------------------------------------
     $this->DB->getSqlVersion();
     $sql_version = strtoupper($this->settings['sql_driver']) . " " . $this->DB->true_version;
     $php_version = phpversion() . " (" . @php_sapi_name() . ")  ( <a href='{$this->settings['base_url']}{$this->form_code}&amp;phpinfo=1'>{$this->lang->words['d_aphpinfo']}</a> )";
     $server_software = @php_uname();
     $load_limit = IPSDebug::getServerLoad();
     $server_load_found = 0;
     $total_memory = "--";
     $avail_memory = "--";
     //-----------------------------------------
     // Check memory
     //-----------------------------------------
     if (strpos(strtolower(PHP_OS), 'win') === 0) {
         $mem = @shell_exec('systeminfo');
         if ($mem) {
             $server_reply = explode("\n", str_replace("\r", "", $mem));
             if (count($server_reply)) {
                 foreach ($server_reply as $info) {
                     if (strstr($info, $this->lang->words['d_atotal'])) {
                         $total_memory = trim(str_replace(":", "", strrchr($info, ":")));
                     }
                     if (strstr($info, $this->lang->words['d_aavail'])) {
                         $avail_memory = trim(str_replace(":", "", strrchr($info, ":")));
                     }
                 }
             }
         }
     } else {
         $mem = @shell_exec("free -m");
         $server_reply = explode("\n", str_replace("\r", "", $mem));
         $mem = array_slice($server_reply, 1, 1);
         $mem = preg_split("#\\s+#", $mem[0]);
         $total_memory = $mem[1] ? $mem[1] . ' MB' : '--';
         $avail_memory = $mem[3] ? $mem[3] . ' MB' : '--';
     }
     $disabled_functions = @ini_get('disable_functions') ? str_replace(",", ", ", @ini_get('disable_functions')) : $this->lang->words['d_anoinfo'];
     $extensions = get_loaded_extensions();
     $extensions = array_combine($extensions, $extensions);
     sort($extensions, SORT_STRING);
     //-----------------------------------------
     // Upgrade history?
     //-----------------------------------------
     $upgrade_history = array();
     $latest_version = array('upgrade_version_id' => NULL);
     $this->DB->build(array('select' => '*', 'from' => 'upgrade_history', 'where' => "upgrade_app='core'", 'order' => 'upgrade_version_id DESC', 'limit' => array(0, 5)));
     $this->DB->execute();
     while ($r = $this->DB->fetch()) {
         if ($r['upgrade_version_id'] > $latest_version['upgrade_version_id']) {
             $latest_version = $r;
         }
         $upgrade_history[] = $r;
     }
     //-----------------------------------------
     // Got real version number?
     //-----------------------------------------
     $version['version'] = IPB_VERSION == '3.0.0 RC 1' ? $latest_version['upgrade_version_human'] : IPB_VERSION;
     $version['version_full'] = IPB_LONG_VERSION == '30005' ? $latest_version['upgrade_version_id'] : IPB_LONG_VERSION;
     //-----------------------------------------
     // Version History
     //-----------------------------------------
     foreach ($upgrade_history as $r) {
         $r['_date'] = ipsRegistry::getClass('class_localization')->getDate($r['upgrade_date'], 'SHORT');
         $thiscontent .= $this->html->acp_version_history_row($r);
//.........這裏部分代碼省略.........
開發者ID:dalandis,項目名稱:Visualization-of-Cell-Phone-Locations,代碼行數:101,代碼來源:diagnostics.php


注:本文中的IPSDebug::getServerLoad方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。