Esempio n. 1
1
 /**
  * {@inheritdoc}
  */
 public function apply(base $databox, Application $app)
 {
     $structure = $databox->get_structure();
     $DOM = new DOMDocument();
     $DOM->loadXML($structure);
     $xpath = new DOMXpath($DOM);
     foreach ($xpath->query('/record/subdefs/subdefgroup[@name="video"]/subdef[@name="preview"]/acodec') as $node) {
         $node->nodeValue = 'libvo_aacenc';
     }
     foreach ($xpath->query('/record/subdefs/subdefgroup[@name="video"]/subdef[@name="preview"]/vcodec') as $node) {
         $node->nodeValue = 'libx264';
     }
     $databox->saveStructure($DOM);
     $subdefgroups = $databox->get_subdef_structure();
     foreach ($subdefgroups as $groupname => $subdefs) {
         foreach ($subdefs as $name => $subdef) {
             $this->addScreenDeviceOption($subdefgroups, $subdef, $groupname);
             if (in_array($name, ['preview', 'thumbnail'])) {
                 if ($name == 'thumbnail' || $subdef->getSubdefType()->getType() != \Alchemy\Phrasea\Media\Subdef\Subdef::TYPE_VIDEO) {
                     $this->addMobileSubdefImage($subdefgroups, $subdef, $groupname);
                 } else {
                     $this->addMobileSubdefVideo($subdefgroups, $subdef, $groupname);
                 }
             }
             if ($subdef->getSubdefType()->getType() != \Alchemy\Phrasea\Media\Subdef\Subdef::TYPE_VIDEO) {
                 continue;
             }
             $this->addHtml5Video($subdefgroups, $subdef, $groupname);
         }
     }
     return true;
 }
Esempio n. 2
0
 /**
  * {@inheritdoc}
  */
 public function apply(base $databox, Application $app)
 {
     $sql = 'UPDATE record r, subdef s
             SET r.mime = s.mime
             WHERE r.record_id = s.record_id
               AND s.name="document"';
     $stmt = $databox->get_connection()->prepare($sql);
     $stmt->execute();
     $stmt->closeCursor();
     $sql = 'UPDATE subdef s, record r
             SET s.updated_on = r.moddate, s.created_on = r.credate
             WHERE s.record_id = r.record_id';
     $stmt = $databox->get_connection()->prepare($sql);
     $stmt->execute();
     $stmt->closeCursor();
     $sql = 'UPDATE subdef SET `name` = LOWER( `name` )';
     $stmt = $databox->get_connection()->prepare($sql);
     $stmt->execute();
     $stmt->closeCursor();
     $dom = $databox->get_dom_structure();
     $xpath = $databox->get_xpath_structure();
     $nodes = $xpath->query('//record/subdefs/subdefgroup/subdef');
     foreach ($nodes as $node) {
         $name = mb_strtolower(trim($node->getAttribute('name')));
         if ($name === '') {
             continue;
         }
         $node->setAttribute('name', $name);
     }
     $databox->saveStructure($dom);
     return true;
 }
Esempio n. 3
0
 /**
  * {@inheritdoc}
  */
 public function apply(base $databox, Application $app)
 {
     $sql = 'TRUNCATE metadatas';
     $stmt = $databox->get_connection()->prepare($sql);
     $stmt->execute();
     $stmt->closeCursor();
     $sql = 'TRUNCATE metadatas_structure';
     $stmt = $databox->get_connection()->prepare($sql);
     $stmt->execute();
     $stmt->closeCursor();
     $sql = 'TRUNCATE technical_datas';
     $stmt = $databox->get_connection()->prepare($sql);
     $stmt->execute();
     $stmt->closeCursor();
     $phrasea_maps = ['pdftext' => 'Phraseanet:pdftext', 'tf-archivedate' => 'Phraseanet:tf-archivedate', 'tf-atime' => 'Phraseanet:tf-atime', 'tf-chgdocdate' => 'Phraseanet:tf-chgdocdate', 'tf-ctime' => 'Phraseanet:tf-ctime', 'tf-editdate' => 'Phraseanet:tf-editdate', 'tf-mtime' => 'Phraseanet:tf-mtime', 'tf-parentdir' => 'Phraseanet:tf-parentdir', 'tf-bits' => 'Phraseanet:tf-bits', 'tf-channels' => 'Phraseanet:tf-channels', 'tf-extension' => 'Phraseanet:tf-extension', 'tf-filename' => 'Phraseanet:tf-filename', 'tf-filepath' => 'Phraseanet:tf-filepath', 'tf-height' => 'Phraseanet:tf-height', 'tf-mimetype' => 'Phraseanet:tf-mimetype', 'tf-recordid' => 'Phraseanet:tf-recordid', 'tf-size' => 'Phraseanet:tf-size', 'tf-width' => 'Phraseanet:tf-width'];
     $sxe = $databox->get_sxml_structure();
     $dom_struct = $databox->get_dom_structure();
     $xp_struct = $databox->get_xpath_structure();
     foreach ($sxe->description->children() as $fname => $field) {
         $src = trim(isset($field['src']) ? $field['src'] : '');
         if (array_key_exists($src, $phrasea_maps)) {
             $src = $phrasea_maps[$src];
         }
         $nodes = $xp_struct->query('/record/description/' . $fname);
         if ($nodes->length > 0) {
             $node = $nodes->item(0);
             $node->setAttribute('src', $src);
             $node->removeAttribute('meta_id');
         }
     }
     $databox->saveStructure($dom_struct);
     $databox->feed_meta_fields();
     $databox->delete_data_from_cache(databox::CACHE_STRUCTURE);
     $databox->delete_data_from_cache(databox::CACHE_META_STRUCT);
     $conn = $app->getApplicationBox()->get_connection();
     $sql = 'DELETE FROM `task2` WHERE class="readmeta"';
     $stmt = $conn->prepare($sql);
     $stmt->execute();
     $stmt->closeCursor();
     unset($stmt);
     return true;
 }
Esempio n. 4
0
 /**
  * {@inheritdoc}
  */
 public function apply(base $databox, Application $app)
 {
     $sxe = $databox->get_sxml_structure();
     if ($sxe !== false) {
         foreach ($sxe->statbits->bit as $sb) {
             $bit = (int) $sb["n"];
             if ($bit < 4 && $bit > 31) {
                 continue;
             }
             $name = (string) $sb;
             $labelOff = (string) $sb['labelOff'];
             $labelOn = (string) $sb['labelOn'];
             $this->status[$bit]["labeloff"] = $labelOff ?: 'no-' . $name;
             $this->status[$bit]["labelon"] = $labelOn ?: 'ok-' . $name;
         }
     }
     $dom = new \DOMDocument();
     $dom->loadXML($sxe->asXML());
     $databox->saveStructure($dom);
     return true;
 }