Remove deprecated patches

This commit is contained in:
Romain Neutron
2012-10-02 15:50:08 +02:00
parent 5be0104ea2
commit c9bea452d1
8 changed files with 0 additions and 859 deletions

View File

@@ -1,143 +0,0 @@
<?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.
*/
use Alchemy\Phrasea\Application;
/**
*
*
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class patch_303 implements patchInterface
{
/**
*
* @var string
*/
private $release = '3.0.3';
/**
*
* @var Array
*/
private $concern = array(base::APPLICATION_BOX);
/**
*
* @return string
*/
public function get_release()
{
return $this->release;
}
public function require_all_upgrades()
{
return false;
}
/**
*
* @return Array
*/
public function concern()
{
return $this->concern;
}
public function apply(base $appbox, Application $app)
{
$this->update_users_log_datas($appbox, $app);
$this->update_users_search_datas($appbox, $app);
return true;
}
/**
*
* @return patch_303
*/
public function update_users_log_datas(appbox $appbox, Application $app)
{
$col = array('fonction', 'societe', 'activite', 'pays');
$f_req = implode(', ', $col);
$sql = "SELECT usr_id, " . $f_req . " FROM usr";
$stmt = $appbox->get_connection()->prepare($sql);
$stmt->execute();
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt->closeCursor();
foreach ($rs as $row) {
$tab_usr[$row['usr_id']] = array(
'fonction' => $row['fonction'],
'societe' => $row['societe'],
'activite' => $row['activite'],
'pays' => $row['pays']
);
}
foreach ($appbox->get_databoxes() as $databox) {
foreach ($tab_usr as $id => $columns) {
$f_req = array();
$params = array(':usr_id' => $id, ':site' => $app['phraseanet.registry']->get('GV_sit'));
foreach ($columns as $column => $value) {
$column = trim($column);
$f_req[] = $column . " = :" . $column;
$params[':' . $column] = $value;
}
$f_req = implode(', ', $f_req);
$sql = "UPDATE log SET " . $f_req . "
WHERE usrid = :usr_id AND site = :site";
$stmt = $databox->get_connection()->prepare($sql);
$stmt->execute($params);
$stmt->closeCursor();
}
}
return $this;
}
/**
*
* @return patch_303
*/
public function update_users_search_datas(appbox $appbox, Application $app)
{
foreach ($appbox->get_databoxes() as $databox) {
$date_debut = '0000-00-00 00:00:00';
$sql = 'SELECT MAX(date) as debut FROM `log_search`';
$stmt = $databox->get_connection()->prepare($sql);
$stmt->execute();
$row = $stmt->fetch(PDO::FETCH_ASSOC);
$stmt->closeCursor();
if ($row) {
$date_debut = $row['debut'];
}
$sql = 'REPLACE INTO log_search
(SELECT null as id, logid as log_id, date, askquest as search,
nbrep as results, coll_id
FROM quest
WHERE `date` > :date)';
$stmt = $databox->get_connection()->prepare($sql);
$stmt->execute(array(':date' => $date_debut));
$stmt->closeCursor();
}
return $this;
}
}

View File

@@ -1,77 +0,0 @@
<?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.
*/
use Alchemy\Phrasea\Application;
/**
*
*
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class patch_304 implements patchInterface
{
/**
*
* @var string
*/
private $release = '3.0.4';
/**
*
* @var Array
*/
private $concern = array(base::DATA_BOX);
/**
*
* @return string
*/
public function get_release()
{
return $this->release;
}
public function require_all_upgrades()
{
return false;
}
/**
*
* @return Array
*/
public function concern()
{
return $this->concern;
}
public function apply(base $databox, Application $app)
{
$sql = 'SELECT id FROM pref WHERE prop = "indexes"';
$stmt = $databox->get_connection()->prepare($sql);
$stmt->execute();
$rowcount = $stmt->rowCount();
$stmt->closeCursor();
if ($rowcount == 0) {
$sql = 'INSERT INTO pref
(id, prop, value, locale, updated_on, created_on)
VALUES
(null, "indexes", "1", "", NOW(), NOW())';
$stmt = $databox->get_connection()->prepare($sql);
$stmt->execute();
$stmt->closeCursor();
}
return true;
}
}

