• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
WordPress a2z

WordPress a2z

WordPress Dynamic API Reference

  • Home
  • Plugins
  • Themes
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / Akismet_Admin::check_server_connectivity() –

You appear to be a bot. Output may be restricted

Description

Usage

Akismet_Admin::check_server_connectivity( $cache_timeout );

Parameters

$cache_timeout
( mixed ) optional default: 86400 –

Returns

void

Source

File name: akismet/class.akismet-admin.php
Lines:

1 to 35 of 35
  public static function check_server_connectivity($cache_timeout = 86400) {
    
    $debug = array();
    $debug[ 'PHP_VERSION' ]         = PHP_VERSION;
    $debug[ 'WORDPRESS_VERSION' ]   = $GLOBALS['wp_version'];
    $debug[ 'AKISMET_VERSION' ]     = AKISMET_VERSION;
    $debug[ 'AKISMET__PLUGIN_DIR' ] = AKISMET__PLUGIN_DIR;
    $debug[ 'SITE_URL' ]            = site_url();
    $debug[ 'HOME_URL' ]            = home_url();
    
    $servers = get_option('akismet_available_servers');
    if ( (time() - get_option('akismet_connectivity_time') < $cache_timeout) && $servers !== false ) {
      $servers = self::check_server_ip_connectivity();
      update_option('akismet_available_servers', $servers);
      update_option('akismet_connectivity_time', time());
    }

    if ( wp_http_supports( array( 'ssl' ) ) ) {
      $response = wp_remote_get( 'https://rest.akismet.com/1.1/test' );
    }
    else {
      $response = wp_remote_get( 'http://rest.akismet.com/1.1/test' );
    }

    $debug[ 'gethostbynamel' ]  = function_exists('gethostbynamel') ? 'exists' : 'not here';
    $debug[ 'Servers' ]         = $servers;
    $debug[ 'Test Connection' ] = $response;
    
    Akismet::log( $debug );
    
    if ( $response && 'connected' == wp_remote_retrieve_body( $response ) )
      return true;
    
    return false;
  }
 

 View on GitHub View on Trac

Published: 19th December 2019 | Last updated: 19th December 2019

Primary Sidebar

Information

Function name: Akismet_Admin::check_server_connectivity
Class ref: Akismet_Admin
Plugin ref: Akismet
Version: 5.0.1
Sourcefile: class.akismet-admin.php
File ref: class.akismet-admin.php
Deprecated?: No
API Letters: A,C,S

Footer

WordPress a2z
WordPress a2z
WordPress Dynamic API Reference
WordPress 6.1.1. PHP: 8.0.27
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  wp-a2z.org
© Copyright WordPress a2z 2014-2023. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins

  • Home
  • Blog
  • Sitemap
  • Sites