/**
  * Deletes a database
  *
  * This will delete an existing database.
  *
  * @param Connection $connection - the connection to be used
  * @param string     $name       - the database specification, for example 'myDatabase'
  *
  * @link http://www.arangodb.com/manuals/1.4/HttpDatabase.html
  *
  * @return array $responseArray - The response array.
  */
 public static function delete(Connection $connection, $name)
 {
     $url = UrlHelper::buildUrl(Urls::URL_DATABASE, array($name));
     $response = $connection->delete($url);
     $responseArray = $response->getJson();
     return $responseArray;
 }
 /**
  * Explicitly delete the cursor
  *
  * This might issue an HTTP DELETE request to inform the server about
  * the deletion.
  *
  * @throws Exception
  * @return bool - true if the server acknowledged the deletion request, false otherwise
  */
 public function delete()
 {
     if ($this->_id) {
         try {
             $this->_connection->delete($this->url() . '/' . $this->_id);
             return true;
         } catch (Exception $e) {
         }
     }
     return false;
 }
Example #3
0
 /**
  * Explicitly delete the cursor
  *
  * This might issue an HTTP DELETE request to inform the server about
  * the deletion.
  *
  * @throws Exception
  * @return bool - true if the server acknowledged the deletion request, false otherwise
  */
 public function delete()
 {
     if ($this->_id) {
         try {
             $this->_connection->delete(Urls::URL_CURSOR . '/' . $this->_id);
             return true;
         } catch (Exception $e) {
         }
     }
     return false;
 }
 /**
  * Unregister the user function
  *
  * If no parameter ($name) is passed, it will use the property of the object.
  *
  * If $name is passed, it will override the object's property with the passed one
  *
  * @param string  $name
  * @param boolean $namespace
  *
  * @throws Exception throw exception if the request fails
  *
  * @return mixed true if successful without a return value or the return value if one was set in the action
  */
 public function unregister($name = null, $namespace = false)
 {
     if (is_null($name)) {
         $name = $this->getName();
     }
     $url = UrlHelper::buildUrl(Urls::URL_AQL_USER_FUNCTION, array($name));
     if ($namespace) {
         $url = UrlHelper::appendParamsUrl($url, array('group' => true));
     }
     $response = $this->_connection->delete($url);
     $responseArray = $response->getJson();
     return $responseArray;
 }
Example #5
0
/**
 * Delete a connection. Requires login and user must be owner of the connection
 *
 * @param string $connid
 * @return Result or Error
 */
function deleteConnection($connid)
{
    $cobj = new Connection($connid);
    $result = $cobj->delete();
    return $result;
}
Example #6
0
 /**
  * {@inheritDoc}
  */
 public function delete($tableExpression, array $identifier, array $types = array())
 {
     $tableName = $this->quoteIdentifier($tableExpression);
     $identifier = $this->quoteKeys($identifier);
     return parent::delete($tableName, $identifier);
 }
Example #7
0
 /**
  * Deletes an endpoint
  *
  * This will delete an existing endpoint.
  *
  * @param Connection $connection - the connection to be used
  * @param string     $endpoint   - the endpoint specification, e.g. tcp://127.0.0.1:8530
  *
  * @link                         http://www.arangodb.com/manuals/1.4/HttpEndpoint.html
  * @return array $responseArray - The response array.
  */
 public static function delete(Connection $connection, $endpoint)
 {
     $url = UrlHelper::buildUrl(Urls::URL_ENDPOINT, array($endpoint));
     $response = $connection->delete($url);
     $responseArray = $response->getJson();
     return $responseArray;
 }
Example #8
0
 /**
  * Delete node
  *
  * @return Result object (or Error object)
  */
 function delete()
 {
     global $DB, $CFG, $USER, $HUB_FLM, $HUB_SQL;
     $this->load();
     try {
         $this->candelete();
     } catch (Exception $e) {
         return access_denied_error();
     }
     $dt = time();
     $xml = format_object('xml', $this);
     $params = array();
     $params[0] = $this->nodeid;
     $res = $DB->delete($HUB_SQL->DATAMODEL_NODE_DELETE, $params);
     if ($res) {
         auditIdea($USER->userid, $this->nodeid, $this->name, $this->description, $CFG->actionDelete, $xml);
         // NOT SURE THIS IS REQUIRED NOW AS IT SHOULD HAPPEN ON CASCADE DELETE IN THE DATABASE
         // update the related connections (triples)
         $params = array();
         $params[0] = $this->nodeid;
         $params[1] = $this->nodeid;
         $resArray = $DB->select($HUB_SQL->DATAMODEL_NODE_DELETE_TRIPLE, $params);
         if ($resArray !== false) {
             $count = count($resArray);
             for ($i = 0; $i < $count; $i++) {
                 $array = $resArray[$i];
                 $conn = new Connection($array['TripleID']);
                 $conn->delete();
             }
         } else {
             return database_error();
         }
         //update the related URLs
         $params = array();
         $params[0] = $this->nodeid;
         $res3 = $DB->delete($HUB_SQL->DATAMODEL_NODE_DELETE_URLNODE, $params);
         if (!$res3) {
             return database_error();
         }
         // Take this opportunity to delete any URLs if they are no longer connected to a node
         // Probably should do this in a more organized way!
         $params = array();
         $res4Array = $DB->select($HUB_SQL->DATAMODEL_NODE_DELETE_URLS_CLEAN, $params);
         if ($res4Array !== false) {
             $count = count($res4Array);
             for ($i = 0; $i < $count; $i++) {
                 $array = $res4Array[$i];
                 $url = new URL($array['URLID']);
                 $url->delete();
             }
         }
     } else {
         return database_error();
     }
     //remove old thumbnail
     if ($this->thumb != null && $this->thumb != "" && substr($this->thumb, 0, 7) == 'uploads') {
         unlink($HUB_FLM->createUploadsDirPath($this->thumb));
     }
     return new Result("deleted", "true");
 }
 public function delete($tableName, array $identifier)
 {
     $tableName = $this->quoteIdentifier($tableName);
     $identifier = $this->quoteKeys($identifier);
     return parent::delete($tableName, $identifier);
 }
 /**
  * Kills a specific query
  *
  * This will send an HTTP DELETE command to the server to terminate the specified query
  *
  * @param string $id - query id
  *
  * @throws Exception
  *
  * @return bool
  */
 public function kill($id)
 {
     $url = UrlHelper::buildUrl(Urls::URL_QUERY, array($id));
     $this->_connection->delete($url);
     return true;
 }