remove() public method

Removes files from the collections
public remove ( array $criteria = [], array $options = [] ) : boolean
$criteria array Description of records to remove.
$options array Options for remove.
return boolean
Exemplo n.º 1
0
 /**
  * Delete chunks older than expiration time.
  *
  * @param \MongoGridFS $gridFs
  * @param int $expirationTime seconds
  *
  * @throws FileOpenException
  */
 public static function pruneChunks($gridFs, $expirationTime = 172800)
 {
     $result = $gridFs->remove(['flowUpdated' => ['$lt' => new \MongoDate(time() - $expirationTime)], 'flowStatus' => 'uploading']);
     if (!$result) {
         throw new FileOpenException("Could not remove chunks!");
     }
 }
Exemplo n.º 2
0
 /**
  */
 public function gc($path, $secs = 345600)
 {
     $query = array($this->_mdKey(self::PATH) => array('$regex' => '^' . $this->_convertPath($path)), 'uploadDate' => array('$lt' => new MongoDate(time() - $secs)));
     try {
         $this->_files->remove($query);
     } catch (MongoException $e) {
         throw new Horde_Vfs_Exception($e);
     }
 }
Exemplo n.º 3
0
 /**
  * remove.
  */
 public function remove($criteria = array(), array $options = array())
 {
     $this->time->start();
     $return = parent::remove($criteria, $options);
     $time = $this->time->stop();
     $this->log(array('type' => 'remove', 'criteria' => $criteria, 'options' => $options, 'time' => $time));
     return $return;
 }
Exemplo n.º 4
0
 /**
  * 删除陈旧的文件
  *
  * @param mixed $id
  *            \MongoID or String
  * @return bool true or false
  */
 public function removeFileFromGridFS($id)
 {
     if (!$id instanceof \MongoId) {
         $id = new \MongoId($id);
     }
     return $this->_fs->remove(array('_id' => $id));
 }