示例#1
0
        $response = "Failed to log error. File pointer could not be initialized.";
        $app->getLog()->warn($response);
    }
    $response = @stream_get_contents($fp);
    if ($response === false) {
        $response = "Failed to log error. stream_get_contents failed.";
        $app->getLog()->warn($response);
    }
    $result = array('response' => $response);
    JsonView::render($result);
});
/**
 * UI COLLECTION
 */
$app->map("/{$v}/tables/:table/columns/:column/:ui/?", function ($table, $column, $ui) use($acl, $ZendDb, $params, $requestPayload, $app) {
    $TableGateway = new TableGateway($acl, 'directus_ui', $ZendDb);
    switch ($app->request()->getMethod()) {
        case "PUT":
        case "POST":
            $keys = array('table_name' => $table, 'column_name' => $column, 'ui_name' => $ui);
            $uis = to_name_value($requestPayload, $keys);
            $column_settings = array();
            foreach ($uis as $col) {
                $existing = $TableGateway->select(array('table_name' => $table, 'column_name' => $column, 'ui_name' => $ui, 'name' => $col['name']))->toArray();
                if (count($existing) > 0) {
                    $col['id'] = $existing[0]['id'];
                }
                array_push($column_settings, $col);
            }
            $TableGateway->updateCollection($column_settings);
    }
示例#2
0
function getActiveFiles()
{
    global $ZendDb, $acl;
    $tableGateway = new TableGateway($acl, 'directus_files', $ZendDb);
    return $tableGateway->countActive();
}