Esempio n. 1
0
 /**
  * Build the Server Matrix
  *
  * @return array
  */
 public function build()
 {
     $self = ['alias' => getServerAlias(), 'url' => getServerUrl(), 'type' => getServerType()];
     $servers = [];
     if (hasSlaves()) {
         $servers['servers'] = [];
         foreach (getSlaves() as $slave) {
             $servers['servers'][] = $this->getSlaveInformations($slave);
         }
     }
     return array_merge($self, $servers);
 }
Esempio n. 2
0
<?php

chdir(__DIR__);
ini_set('default_charset', 'UTF-8');
ini_set('display_errors', '1');
# bootstrap for the example directory
require 'bootstrap.php';
# get the url of the server script
$url = getServerUrl();
# create our client object, passing it the server url
$Client = new JsonRpc\Client($url);
# set up our rpc call with a method and params
$method = 'divide';
$params = array(42, 6);
$success = false;
$success = $Client->call($method, $params);
/*
# notify
$success = $Client->notify($method);
*/
/*
# batch sending
$Client->batchOpen();
$Client->call($method, $params);
$Client->notify($method, $params);
$Client->call($method, $params);
$Client->notify($method, $params);
$Client->call($method, $params);
$success = $Client->batchSend();
*/
echo '<form method="GET">';
Esempio n. 3
0
        if (DEBUG_COOKIE) {
            $firephp->dump('COOKIE', $_COOKIE);
        }
        if (DEBUG_SERVER) {
            $firephp->dump('SERVER', $_SERVER);
        }
        if (DEBUG_CONST) {
            $tab_constantes = get_defined_constants(TRUE);
            $firephp->dump('CONSTANTES', $tab_constantes['user']);
        }
    }
}
// ============================================================================
// URL de base du serveur
// ============================================================================
$host = getServerUrl();
define('HOST', $host);
define('URL_BASE', getServerProtocole() . $host . getServerPort($host));
// ============================================================================
// Type de serveur (LOCAL|DEV|PROD)
// ============================================================================
// On ne peut pas savoir avec certitude si un serveur est "local" car aucune méthode ne fonctionne à tous les coups :
// - $_SERVER['HTTP_HOST'] peut ne pas renvoyer localhost sur un serveur local (si configuration de domaines locaux via fichiers hosts / httpd.conf par exemple).
// - gethostbyname($_SERVER['HTTP_HOST']) peut renvoyer "127.0.0.1" sur un serveur non local car un serveur a en général 2 ip (une publique - ou privée s'il est sur un lan - et une locale).
// - $_SERVER['SERVER_ADDR'] peut renvoyer "127.0.0.1" avec nginx + apache sur 127.0.0.1 ...
if (mb_strpos(URL_BASE, 'localhost') || mb_strpos(URL_BASE, '127.0.0.1') || mb_strpos(URL_BASE, '.local')) {
    $serveur_type = 'LOCAL';
} elseif (mb_strpos(URL_BASE, '.sesamath.net:8080') || mb_strpos(URL_BASE, '.sesamath.net:8443')) {
    $serveur_type = 'DEV';
} else {
    $serveur_type = 'PROD';
Esempio n. 4
0
 /**
  * Collect and return serverinfos as json
  *
  * @return array
  */
 public function info()
 {
     return ['alias' => getServerAlias(), 'url' => getServerUrl(), 'type' => getServerType(), 'slaves' => getSlaves(), "whitelisted_ips" => getWhitelistedIps()];
 }