/**
  * Clear out the image manipulation cache
  * @param SS_HTTPRequest $request
  */
 public function run($request)
 {
     $failedFiles = 0;
     $Videos = VideoFile::get()->filter(array('ProcessingStatus' => 'error'));
     foreach ($Videos as $vid) {
         $failedFiles++;
         $vid->ProcessingStatus = 'new';
         $vid->write();
         $vid->onAfterLoad();
         sleep(5);
     }
     echo "{$failedFiles} failed VideoFile objects have reinitiated the processing.";
 }
 protected function onAfterProcess()
 {
     parent::onAfterProcess();
 }
 /**
  * Overload this method to contain the task logic.
  */
 public function process()
 {
     if (isset($_REQUEST['VideoFileID']) && ($VideoFile = VideoFile::get()->byID($_REQUEST['VideoFileID']))) {
         $VideoFile->process();
     }
 }
 function getSubClass($fileName, $diskFile)
 {
     //php4 can't list subclasses of class, so we need to add each one here
     require_once "AudioFile.php";
     require_once "ImageFile.php";
     require_once "VideoFile.php";
     require_once "ZipFile.php";
     if (preg_match('/\\.([^.]{2,4}$)/', $fileName, $m)) {
         $ext = strtolower($m[1]);
     } else {
         return "PlainFile";
     }
     if (ImageFile::validateExtension($ext)) {
         return "ImageFile";
     }
     if (ZipFile::validateExtension($ext)) {
         return "ZipFile";
     }
     $audioValid = AudioFile::validateExtension($ext);
     $videoValid = VideoFile::validateExtension($ext);
     if ($audioValid && $videoValid) {
         exec(escapeshellcmd("file " . $diskFile), $out, $ret_error);
         if (preg_match("/video/", $out[0]) || preg_match("/movie/", $out[0])) {
             return "VideoFile";
         } else {
             return "AudioFile";
         }
     }
     if ($audioValid) {
         return "AudioFile";
     }
     if ($videoValid) {
         return "VideoFile";
     }
     return "PlainFile";
 }