Esempio n. 1
0
     break;
 case 'rename':
     if (!$collection) {
         echo "Error: no collection in use.\n";
         break;
     } elseif (!$input[1]) {
         echo "Error: no node ID specified.\n";
         break;
     } elseif (!$input[2]) {
         echo "Error: no new node ID specified.\n";
         break;
     }
     array_shift($input);
     $id = array_shift($input);
     $new = array_shift($input);
     $res = $ns->rename($id, $new);
     if (!$res) {
         echo 'Error: ' . $ns->error . "\n";
         break;
     }
     echo "Node renamed.\n";
     break;
 case 'delete':
     if (!$collection) {
         echo "Error: no collection in use.\n";
         break;
     } elseif (!$input[1]) {
         echo "Error: no node ID specified.\n";
         break;
     }
     echo "Are you sure you want to delete the node '" . $input[1] . "'? (yes|no)\n";