View File

@@ -1,70 +0,0 @@
<?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.
*/
use Alchemy\Phrasea\Application;
/**
*
*
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class patch_305 implements patchInterface
{
/**
*
* @var string
*/
private $release = '3.0.5';
/**
*
* @var Array
*/
private $concern = array(base::APPLICATION_BOX);
/**
*
* @return string
*/
public function get_release()
{
return $this->release;
}
public function require_all_upgrades()
{
return false;
}
/**
*
* @return Array
*/
public function concern()
{
return $this->concern;
}
public function apply(base $appbox, Application $app)
{
$sql = 'REPLACE INTO usr_settings
(SELECT usr_id, "start_page_query" as prop, last_query as value
FROM usr
WHERE model_of="0" AND usr_login NOT LIKE "(#deleted_%")';
$stmt = $appbox->get_connection()->prepare($sql);
$stmt->execute();
$stmt->closeCursor();
return true;
}
}

View File

@@ -1,84 +0,0 @@
<?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.
*/
use Alchemy\Phrasea\Application;
/**
*
*
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class patch_306 implements patchInterface
{
/**
*
* @var string
*/
private $release = '3.0.6';
/**
*
* @var Array
*/
private $concern = array(base::DATA_BOX);
/**
*
* @return string
*/
public function get_release()
{
return $this->release;
}
public function require_all_upgrades()
{
return false;
}
/**
*
* @return Array
*/
public function concern()
{
return $this->concern;
}
public function apply(base $databox, Application $app)
{
$dom = $databox->get_dom_structure();
$xpath = $databox->get_xpath_structure();
$res = $xpath->query('/record/subdefs/preview/type');
foreach ($res as $type) {
if ($type->nodeValue == 'video') {
$preview = $type->parentNode;
$to_add = array(
'acodec' => 'faac',
'vcodec' => 'libx264',
'bitrate' => '700'
);
foreach ($to_add as $k => $v) {
$el = $dom->createElement($k);
$el->appendChild($dom->createTextNode($v));
$preview->appendChild($el);
}
}
}
$databox->saveStructure($dom);
return true;
}
}

View File

@@ -1,164 +0,0 @@
<?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.
*/
use Alchemy\Phrasea\Application;
/**
*
*
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class patch_310 implements patchInterface
{
/**
*
* @var string
*/
private $release = '3.1.0';
/**
*
* @var Array
*/
private $concern = array(base::DATA_BOX);
/**
*
* @return string
*/
public function get_release()
{
return $this->release;
}
public function require_all_upgrades()
{
return false;
}
/**
*
* @return Array
*/
public function concern()
{
return $this->concern;
}
public function apply(base $databox, Application $app)
{
$dom_structure = $databox->get_dom_structure();
$sx_structure = $databox->get_sxml_structure();
$subdefgroups = $sx_structure->xpath('//subdefgroup');
if (count($subdefgroups) > 0) {
return;
}
$subdefs = $sx_structure->xpath('/record/subdefs');
if (count($subdefs) > 1)
exit('La structure semble erronnée, veuillez la corriger');
$new_subefs_node = $dom_structure->createElement('subdefs');
$subdefs_groups = array();
foreach ($subdefs[0] as $k => $v) {
$type = isset($v->type) ? (string) $v->type : 'image';
if ($type == 'image')
$media = 'image';
elseif ($type == 'audio') {
if ($v->method == 'MP3')
$media = "audio";
else
$media = "image";
} elseif ($type == 'video') {
if ($v->method == 'AnimGIF')
$media = "gif";
elseif ($v->method == 'JPG')
$media = "image";
else
$media = 'video';
}
if ( ! isset($subdefs_groups[$type])) {
$subdefs_groups[$type] = $dom_structure->createElement('subdefgroup');
$subdefs_groups[$type]->setAttribute('name', $type);
}
$dom_subdef = $dom_structure->createElement('subdef');
$class = ($k == 'preview' ? 'preview' : 'thumbnail');
$dom_subdef->setAttribute('class', $class);
$dom_subdef->setAttribute('name', $k);
$dom_subdef->setAttribute('downloadable', 'true');
foreach ($v as $tag => $value) {
if (in_array($tag, array('type', 'name')))
continue;
$dom_element = $dom_structure->createElement($tag, $value);
$dom_subdef->appendChild($dom_element);
}
$dom_element = $dom_structure->createElement('mediatype', $media);
$dom_subdef->appendChild($dom_element);
if ($media == 'video') {
$dom_element = $dom_structure->createElement('threads', '1');
$dom_subdef->appendChild($dom_element);
}
//preview, thumbnail et thumbnailGIF
if ($k == 'preview') {
$dom_element =
$dom_structure->createElement('label', 'Prévisualisation');
$dom_element->setAttribute('xml:lang', 'fr');
$dom_subdef->appendChild($dom_element);
$dom_element = $dom_structure->createElement('label', 'Preview');
$dom_element->setAttribute('lang', 'en');
$dom_subdef->appendChild($dom_element);
} elseif ($k == 'thumbnailGIF') {
$dom_element = $dom_structure->createElement('label', 'Animation GIF');
$dom_element->setAttribute('lang', 'fr');
$dom_subdef->appendChild($dom_element);
$dom_element = $dom_structure->createElement('label', 'GIF animation');
$dom_element->setAttribute('lang', 'en');
$dom_subdef->appendChild($dom_element);
} else {
$dom_element = $dom_structure->createElement('label', 'Imagette');
$dom_element->setAttribute('lang', 'fr');
$dom_subdef->appendChild($dom_element);
$dom_element = $dom_structure->createElement('label', 'Thumbnail');
$dom_element->setAttribute('lang', 'en');
$dom_subdef->appendChild($dom_element);
}
$subdefs_groups[$type]->appendChild($dom_subdef);
}
foreach ($subdefs_groups as $type => $node)
$new_subefs_node->appendChild($node);
$record = $dom_structure->documentElement;
$record->replaceChild(
$new_subefs_node, $record->getElementsByTagName('subdefs')->item(0)
);
$databox->saveStructure($dom_structure);
return true;
}
}

