You are here

MongoUploader.php in One Click Upload 7.2

Namespace

Flow\Mongo

File

flowphp/src/Flow/Mongo/MongoUploader.php
View source
<?php

namespace Flow\Mongo;

use Flow\FileOpenException;

/**
 * @codeCoverageIgnore
 */
class MongoUploader {

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

}

Classes

Namesort descending Description
MongoUploader @codeCoverageIgnore