/** * delete. */ public function delete($id) { $this->time->start(); $return = parent::delete($id); $time = $this->time->stop(); $this->log(array('type' => 'delete', 'id' => $id, 'time' => $time)); return $return; }
/** * Remove file * * @param string $path file path * @return bool **/ protected function _unlink($path) { $file = $this->getFile($path); if (!$file) { return false; } return $this->db->delete($file->file['_id']); }
/** */ public function deleteFile($path, $name) { if ($orig = $this->_getFile($path, $name)) { $this->_checkQuotaDelete($path, $name); $this->_files->delete($orig->file['_id']); } else { throw new Horde_Vfs_Exception('Unable to delete VFS file.'); } }
/** * @param \MongoGridFS $gridFs * @param \MongoGridFSFile $file */ function it_should_rename_file($gridFs, $file) { $file->getBytes()->willReturn('some content'); $file->getSize()->willReturn(12); $gridFs->findOne('otherFilename', array())->willReturn(null); $gridFs->findOne('filename', array())->shouldBeCalled()->willReturn($file); $gridFs->storeBytes('some content', array('date' => 1234, 'filename' => 'otherFilename'))->shouldBeCalled()->willReturn('someId'); $fileToDelete = new \stdClass(); $fileToDelete->file = array('_id' => 123); $gridFs->findOne('filename', array('_id'))->willReturn($fileToDelete); $gridFs->findOne(array('_id' => 'someId'))->willReturn($file); $gridFs->delete(123)->shouldBeCalled()->willReturn(true); $this->setMetadata('otherFilename', array('date' => 1234)); $this->rename('filename', 'otherFilename')->shouldReturn(true); }