/** * Deletes a video, override for the parent delete * * @return boolean */ public function delete() { // in case of an uploaded video make sure it's also deleted from queue and trash // with related media if it still remained there if ($this->videotype == 'uploaded') { $queue_object = new izapQueue(); $queue_object->delete_from_trash($this->guid, true); $queue_object->delete($this->guid, true); } $imagesrc = $this->imagesrc; $filesrc = $this->videofile; $ofilesrc = $this->orignalfile; //delete entity from elgg db and corresponding files if exist $this->setFilename($imagesrc); $image_file = $this->getFilenameOnFilestore(); file_exists($image_file) && @unlink($image_file); $this->setFilename($filesrc); $video_file = $this->getFilenameOnFilestore(); file_exists($video_file) && @unlink($video_file); $this->setFilename($ofilesrc); $orignal_file = $this->getFilenameOnFilestore(); file_exists($orignal_file) && @unlink($orignal_file); return parent::delete(); }
/** * Fetch videos from queue and send these videos for conversion * * @return boolean * * @version 5.0 */ function izap_run_queue_izap_videos() { $queue_object = new izapQueue(); $queue = $queue_object->fetch_videos(); if (defined('IZAP_VIDEO_UNIT_TEST')) { if (IZAP_VIDEO_UNIT_TEST === True) { global $CONFIG; $converted = izap_convert_video_izap_videos($CONFIG->dataroot . '/test_video.avi', '', '', '', 77); } } elseif (is_array($queue)) { izap_get_all_access(); foreach ($queue as $pending) { $converted = izap_convert_video_izap_videos($pending['main_file'], $pending['guid'], $pending['title'], $pending['url'], $pending['owner_id']); $izap_video = get_entity($pending['guid']); if (is_array($converted) && $converted['error']) { $izap_video->converted = 'no'; $queue_object->move_to_trash($pending['guid']); } else { $izap_video->converted = 'yes'; $queue_object->delete($pending['guid']); } } if ($queue_object->count() > 0) { izap_run_queue_izap_videos(); } } return true; }
/** * deletes a video, override for the parent delete * * @return boolean */ public function delete() { global $CONFIG; if ($this->videotype == 'uploaded' && $this->converted == 'no') { // delete entity from queue and trash with related media $queue_object = new izapQueue(); $queue_object->delete_from_trash($this->guid, true); $queue_object->delete($this->guid, true); } $imagesrc = $this->imagesrc; $filesrc = $this->videofile; $ofilesrc = $this->orignalfile; $orignal_thumb = $this->orignal_thumb; //delete entity from elgg db and corresponding files if exist $this->setFilename($imagesrc); $image_file = $this->getFilenameOnFilestore(); file_exists($image_file) && @unlink($image_file); $this->setFilename($filesrc); $video_file = $this->getFilenameOnFilestore(); file_exists($video_file) && @unlink($video_file); $this->setFilename($ofilesrc); $orignal_file = $this->getFilenameOnFilestore(); file_exists($orignal_file) && @unlink($orignal_file); $this->setFilename($orignal_thumb); $orignal_thumb_file = $this->getFilenameOnFilestore(); file_exists($orignal_thumb_file) && @unlink($orignal_thumb_file); return delete_entity($this->guid, TRUE); }
function izapRunQueue_izap_videos() { $queue_object = new izapQueue(); $queue = $queue_object->fetch_videos(); if (is_array($queue)) { foreach ($queue as $pending) { $converted = izapConvertVideo_izap_videos($pending['main_file'], $pending['guid'], $pending['title'], $pending['url'], $pending['owner_id']); if (!$converted) { $queue_object->move_to_trash($pending['guid']); } $queue_object->delete($pending['guid']); izap_update_all_defined_access_id($pending['guid'], $pending['access_id']); } // re-check if there are new videos in the queue if ($queue_object->count() > 0) { izapRunQueue_izap_videos(); } } return true; }
/* * This file is part of izap-videos plugin for Elgg. * * izap-videos for Elgg is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. * * izap-videos for Elgg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with izap-videos for Elgg. If not, see <http://www.gnu.org/licenses/>. */ /** * Delete videos from queue * * @version 5.0 */ $queue_object = new izapQueue(); foreach ($queue_object->get(get_input('guid')) as $key => $prods) { get_entity($prods['guid'])->delete(); } //delete video entity from queue $queue_object->delete(get_input('guid')); system_message(elgg_echo('izap-videos:queue_retriggred')); forward(REFERER); exit;