You are here

public static function MongoUploader::pruneChunks in One Click Upload 7.2

Delete chunks older than expiration time.

Parameters

\MongoGridFS $gridFs:

int $expirationTime seconds:

Throws

FileOpenException

File

flowphp/src/Flow/Mongo/MongoUploader.php, line 20

Class

MongoUploader
@codeCoverageIgnore

Namespace

Flow\Mongo

Code

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!");
  }
}