Update to version 3.7.0.0a4, patch old phraseanet TF tags with their new names

This commit is contained in:
Romain Neutron
2012-05-18 11:28:00 +02:00
parent ab6ce951a9
commit 756c2b605b
4 changed files with 400 additions and 410 deletions

View File

@@ -18,7 +18,7 @@ namespace Alchemy\Phrasea\Core;
*/
class Version
{
protected static $number = '3.7.0.0.a3';
protected static $number = '3.7.0.0.a4';
protected static $name = 'Carnosaurus';
public static function getNumber()

View File

@@ -0,0 +1,90 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2012 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
*
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class patch_370a4 implements patchInterface
{
/**
*
* @var string
*/
private $release = '3.7.0.0.a4';
/**
*
* @var Array
*/
private $concern = array(base::DATA_BOX);
/**
*
* @return string
*/
function get_release()
{
return $this->release;
}
public function require_all_upgrades()
{
return false;
}
/**
*
* @return Array
*/
function concern()
{
return $this->concern;
}
function apply(base &$databox)
{
$sql = 'SELECT id, src FROM metadatas_structure';
$stmt = $databox->get_connection()->prepare($sql);
$stmt->execute();
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt->closeCursor();
$update = array();
$tagDirname = new \Alchemy\Phrasea\Metadata\Tag\TfDirname();
$tagBasename = new \Alchemy\Phrasea\Metadata\Tag\TfBasename();
foreach ($rs as $row) {
if (strpos(strtolower($row['src']), 'tf-parentdir') !== false) {
$update[] = array('id' => $row['id'], 'src' => $tagDirname->getTagname());
}
if (strpos(strtolower($row['src']), 'tf-filename') !== false) {
$update[] = array('id' => $row['id'], 'src' => $tagBasename->getTagname());
}
}
$sql = 'UPDATE metadatas_structure SET src = :src WHERE id = :id';
$stmt = $databox->get_connection()->prepare($sql);
foreach ($update as $row) {
$stmt->execute(array(':src' => $row['src'], ':id' => $row['id']));
}
$stmt->closeCursor();
return true;
}
}

View File

@@ -133,77 +133,27 @@
</subdefs>
<description>
<!-- 2:5 -->
<Object src="/rdf:RDF/rdf:Description/IPTC:ObjectName" />
<!-- 2:15 -->
<Category src="/rdf:RDF/rdf:Description/IPTC:Category"/>
<!-- 2:20 -->
<SupplCategory src="/rdf:RDF/rdf:Description/IPTC:SupplementalCategories"/>
<!-- 2:25 -->
<Keywords src="/rdf:RDF/rdf:Description/IPTC:Keywords" multi="1"/>
<!-- 2:40 -->
<SpecialInstruct src="/rdf:RDF/rdf:Description/IPTC:SpecialInstructions"/>
<!-- 2:55 -->
<Date src="/rdf:RDF/rdf:Description/IPTC:DateCreated" type="date" />
<!-- 2:80 -->
<Byline src="/rdf:RDF/rdf:Description/IPTC:By-line"/>
<!-- 2:85 -->
<BylineTitle src="/rdf:RDF/rdf:Description/IPTC:By-lineTitle"/>
<!-- 2:90 -->
<City src="/rdf:RDF/rdf:Description/IPTC:City" />
<!-- 2:95 -->
<Province src="/rdf:RDF/rdf:Description/IPTC:Province-State" />
<!-- 2:101 -->
<Country src="/rdf:RDF/rdf:Description/IPTC:Country-PrimaryLocationName" />
<!-- 2:103 -->
<OriginalRef src="/rdf:RDF/rdf:Description/IPTC:OriginalTransmissionReference" />
<!-- 2:105 -->
<Headline src="/rdf:RDF/rdf:Description/IPTC:Headline" report="1" />
<!-- 2:110 -->
<Credit src="/rdf:RDF/rdf:Description/IPTC:Credit" report="1" />
<!-- 2:115 -->
<Source src="/rdf:RDF/rdf:Description/IPTC:Source" />
<!-- 2:120 -->
<Caption src="/rdf:RDF/rdf:Description/IPTC:Caption-Abstract" />
<!-- 2:122 -->
<CaptionWriter src="/rdf:RDF/rdf:Description/IPTC:Writer-Editor" />
<!-- 2:25 -->
<Longitude src="/rdf:RDF/rdf:Description/GPS:GPSLongitude" readonly="1"/>
<!-- 2:25 -->
<Latitude src="/rdf:RDF/rdf:Description/GPS:GPSLatitude" readonly="1"/>
<!-- 2:25 -->
<CameraModel src="/rdf:RDF/rdf:Description/IFD0:Model" readonly="1"/>
<!-- Technical Fields -->
<FileName src="/rdf:RDF/rdf:Description/PHRASEANET:tf-filename" readonly="1" type="text" />
<FilePath src="/rdf:RDF/rdf:Description/PHRASEANET:tf-filepath" index="0" readonly="1" type="text" />
<Recordid src="/rdf:RDF/rdf:Description/PHRASEANET:tf-recordid" index="0" readonly="1" type="number" />
<MimeType src="/rdf:RDF/rdf:Description/PHRASEANET:tf-mimetype" index="0" readonly="1" type="text" />
<Size src="/rdf:RDF/rdf:Description/PHRASEANET:tf-size" index="0" readonly="1" type="number" />
<Extension src="/rdf:RDF/rdf:Description/PHRASEANET:tf-extension" index="0" readonly="1" type="text" />
<Width src="/rdf:RDF/rdf:Description/PHRASEANET:tf-width" index="0" readonly="1" type="number" />
<Height src="/rdf:RDF/rdf:Description/PHRASEANET:tf-height" index="0" readonly="1" type="number" />
<Bits src="/rdf:RDF/rdf:Description/PHRASEANET:tf-bits" index="0" readonly="1" type="number" />
<Channels src="/rdf:RDF/rdf:Description/PHRASEANET:tf-channels" index="0" readonly="1" type="number" />
<FileName src="/rdf:RDF/rdf:Description/PHRASEANET:tf-basename" readonly="1" type="text" />
</description>
<statbits>

View File

@@ -133,77 +133,27 @@
<description>
<!-- 2:5 -->
<Objet src="/rdf:RDF/rdf:Description/IPTC:ObjectName" />
<!-- 2:15 -->
<Categorie src="/rdf:RDF/rdf:Description/IPTC:Category"/>
<!-- 2:20 -->
<AutresCategories src="/rdf:RDF/rdf:Description/IPTC:SupplementalCategories"/>
<!-- 2:25 -->
<MotsCles src="/rdf:RDF/rdf:Description/IPTC:Keywords" multi="1"/>
<!-- 2:40 -->
<Observations src="/rdf:RDF/rdf:Description/IPTC:SpecialInstructions"/>
<!-- 2:55 -->
<Date src="/rdf:RDF/rdf:Description/IPTC:DateCreated" type="date" />
<!-- 2:80 -->
<Signature src="/rdf:RDF/rdf:Description/IPTC:By-line"/>
<!-- 2:85 -->
<TitreCredits src="/rdf:RDF/rdf:Description/IPTC:By-lineTitle"/>
<!-- 2:90 -->
<Ville src="/rdf:RDF/rdf:Description/IPTC:City" />
<!-- 2:95 -->
<Province src="/rdf:RDF/rdf:Description/IPTC:Province-State" />
<!-- 2:101 -->
<Pays src="/rdf:RDF/rdf:Description/IPTC:Country-PrimaryLocationName" />
<!-- 2:103 -->
<ReferencesOriginales src="/rdf:RDF/rdf:Description/IPTC:OriginalTransmissionReference" />
<!-- 2:105 -->
<Titre src="/rdf:RDF/rdf:Description/IPTC:Headline" report="1" />
<!-- 2:110 -->
<Credit src="/rdf:RDF/rdf:Description/IPTC:Credit" report="1" />
<!-- 2:115 -->
<Source src="/rdf:RDF/rdf:Description/IPTC:Source" />
<!-- 2:120 -->
<Legende src="/rdf:RDF/rdf:Description/IPTC:Caption-Abstract" />
<!-- 2:122 -->
<Redacteur src="/rdf:RDF/rdf:Description/IPTC:Writer-Editor" />
<!-- 2:25 -->
<Longitude src="/rdf:RDF/rdf:Description/GPS:GPSLongitude" readonly="1"/>
<!-- 2:25 -->
<Latitude src="/rdf:RDF/rdf:Description/GPS:GPSLatitude" readonly="1"/>
<!-- 2:25 -->
<AppareilPhoto src="/rdf:RDF/rdf:Description/IFD0:Model" readonly="1"/>
<!-- Champs Techniques -->
<NomDeFichier src="/rdf:RDF/rdf:Description/PHRASEANET:tf-filename" readonly="1" type="text" />
<Chemin src="/rdf:RDF/rdf:Description/PHRASEANET:tf-filepath" index="0" readonly="1" type="text" />
<Recordid src="/rdf:RDF/rdf:Description/PHRASEANET:tf-recordid" index="0" readonly="1" type="number" />
<TypeMime src="/rdf:RDF/rdf:Description/PHRASEANET:tf-mimetype" index="0" readonly="1" type="text" />
<Taille src="/rdf:RDF/rdf:Description/PHRASEANET:tf-size" index="0" readonly="1" type="number" />
<Extension src="/rdf:RDF/rdf:Description/PHRASEANET:tf-extension" index="0" readonly="1" type="text" />
<Largeur src="/rdf:RDF/rdf:Description/PHRASEANET:tf-width" index="0" readonly="1" type="number" />
<Hauteur src="/rdf:RDF/rdf:Description/PHRASEANET:tf-height" index="0" readonly="1" type="number" />
<Bits src="/rdf:RDF/rdf:Description/PHRASEANET:tf-bits" index="0" readonly="1" type="number" />
<Couche src="/rdf:RDF/rdf:Description/PHRASEANET:tf-channels" index="0" readonly="1" type="number" />
<NomDeFichier src="/rdf:RDF/rdf:Description/PHRASEANET:tf-basename" readonly="1" type="text" />
</description>
<statbits>