View File

@@ -1,147 +0,0 @@
<?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.
*/
use Alchemy\Phrasea\Application;
/**
*
*
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class patch_3103 implements patchInterface
{
/**
*
* @var string
*/
private $release = '3.1.0';
/**
*
* @var Array
*/
private $concern = array(base::APPLICATION_BOX);
/**
*
* @return string
*/
public function get_release()
{
return $this->release;
}
public function require_all_upgrades()
{
return true;
}
/**
*
* @return Array
*/
public function concern()
{
return $this->concern;
}
public function apply(base $appbox, Application $app)
{
$conn = $appbox->get_connection();
$validate_process = array();
$sql = 'SELECT id, ssel_id, usr_id FROM validate';
$stmt = $conn->prepare($sql);
$stmt->execute();
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt->closeCursor();
foreach ($rs as $row) {
$validate_process[$row['ssel_id']][$row['usr_id']] = $row['id'];
}
$sql = 'SELECT u.*, s.ssel_id, c.base_id, c.record_id , s.usr_id as pushFrom
FROM sselcontusr u, sselcont c, ssel s' .
' WHERE s.ssel_id = c.ssel_id AND u.sselcont_id = c.sselcont_id' .
' AND s.deleted="0" ' .
' ORDER BY s.ssel_id ASC, c.sselcont_id ASC';
$stmt = $conn->prepare($sql);
$stmt->execute();
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt->closeCursor();
foreach ($rs as $row) {
if ( ! isset($validate_process[$row['ssel_id']]) ||
! array_key_exists($row['usr_id'], $validate_process[$row['ssel_id']])
) {
$sql = 'INSERT INTO validate
(id, ssel_id, created_on, updated_on, expires_on, last_reminder,
usr_id, confirmed, can_agree, can_see_others)
VALUES
(null, :ssel_id, :created_on, :updated_on, :expires_on, null,
:usr_id, "0", :can_agree, :can_see)';
$stmt = $conn->prepare($sql);
$expire = new DateTime($row['dateFin']);
$expire = $expire->format('u') == 0 ?
null : $app['date-formatter']->format_mysql($expire);
$params = array(
':ssel_id' => $row['ssel_id']
, ':created_on' => $row['date_maj']
, ':updated_on' => $row['date_maj']
, ':expires_on' => $expire
, ':usr_id' => $row['usr_id']
, ':can_agree' => $row['canAgree']
, ':can_see' => $row['canSeeOther']
);
$stmt->execute($params);
$validate_process[$row['ssel_id']][$row['usr_id']] = $conn->lastInsertId();
$stmt->closeCursor();
$sbas_id = phrasea::sbasFromBas($app, $row['base_id']);
$record = new record_adapter($app, $sbas_id, $row['record_id']);
$user = User_Adapter::getInstance($row['usr_id'], $app);
$pusher = User_Adapter::getInstance($row['pushFrom'], $app);
if ($row['canHD'])
$user->ACL()->grant_hd_on($record, $pusher, 'validate');
else
$user->ACL()->grant_preview_on($record, $pusher, 'validate');
}
$sql = 'REPLACE INTO validate_datas
(id, validate_id, sselcont_id, updated_on, agreement)
VALUES
(null, :validate_id, :sselcont_id, :updated_on, :agreement)';
$stmt = $conn->prepare($sql);
$params = array(
':validate_id' => $validate_process[$row['ssel_id']][$row['usr_id']]
, ':sselcont_id' => $row['sselcont_id']
, ':updated_on' => $row['date_maj']
, ':agreement' => $row['agree']
);
$stmt->execute($params);
$stmt->closeCursor();
}
return true;
}
}

