Esempio n. 1
0
<?php

require_once '../../admin/functions.php';
require_once 'Eventio/BBQ.php';
use Eventio\BBQ;
use Eventio\BBQ\Queue\DirectoryQueue;
use Eventio\BBQ\Job\Payload\StringPayload;
define('CACHE_PATH', 'cache/bbq');
$req = get_param();
list($name, $key, $data) = null_exit($req, 'name', 'table_name', 'data', 'apikey');
items_exit($data, 'ident', 'facility', 'priority', 'message');
$bbq = new BBQ();
$queue = new DirectoryQueue('tasks', dirname(__FILE__) . '/' . CACHE_PATH);
$bbq->registerQueue($queue);
$bbq->pushJob('tasks', new StringPayload('New task payload'));
$job = $bbq->fetchJob('tasks');
$payload = $job->getPayload();
echo $payload;
$bbq->finalizeJob($job);
Esempio n. 2
0
<?php

require_once '../../admin/functions.php';
$req = get_param();
list($db_name, $table_name, $data, $apikey) = null_exit($req, 'db_name', 'table_name', 'data', 'apikey');
api_exit($db_name, $table_name, $apikey);
items_exit($data, 'ident', 'facility', 'priority', 'title');
$output = append_new_data($db_name, $table_name, $data);
unset($output['listview']);
jsonp_nocache_exit($output);
Esempio n. 3
0
function getdata_exit($db_name, $table_name, $name)
{
    $map_key = $name;
    $table_root = table_root($db_name, $table_name);
    $mapper = object_read("{$table_root}/mapper.json");
    if (empty($mapper)) {
        jsonp_nocache_exit(['status' => 'error', 'error' => 'mapper file not found']);
    }
    $map_key = mapper_key($map_key);
    $map_val = @$mapper[$map_key];
    $map_file = "{$table_root}/{$map_val}.json";
    if (!file_exists($map_file)) {
        jsonp_nocache_exit(['status' => 'error', 'error' => 'data file not found']);
    }
    $data = object_read($map_file);
    if (empty($data)) {
        jsonp_nocache_exit(['status' => 'error', 'error' => 'data file is empty']);
    }
    items_exit($data);
    return $data;
}