public function __construct($origin, MMSynchPublisherFolder $publisher, $folder, $filename) { $this->origin = $origin; // Publisher part $this->publisherFolder = $publisher->getFolder(); // Folder part $this->folder = $folder; // File part $this->fileName = $filename; if (substr($this->fileName, 0, 1) == '/') $this->fileName = substr($this->fileName, 1); // Full path $fullPathParts = array( MMSynchFileManager::getRootPath(), $this->origin, $this->publisherFolder, $this->folder, $this->fileName ); $this->fullPath = implode('/', $fullPathParts); if (!is_file($this->fullPath)) { $archivePath = $this->getArchivePath(); if (is_file($archivePath)) { MMSynchLog::warning(sprintf('File "%s" is archived', $this->fullPath)); $this->fullPath = $archivePath; $this->archived = true; } else { throw new MMSynchException(sprintf('File "%s" not exist and is not archived', $this->fullPath)); } } }
protected function populate() { parent::populate(); $id = false; if ($this->source['video_brightcoveid'] != '') { $id = $this->source['video_brightcoveid']; } $filepath = false; if ($this->source['m_file']) { try { $this->file = MMSynchFileManager::fromRoot($this->getPublisher(), MMSynchFileManager::VIDEO_FOLDER, $this->source['m_file']); $filepath = $this->file->getFullPath(); } catch(Exception $e) { if ($id) { MMSynchLog::warning($this, $e->getMessage()); } else { throw MMSynchException::fromException($e); } } } $this->content->fields->file = sprintf('%s|%s|%s', $filepath, $id, $this->getPublisher()->getFolder()); $this->content->fields->screen_capture = MMSynchHelper::binaryToFile($this->source['video_screen_capture']); $this->content->fields->duration = $this->source['video_duration']; $this->content->fields->original_size = $this->source['video_original_size']; }
public function addWarning($message) { MMSynchLog::warning($this, $message); $this->warnings[] = $message; }
public function addWarning($message) { MMSynchLog::warning($this, $message); }
public function __destruct() { $warnings = self::archive('default'); foreach($warnings as $warning) { MMSynchLog::warning(null, $warning); } }