View File

@@ -1,69 +0,0 @@
<?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.
*/
use Alchemy\Phrasea\Application;
/**
*
*
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class patch_311 implements patchInterface
{
/**
*
* @var string
*/
private $release = '3.1.1';
/**
*
* @var Array
*/
private $concern = array(base::DATA_BOX);
/**
*
* @return string
*/
public function get_release()
{
return $this->release;
}
public function require_all_upgrades()
{
return false;
}
/**
*
* @return Array
*/
public function concern()
{
return $this->concern;
}
public function apply(base $databox, Application $app)
{
$sql = 'UPDATE record SET jeton = '
. (JETON_WRITE_META_DOC | JETON_WRITE_META_SUBDEF);
$stmt = $databox->get_connection()->prepare($sql);
$stmt->execute();
$stmt->closeCursor();
return true;
}
}

View File

@@ -1,105 +0,0 @@
<?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.
*/
use Alchemy\Phrasea\Application;
/**
*
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class patch_320aa implements patchInterface
{
/**
*
* @var string
*/
private $release = '3.2.0.0.a1';
/**
*
* @var Array
*/
private $concern = array(base::APPLICATION_BOX);
/**
*
* @return string
*/
public function get_release()
{
return $this->release;
}
public function require_all_upgrades()
{
return false;
}
/**
*
* @return Array
*/
public function concern()
{
return $this->concern;
}
public function apply(base $appbox, Application $app)
{
if (is_file(__DIR__ . '/../../../config/_GV.php')) {
require __DIR__ . '/../../../config/_GV.php';
} else {
return;
}
require __DIR__ . '/../../../lib/conf.d/_GV_template.inc';
define('GV_STATIC_URL', '');
define('GV_sphinx', false);
define('GV_sphinx_host', '');
define('GV_sphinx_port', '');
define('GV_sphinx_rt_host', '');
define('GV_sphinx_rt_port', '');
foreach ($GV as $section => $datas_section) {
foreach ($datas_section['vars'] as $datas) {
$app['phraseanet.registry']->un_set($datas['name']);
eval('$test = defined("' . $datas["name"] . '");');
if ( ! $test) {
continue;
}
eval('$val = ' . $datas["name"] . ';');
$val = $val === true ? '1' : $val;
$val = $val === false ? '0' : $val;
switch ($datas['type']) {
case registry::TYPE_ENUM_MULTI:
case registry::TYPE_INTEGER:
case registry::TYPE_BOOLEAN:
case registry::TYPE_STRING:
case registry::TYPE_ARRAY:
$type = $datas['type'];
break;
default:
$type = registry::TYPE_STRING;
break;
}
$app['phraseanet.registry']->set($datas['name'], $val, $type);
}
}
$app['phraseanet.registry']->un_set('registry_loaded');
return true;
}
}