Пример #1
0
* Consult LICENSE file for details
************************************************/
require_once 'vendor/autoload.php';
require_once 'config.php';
/************************************************
 * MAIN
 */
declare (ticks=1);
define('BASE_PATH_CLI', dirname(__FILE__) . "/");
try {
    ZPush::CheckConfig();
    ZLog::Initialize();
    if (!function_exists("pcntl_signal")) {
        throw new FatalException("Function pcntl_signal() is not available. Please install package 'php5-pcntl' (or similar) on your system.");
    }
    $zpt = new ZPushTop();
    // check if help was requested from CLI
    if (in_array('-h', $argv) || in_array('--help', $argv)) {
        echo $zpt->UsageInstructions();
        exit(1);
    }
    if ($zpt->IsAvailable()) {
        pcntl_signal(SIGINT, array($zpt, "SignalHandler"));
        $zpt->run();
        $zpt->scrClear();
        system("stty sane");
    } else {
        echo "Z-Push shared memory interprocess communication is not available.\n";
    }
} catch (ZPushException $zpe) {
    die(get_class($zpe) . ": " . $zpe->getMessage() . "\n");
Пример #2
0
include 'lib/utils/utils.php';
include 'lib/request/request.php';
include 'lib/request/requestprocessor.php';
include 'config.php';
include 'version.php';
/************************************************
 * MAIN
 */
declare (ticks=1);
define('BASE_PATH_CLI', dirname(__FILE__) . "/");
try {
    ZPush::CheckConfig();
    if (!function_exists("pcntl_signal")) {
        throw new FatalException("Function pcntl_signal() is not available. Please install package 'php5-pcntl' (or similar) on your system.");
    }
    $zpt = new ZPushTop();
    if ($zpt->IsAvailable()) {
        pcntl_signal(SIGINT, array($zpt, "SignalHandler"));
        $zpt->run();
        $zpt->scrClear();
    } else {
        echo "Z-Push shared memory interprocess communication is not available.\n";
    }
} catch (ZPushException $zpe) {
    die(get_class($zpe) . ": " . $zpe->getMessage() . "\n");
}
echo "terminated\n";
/************************************************
 * Z-Push-Top
 */
class ZPushTop