protected function updateRecordUUID(\databox $databox, array $record)
    {
        $pathfile = \p4string::addEndSlash($record['path']) . $record['file'];

        $uuid = Uuid::uuid4();
        try {
            $media = $this->app->getMediaFromUri($pathfile);
            $collection = \collection::getByCollectionId($this->$app, $databox, (int) $record['coll_id']);

            $file = new File($this->app, $media, $collection);
            $uuid = $file->getUUID(true, true);
            $sha256 = $file->getSha256();

            $this->app['monolog']->addInfo(sprintf("Upgrading record %d with uuid %s", $record['record_id'], $uuid));
        } catch (\Exception $e) {
            $this->app['monolog']->addError(sprintf("Uuid upgrade for record %s failed", $record['record_id']));
        }

        $sql = 'UPDATE record SET uuid = :uuid, sha256 = :sha256 WHERE record_id = :record_id';

        $params = [
            ':uuid'      => $uuid,
            'sha256'     => $sha256,
            ':record_id' => $record['record_id'],
        ];
        $stmt = $databox->get_connection()->prepare($sql);
        $stmt->execute($params);
        $stmt->closeCursor();
    }
protected function updateRecordUUID(\databox $databox, array $record)
    {
        $pathfile = \p4string::addEndSlash($record['path']) . $record['file'];

        $uuid = Uuid::uuid4();
        try {
            $media = $this->app->getMediaFromUri($pathfile);
            $collection = \collection::getByCollectionId($this->$app, $databox, (int) $record['coll_id']);

            $file = new File($this->app, $media, $collection);
            $uuid = $file->getUUID(true, true);
            $sha256 = $file->getSha256();

            $this->app['monolog']->addInfo(sprintf("Upgrading record %d with uuid %s", $record['record_id'], $uuid));
        } catch (\Exception $e) {
            $this->app['monolog']->addError(sprintf("Uuid upgrade for record %s failed", $record['record_id']));
        }

        $sql = 'UPDATE record SET uuid = :uuid, sha256 = :sha256 WHERE record_id = :record_id';

        $params = [
            ':uuid'      => $uuid,
            'sha256'     => $sha256,
            ':record_id' => $record['record_id'],
        ];
        $stmt = $databox->get_connection()->prepare($sql);
        $stmt->execute($params);
        $stmt->closeCursor();
    }
protected function updateRecordUUID ( \ databox $ databox , array $ record ) { $ pathfile = \ p4string :: addEndSlash ( $ record [ 'path' ] ) . $ record [ 'file' ] ; $ uuid = Uuid :: uuid4 ( ) ; try { $ media = $ this -> app -> getMediaFromUri ( $ pathfile ) ; $ collection = \ collection :: getByCollectionId ( $ this -> $ app , $ databox , ( int ) $ record [ 'coll_id' ] ) ; $ file = new File ( $ this -> app , $ media , $ collection ) ; $ uuid = $ file -> getUUID ( true , true ) ; $ sha256 = $ file -> getSha256 ( ) ; $ this -> app [ 'monolog' ] -> addInfo ( sprintf ( "Upgrading record %d with uuid %s" , $ record [ 'record_id' ] , $ uuid ) ) ; } catch ( \ Exception $ e ) { $ this -> app [ 'monolog' ] -> addError ( sprintf ( "Uuid upgrade for record %s failed" , $ record [ 'record_id' ] ) ) ; } $ sql = 'UPDATE record SET uuid = :uuid, sha256 = :sha256 WHERE record_id = :record_id' ; $ params = [ ':uuid' => $ uuid , 'sha256' => $ sha256 , ':record_id' => $ record [ 'record_id' ] , ] ; $ stmt = $ databox -> get_connection ( ) -> prepare ( $ sql ) ; $ stmt -> execute ( $ params ) ; $ stmt -> closeCursor ( ) ; }
Update a record with a UUID

@param \databox $databox
@param array    $record
Update a record with a UUID