Exemple #1
0
/**
 * Check if all is setup correctly
 */
namespace phorkie;

header('HTTP/1.0 500 Internal Server Error');
$reqWritePermissions = false;
require_once 'www-header.php';
if (!$GLOBALS['phorkie']['cfg']['setupcheck']) {
    header('HTTP/1.0 403 Forbidden');
    header('Content-type: text/plain');
    echo "Setup check is disabled\n";
    exit(1);
}
$messages = SetupCheck::run();
$errors = 0;
foreach ($messages as $arMessage) {
    list($type, $message) = $arMessage;
    $type == 'error' && ++$errors;
}
if ($errors == 0) {
    header('HTTP/1.0 200 OK');
}
header('Content-type: text/html');
if ($errors == 0) {
    $messages[] = array('ok', 'All fine');
}
$out = <<<HTM
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Exemple #2
0
<?php

//search
namespace phorkie;

require_once __DIR__ . '/../src/phorkie/autoload.php';
require_once __DIR__ . '/../data/config.default.php';
if (file_exists(__DIR__ . '/../data/config.php')) {
    require_once __DIR__ . '/../data/config.php';
}
if ($GLOBALS['phorkie']['cfg']['setupcheck']) {
    SetupCheck::run();
}
$r = new Database_Adapter_Elasticsearch_HTTPRequest($GLOBALS['phorkie']['cfg']['elasticsearch'] . 'repo/_search', \HTTP_Request2::METHOD_GET);
$r->setBody(json_encode((object) array('from' => 0, 'size' => 2, 'query' => (object) array('bool' => (object) array('should' => array((object) array('query_string' => (object) array('query' => 'test')), (object) array('has_child' => (object) array('type' => 'file', 'query' => (object) array('query_string' => (object) array('query' => 'test'))))))))));
$res = $r->send();
echo $res->getBody() . "\n";