aboutsummaryrefslogtreecommitdiffstats
path: root/php/node.php
diff options
context:
space:
mode:
authoradam <adam@>2021-02-12 22:56:26 +0200
committeradam <adam@>2021-02-12 22:56:26 +0200
commit80cd845b8177730a6dae27e847dc8951af3383de (patch)
tree6b730d90c03b4583fd12e4cb744379ddaf76760e /php/node.php
parent61ce3ca3170e337edb2d276e20ff77671bab01a9 (diff)
downloadfileup-80cd845b8177730a6dae27e847dc8951af3383de.tar.gz
directory duplication error dealt with
Diffstat (limited to 'php/node.php')
-rw-r--r--php/node.php12
1 files changed, 10 insertions, 2 deletions
diff --git a/php/node.php b/php/node.php
index b3b2c3f..c2ab5f1 100644
--- a/php/node.php
+++ b/php/node.php
@@ -43,9 +43,17 @@ require_once "user.php";
function create_directory(string $abstract_path,string $directory_name,string $note,User $user)
{
global $database;
- $dir_id=$database->create_dangling_directory();
+
$parent_dir_id=get_directory($abstract_path,$user);
- $database->link_nodes($parent_dir_id,$dir_id,$directory_name,$note);
+ if($database->check_if_name_is_taken($directory_name,$parent_dir_id))
+ {
+ return NULL;
+ }else
+ {
+ $dir_id=$database->create_dangling_directory();
+ $database->link_nodes($parent_dir_id,$dir_id,$directory_name,$note);
+ return $dir_id;
+ }
}
?>