feat: add function to get raw Database output, for debugging
This commit is contained in:
parent
fc0d38e118
commit
95e3fc0b00
1 changed files with 10 additions and 0 deletions
|
@ -19,6 +19,9 @@ switch($API_FUNCTION) {
|
|||
echo $post->to_json($REQUEST_QUERY);
|
||||
}
|
||||
break;
|
||||
case 'db_post':
|
||||
echo json_encode($sql_adapter->get_postdata($match[2]));
|
||||
break;
|
||||
|
||||
case 'upload':
|
||||
if(!access_can_upload()) {
|
||||
|
@ -69,10 +72,17 @@ switch($API_FUNCTION) {
|
|||
$post_data['path'] = $file_path;
|
||||
$post_data['markdown'] = $post_matter->body();
|
||||
|
||||
// TODO: This should be moved to an appropriately abstracted prep function
|
||||
|
||||
|
||||
if($is_directory) {
|
||||
$post_data['base'] ??= $original_file_path;
|
||||
$post_data['type'] ??= 'directory';
|
||||
}
|
||||
|
||||
$post_data['tags'] ??= [];
|
||||
$post_data['tags'] []= "type:" . ($post_data['type'] ?? Post::deduce_type($file_path));
|
||||
$post_data['tags'] []= "path:" . $file_path;
|
||||
|
||||
$sql_adapter->set_postdata($post_data);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue