Ejemplo n.º 1
0
 protected function fixDIForJobs()
 {
     $application = new Application();
     $this->config = \OC::$server->getConfig();
     $this->userManager = \OC::$server->getUserManager();
     $this->expiration = $application->getContainer()->query('Expiration');
 }
Ejemplo n.º 2
0
 /**
  * delete files older then max storage time
  *
  * @param array $files list of files sorted by mtime
  * @param string $user
  * @return integer[] size of deleted files and number of deleted files
  */
 public static function deleteExpiredFiles($files, $user)
 {
     $application = new Application();
     $expiration = $application->getContainer()->query('Expiration');
     $size = 0;
     $count = 0;
     foreach ($files as $file) {
         $timestamp = $file['mtime'];
         $filename = $file['name'];
         if ($expiration->isExpired($timestamp)) {
             $count++;
             $size += self::delete($filename, $user, $timestamp);
             \OC::$server->getLogger()->info('Remove "' . $filename . '" from trashbin because it exceeds max retention obligation term.', ['app' => 'files_trashbin']);
         } else {
             break;
         }
     }
     return array($size, $count);
 }
Ejemplo n.º 3
0
 /**
  * delete files older then max storage time
  *
  * @param array $files list of files sorted by mtime
  * @param string $user
  * @return array size of deleted files and number of deleted files
  */
 protected static function deleteExpiredFiles($files, $user)
 {
     $application = new Application();
     $expiration = $application->getContainer()->query('Expiration');
     $size = 0;
     $count = 0;
     foreach ($files as $file) {
         $timestamp = $file['mtime'];
         $filename = $file['name'];
         if ($expiration->isExpired($timestamp)) {
             $count++;
             $size += self::delete($filename, $user, $timestamp);
         } else {
             break;
         }
     }
     return array($size, $count);
 }