Difference between revisions of "Restore Orphaned Records"
IVSWikiBlue (talk | contribs) (Created page with "To restore records the following step should be performed: 1) Modify file src/FS/CamBundle/Entity/Record.php set @ORM\GeneratedValue(strategy="NONE") for ID field change setId...") |
(No difference)
|
Revision as of 08:11, 3 February 2017
To restore records the following step should be performed: 1) Modify file src/FS/CamBundle/Entity/Record.php set @ORM\GeneratedValue(strategy="NONE") for ID field change setId() method: public function setId($id) { $this->id = $id; } 2) Modify file src/FS/UserBundle/Controller/UpdateController.php add to use directives: use FS\CamBundle\Entity\Record; use Symfony\Component\Finder\Iterator\RecursiveDirectoryIterator; add following method: /**
- @Route(path="/restore", name="restore_records")
- /
public function restoreAction() { $em = $this->getDoctrine()->getManager(); $recordsRep = $em->getRepository('FSCamBundle:Record'); $videoFolder = '/usr/local/WowzaStreamingEngine/content/ivrv3_recordings/video/'; $dirHandle = opendir($videoFolder); while ($file = readdir($dirHandle)) { $filename = $videoFolder . $file; if (is_dir($filename) && $file != '.' && $file != '..' && $file != 'mosaic') { if ($recordsRep->find($file) !== null) { } else { $date = date("Y-m-d H:i:s", filemtime($filename)); echo $file . ' ' . $date . ' not found '; $record = new Record(); $record->setId($file); $record->setName('Restored Record'); $record->setNameTitle('Recording name'); $record->setIsCompleted(); $record->setStartedAt(new \DateTime($date)); $record->setCreatedBy($em->getRepository('FSUserBundle:User')->find(1)); $record->setRecordType('record'); $record->setRecordPreviewReady(true); $em->persist($record); $this->get('fs_cam.wowza_manager')->makeThumbnailLocalWowza($record); } } } $em->flush(); } Be sure to choose correct video folder /usr/local/WowzaStreamingEngine/content/ivrv3_recordings/video/ , change it according to wowza’s recordings folder. 3) Then wait while script executes (/update/restore). It may take long time depending on how many records are being restored. 4) Restore all code parts back to what they were before Delete use directives, delete restore method, change Id strategy to AUTO. setId method may not be changed back