상속: extends Gdn_Plugin
예제 #1
0
 /**
  * TrashFile function.
  * 
  * @access protected
  * @param mixed $FileID
  * @return void
  */
 protected function TrashFile($FileID)
 {
     $Media = $this->MediaModel()->GetID($FileID);
     if ($Media) {
         $this->MediaModel()->Delete($Media);
         $Deleted = FALSE;
         if (!$Deleted) {
             $DirectPath = MediaModel::PathUploads() . DS . $Media->Path;
             if (file_exists($DirectPath)) {
                 $Deleted = @unlink($DirectPath);
             }
         }
         if (!$Deleted) {
             $CalcPath = FileUploadPlugin::FindLocalMedia($Media, TRUE, TRUE);
             if (file_exists($CalcPath)) {
                 $Deleted = @unlink($CalcPath);
             }
         }
     }
 }
예제 #2
0
 /**
  * Delete an uploaded file & its media record.
  *
  * @param int $MediaID Unique ID on Media table.
  */
 protected function trashFile($MediaID)
 {
     $Media = $this->mediaModel()->getID($MediaID);
     if ($Media) {
         $this->mediaModel()->delete($Media);
         $Deleted = false;
         // Allow interception
         $this->EventArguments['Parsed'] = Gdn_Upload::parse($Media->Path);
         $this->EventArguments['Handled'] =& $Deleted;
         // Allow skipping steps below
         $this->fireEvent('TrashFile');
         if (!$Deleted) {
             $DirectPath = MediaModel::pathUploads() . DS . $Media->Path;
             if (file_exists($DirectPath)) {
                 $Deleted = @unlink($DirectPath);
             }
         }
         if (!$Deleted) {
             $CalcPath = FileUploadPlugin::findLocalMedia($Media, true, true);
             if (file_exists($CalcPath)) {
                 @unlink($CalcPath);
             }
         }
     }
 }
예제 #3
0
 /**
  * Delete an uploaded file & its media record.
  *
  * @access protected
  * @param int $MediaID Unique ID on Media table.
  */
 protected function TrashFile($MediaID)
 {
     $Media = $this->MediaModel()->GetID($MediaID);
     if ($Media) {
         $this->MediaModel()->Delete($Media);
         $Deleted = FALSE;
         // Allow interception
         $this->EventArguments['Parsed'] = Gdn_Upload::Parse($Media->Path);
         $this->EventArguments['Handled'] =& $Deleted;
         // Allow skipping steps below
         $this->FireEvent('TrashFile');
         if (!$Deleted) {
             $DirectPath = MediaModel::PathUploads() . DS . $Media->Path;
             if (file_exists($DirectPath)) {
                 $Deleted = @unlink($DirectPath);
             }
         }
         if (!$Deleted) {
             $CalcPath = FileUploadPlugin::FindLocalMedia($Media, TRUE, TRUE);
             if (file_exists($CalcPath)) {
                 $Deleted = @unlink($CalcPath);
             }
         }
     }
 }