mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 15:03:25 +00:00
Fix CS
This commit is contained in:
@@ -17,12 +17,12 @@
|
||||
*/
|
||||
class patch_303 implements patchInterface
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $release = '3.0.3';
|
||||
|
||||
/**
|
||||
*
|
||||
* @var Array
|
||||
@@ -76,24 +76,20 @@ class patch_303 implements patchInterface
|
||||
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
$stmt->closeCursor();
|
||||
|
||||
foreach ($rs as $row)
|
||||
{
|
||||
foreach ($rs as $row) {
|
||||
$tab_usr[$row['usr_id']] = array(
|
||||
'fonction' => $row['fonction'],
|
||||
'societe' => $row['societe'],
|
||||
'activite' => $row['activite'],
|
||||
'pays' => $row['pays']
|
||||
'fonction' => $row['fonction'],
|
||||
'societe' => $row['societe'],
|
||||
'activite' => $row['activite'],
|
||||
'pays' => $row['pays']
|
||||
);
|
||||
}
|
||||
|
||||
foreach ($appbox->get_databoxes() as $databox)
|
||||
{
|
||||
foreach ($tab_usr as $id => $columns)
|
||||
{
|
||||
foreach ($appbox->get_databoxes() as $databox) {
|
||||
foreach ($tab_usr as $id => $columns) {
|
||||
$f_req = array();
|
||||
$params = array(':usr_id' => $id, ':site' => $appbox->get_registry()->get('GV_sit'));
|
||||
foreach ($columns as $column => $value)
|
||||
{
|
||||
$params = array(':usr_id' => $id, ':site' => $appbox->get_registry()->get('GV_sit'));
|
||||
foreach ($columns as $column => $value) {
|
||||
$column = trim($column);
|
||||
$f_req[] = $column . " = :" . $column;
|
||||
$params[':' . $column] = $value;
|
||||
@@ -116,8 +112,7 @@ class patch_303 implements patchInterface
|
||||
*/
|
||||
function update_users_search_datas(appbox &$appbox)
|
||||
{
|
||||
foreach ($appbox->get_databoxes() as $databox)
|
||||
{
|
||||
foreach ($appbox->get_databoxes() as $databox) {
|
||||
$date_debut = '0000-00-00 00:00:00';
|
||||
|
||||
$sql = 'SELECT MAX(date) as debut FROM `log_search`';
|
||||
@@ -127,8 +122,7 @@ class patch_303 implements patchInterface
|
||||
$row = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
$stmt->closeCursor();
|
||||
|
||||
if ($row)
|
||||
{
|
||||
if ($row) {
|
||||
$date_debut = $row['debut'];
|
||||
}
|
||||
|
||||
@@ -144,5 +138,4 @@ class patch_303 implements patchInterface
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -17,7 +17,6 @@
|
||||
*/
|
||||
class patch_304 implements patchInterface
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
@@ -61,8 +60,7 @@ class patch_304 implements patchInterface
|
||||
$rowcount = $stmt->rowCount();
|
||||
$stmt->closeCursor();
|
||||
|
||||
if ($rowcount == 0)
|
||||
{
|
||||
if ($rowcount == 0) {
|
||||
$sql = 'INSERT INTO pref
|
||||
(id, prop, value, locale, updated_on, created_on)
|
||||
VALUES
|
||||
@@ -74,5 +72,4 @@ class patch_304 implements patchInterface
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -17,12 +17,12 @@
|
||||
*/
|
||||
class patch_305 implements patchInterface
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $release = '3.0.5';
|
||||
|
||||
/**
|
||||
*
|
||||
* @var Array
|
||||
@@ -65,5 +65,4 @@ class patch_305 implements patchInterface
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -17,12 +17,12 @@
|
||||
*/
|
||||
class patch_306 implements patchInterface
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $release = '3.0.6';
|
||||
|
||||
/**
|
||||
*
|
||||
* @var Array
|
||||
@@ -58,19 +58,16 @@ class patch_306 implements patchInterface
|
||||
$xpath = $databox->get_xpath_structure();
|
||||
$res = $xpath->query('/record/subdefs/preview/type');
|
||||
|
||||
foreach ($res as $type)
|
||||
{
|
||||
if ($type->nodeValue == 'video')
|
||||
{
|
||||
foreach ($res as $type) {
|
||||
if ($type->nodeValue == 'video') {
|
||||
$preview = $type->parentNode;
|
||||
|
||||
$to_add = array(
|
||||
'acodec' => 'faac',
|
||||
'vcodec' => 'libx264',
|
||||
'bitrate' => '700'
|
||||
'acodec' => 'faac',
|
||||
'vcodec' => 'libx264',
|
||||
'bitrate' => '700'
|
||||
);
|
||||
foreach ($to_add as $k => $v)
|
||||
{
|
||||
foreach ($to_add as $k => $v) {
|
||||
$el = $dom->createElement($k);
|
||||
$el->appendChild($dom->createTextNode($v));
|
||||
$preview->appendChild($el);
|
||||
@@ -82,5 +79,4 @@ class patch_306 implements patchInterface
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -17,12 +17,12 @@
|
||||
*/
|
||||
class patch_310 implements patchInterface
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $release = '3.1.0';
|
||||
|
||||
/**
|
||||
*
|
||||
* @var Array
|
||||
@@ -60,7 +60,6 @@ class patch_310 implements patchInterface
|
||||
$subdefgroups = $sx_structure->xpath('//subdefgroup');
|
||||
|
||||
if (count($subdefgroups) > 0)
|
||||
|
||||
return;
|
||||
|
||||
$subdefs = $sx_structure->xpath('/record/subdefs');
|
||||
@@ -72,21 +71,18 @@ class patch_310 implements patchInterface
|
||||
|
||||
$subdefs_groups = array();
|
||||
|
||||
foreach ($subdefs[0] as $k => $v)
|
||||
{
|
||||
foreach ($subdefs[0] as $k => $v) {
|
||||
$type = isset($v->type) ? (string) $v->type : 'image';
|
||||
|
||||
if ($type == 'image')
|
||||
$media = 'image';
|
||||
elseif ($type == 'audio')
|
||||
{
|
||||
elseif ($type == 'audio') {
|
||||
if ($v->method == 'MP3')
|
||||
$media = "audio";
|
||||
else
|
||||
$media = "image";
|
||||
}
|
||||
elseif ($type == 'video')
|
||||
{
|
||||
elseif ($type == 'video') {
|
||||
if ($v->method == 'AnimGIF')
|
||||
$media = "gif";
|
||||
elseif ($v->method == 'JPG')
|
||||
@@ -95,8 +91,7 @@ class patch_310 implements patchInterface
|
||||
$media = 'video';
|
||||
}
|
||||
|
||||
if (!isset($subdefs_groups[$type]))
|
||||
{
|
||||
if ( ! isset($subdefs_groups[$type])) {
|
||||
$subdefs_groups[$type] = $dom_structure->createElement('subdefgroup');
|
||||
$subdefs_groups[$type]->setAttribute('name', $type);
|
||||
}
|
||||
@@ -107,8 +102,7 @@ class patch_310 implements patchInterface
|
||||
$dom_subdef->setAttribute('name', $k);
|
||||
$dom_subdef->setAttribute('downloadable', 'true');
|
||||
|
||||
foreach ($v as $tag => $value)
|
||||
{
|
||||
foreach ($v as $tag => $value) {
|
||||
if (in_array($tag, array('type', 'name')))
|
||||
continue;
|
||||
|
||||
@@ -118,35 +112,29 @@ class patch_310 implements patchInterface
|
||||
$dom_element = $dom_structure->createElement('mediatype', $media);
|
||||
$dom_subdef->appendChild($dom_element);
|
||||
|
||||
if ($media == 'video')
|
||||
{
|
||||
if ($media == 'video') {
|
||||
$dom_element = $dom_structure->createElement('threads', '1');
|
||||
$dom_subdef->appendChild($dom_element);
|
||||
}
|
||||
|
||||
|
||||
//preview, thumbnail et thumbnailGIF
|
||||
if ($k == 'preview')
|
||||
{
|
||||
if ($k == 'preview') {
|
||||
$dom_element =
|
||||
$dom_structure->createElement('label', 'Prévisualisation');
|
||||
$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')
|
||||
{
|
||||
} 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
|
||||
{
|
||||
} else {
|
||||
$dom_element = $dom_structure->createElement('label', 'Imagette');
|
||||
$dom_element->setAttribute('lang', 'fr');
|
||||
$dom_subdef->appendChild($dom_element);
|
||||
@@ -164,14 +152,12 @@ class patch_310 implements patchInterface
|
||||
$record = $dom_structure->documentElement;
|
||||
|
||||
$record->replaceChild(
|
||||
$new_subefs_node,
|
||||
$record->getElementsByTagName('subdefs')->item(0)
|
||||
$new_subefs_node, $record->getElementsByTagName('subdefs')->item(0)
|
||||
);
|
||||
|
||||
$databox->saveStructure($dom_structure);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@@ -17,7 +17,6 @@
|
||||
*/
|
||||
class patch_3102 implements patchInterface
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
@@ -64,8 +63,7 @@ class patch_3102 implements patchInterface
|
||||
$rowcount = $stmt->rowCount();
|
||||
$stmt->closeCursor();
|
||||
|
||||
if ($rowcount == 0)
|
||||
{
|
||||
if ($rowcount == 0) {
|
||||
$sql = 'INSERT INTO `task2`
|
||||
(`task_id`, `usr_id_owner`, `pid`, `status`, `crashed`,
|
||||
`active`, `name`, `last_exec_time`, `class`, `settings`, `completed`)
|
||||
@@ -73,7 +71,7 @@ class patch_3102 implements patchInterface
|
||||
(null, 0, 0, "stopped", 0, 1, "upgrade to v3.1",
|
||||
"0000-00-00 00:00:00", "task_period_upgradetov31",
|
||||
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>' .
|
||||
'<tasksettings></tasksettings>", -1)';
|
||||
'<tasksettings></tasksettings>", -1)';
|
||||
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
@@ -81,8 +79,7 @@ class patch_3102 implements patchInterface
|
||||
}
|
||||
|
||||
|
||||
if ($base->get_base_type() == base::DATA_BOX)
|
||||
{
|
||||
if ($base->get_base_type() == base::DATA_BOX) {
|
||||
$sql = 'UPDATE record SET sha256 = ""
|
||||
WHERE sha256 IS NULL AND parent_record_id = 0';
|
||||
$stmt = $base->get_connection()->prepare($sql);
|
||||
@@ -92,5 +89,4 @@ class patch_3102 implements patchInterface
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -17,12 +17,12 @@
|
||||
*/
|
||||
class patch_3103 implements patchInterface
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $release = '3.1.0';
|
||||
|
||||
/**
|
||||
*
|
||||
* @var Array
|
||||
@@ -64,28 +64,25 @@ class patch_3103 implements patchInterface
|
||||
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
$stmt->closeCursor();
|
||||
|
||||
foreach ($rs as $row)
|
||||
{
|
||||
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';
|
||||
' 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']])
|
||||
)
|
||||
{
|
||||
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,
|
||||
@@ -98,17 +95,17 @@ class patch_3103 implements patchInterface
|
||||
|
||||
$expire = new DateTime($row['dateFin']);
|
||||
$expire = $expire->format('u') == 0 ?
|
||||
null : phraseadate::format_mysql($expire);
|
||||
null : phraseadate::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']
|
||||
':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);
|
||||
|
||||
@@ -135,10 +132,10 @@ class patch_3103 implements patchInterface
|
||||
$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']
|
||||
':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();
|
||||
@@ -146,5 +143,4 @@ class patch_3103 implements patchInterface
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -17,12 +17,12 @@
|
||||
*/
|
||||
class patch_311 implements patchInterface
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $release = '3.1.1';
|
||||
|
||||
/**
|
||||
*
|
||||
* @var Array
|
||||
@@ -55,7 +55,7 @@ class patch_311 implements patchInterface
|
||||
function apply(base &$databox)
|
||||
{
|
||||
$sql = 'UPDATE record SET jeton = '
|
||||
. (JETON_WRITE_META_DOC | JETON_WRITE_META_SUBDEF);
|
||||
. (JETON_WRITE_META_DOC | JETON_WRITE_META_SUBDEF);
|
||||
|
||||
$stmt = $databox->get_connection()->prepare($sql);
|
||||
$stmt->execute();
|
||||
@@ -63,6 +63,5 @@ class patch_311 implements patchInterface
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@@ -17,12 +17,12 @@
|
||||
*/
|
||||
class patch_320 implements patchInterface
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $release = '3.2.0.0.a1';
|
||||
|
||||
/**
|
||||
*
|
||||
* @var Array
|
||||
@@ -62,6 +62,5 @@ class patch_320 implements patchInterface
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@@ -17,12 +17,12 @@
|
||||
*/
|
||||
class patch_320a implements patchInterface
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $release = '3.2.0.0.a2';
|
||||
|
||||
/**
|
||||
*
|
||||
* @var Array
|
||||
@@ -63,10 +63,9 @@ class patch_320a implements patchInterface
|
||||
|
||||
$sql = 'UPDATE usr SET nonce = :nonce WHERE usr_id = :usr_id';
|
||||
$stmt = $appbox->get_connection()->prepare($sql);
|
||||
foreach ($rs as $row)
|
||||
{
|
||||
foreach ($rs as $row) {
|
||||
$nonce = random::generatePassword(16);
|
||||
$params = array(':usr_id' => $row['usr_id'], ':nonce' => $nonce);
|
||||
$params = array(':usr_id' => $row['usr_id'], ':nonce' => $nonce);
|
||||
$stmt->execute($params);
|
||||
}
|
||||
$stmt->closeCursor();
|
||||
@@ -83,14 +82,13 @@ class patch_320a implements patchInterface
|
||||
|
||||
$sql = 'UPDATE task2 SET `class` = :class WHERE task_id = :task_id';
|
||||
$stmt = $appbox->get_connection()->prepare($sql);
|
||||
foreach ($rs as $row)
|
||||
{
|
||||
foreach ($rs as $row) {
|
||||
if (strpos($row['class'], 'task_period_') !== false)
|
||||
continue;
|
||||
|
||||
$params = array(
|
||||
':task_id' => $row['task_id']
|
||||
, ':class' => str_replace('task_', 'task_period_', $row['class'])
|
||||
':task_id' => $row['task_id']
|
||||
, ':class' => str_replace('task_', 'task_period_', $row['class'])
|
||||
);
|
||||
|
||||
$stmt->execute($params);
|
||||
@@ -100,5 +98,4 @@ class patch_320a implements patchInterface
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -17,12 +17,12 @@
|
||||
*/
|
||||
class patch_320aa implements patchInterface
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $release = '3.2.0.0.a1';
|
||||
|
||||
/**
|
||||
*
|
||||
* @var Array
|
||||
@@ -54,7 +54,7 @@ class patch_320aa implements patchInterface
|
||||
|
||||
function apply(base &$appbox)
|
||||
{
|
||||
if(is_file(__DIR__ . '/../../../config/_GV.php'))
|
||||
if (is_file(__DIR__ . '/../../../config/_GV.php'))
|
||||
require __DIR__ . '/../../../config/_GV.php';
|
||||
require __DIR__ . '/../../../lib/conf.d/_GV_template.inc';
|
||||
|
||||
@@ -67,15 +67,12 @@ class patch_320aa implements patchInterface
|
||||
|
||||
$registry = $appbox->get_registry();
|
||||
|
||||
foreach ($GV as $section => $datas_section)
|
||||
{
|
||||
foreach ($datas_section['vars'] as $datas)
|
||||
{
|
||||
foreach ($GV as $section => $datas_section) {
|
||||
foreach ($datas_section['vars'] as $datas) {
|
||||
|
||||
$registry->un_set($datas['name']);
|
||||
eval('$test = defined("' . $datas["name"] . '");');
|
||||
if (!$test)
|
||||
{
|
||||
if ( ! $test) {
|
||||
continue;
|
||||
}
|
||||
eval('$val = ' . $datas["name"] . ';');
|
||||
@@ -83,13 +80,11 @@ class patch_320aa implements patchInterface
|
||||
$val = $val === true ? '1' : $val;
|
||||
$val = $val === false ? '0' : $val;
|
||||
|
||||
if($datas['name'] == 'GV_exiftool' && strpos($val, 'lib/exiftool/exiftool') !== false)
|
||||
{
|
||||
if ($datas['name'] == 'GV_exiftool' && strpos($val, 'lib/exiftool/exiftool') !== false) {
|
||||
$val = str_replace('lib/exiftool/exiftool', 'lib/vendor/exiftool/exiftool', $val);
|
||||
}
|
||||
|
||||
switch ($datas['type'])
|
||||
{
|
||||
switch ($datas['type']) {
|
||||
case registry::TYPE_ENUM_MULTI:
|
||||
case registry::TYPE_INTEGER:
|
||||
case registry::TYPE_BOOLEAN:
|
||||
@@ -108,5 +103,4 @@ class patch_320aa implements patchInterface
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -17,12 +17,12 @@
|
||||
*/
|
||||
class patch_320ab implements patchInterface
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $release = '3.2.0.0.a1';
|
||||
|
||||
/**
|
||||
*
|
||||
* @var Array
|
||||
@@ -67,5 +67,4 @@ class patch_320ab implements patchInterface
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -15,15 +15,14 @@
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
|
||||
class patch_320b implements patchInterface
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $release = '3.2.0.0.a3';
|
||||
|
||||
/**
|
||||
*
|
||||
* @var Array
|
||||
@@ -63,5 +62,4 @@ class patch_320b implements patchInterface
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -17,7 +17,6 @@
|
||||
*/
|
||||
class patch_320c implements patchInterface
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
@@ -72,42 +71,39 @@ class patch_320c implements patchInterface
|
||||
|
||||
|
||||
$phrasea_maps = array(
|
||||
'pdftext' => '/rdf:RDF/rdf:Description/PHRASEANET:pdftext'
|
||||
, 'tf-archivedate' => '/rdf:RDF/rdf:Description/PHRASEANET:tf-archivedate'
|
||||
, 'tf-atime' => '/rdf:RDF/rdf:Description/PHRASEANET:tf-atime'
|
||||
, 'tf-chgdocdate' => '/rdf:RDF/rdf:Description/PHRASEANET:tf-chgdocdate'
|
||||
, 'tf-ctime' => '/rdf:RDF/rdf:Description/PHRASEANET:tf-ctime'
|
||||
, 'tf-editdate' => '/rdf:RDF/rdf:Description/PHRASEANET:tf-editdate'
|
||||
, 'tf-mtime' => '/rdf:RDF/rdf:Description/PHRASEANET:tf-mtime'
|
||||
, 'tf-parentdir' => '/rdf:RDF/rdf:Description/PHRASEANET:tf-parentdir'
|
||||
, 'tf-bits' => '/rdf:RDF/rdf:Description/PHRASEANET:tf-bits'
|
||||
, 'tf-channels' => '/rdf:RDF/rdf:Description/PHRASEANET:tf-channels'
|
||||
, 'tf-extension' => '/rdf:RDF/rdf:Description/PHRASEANET:tf-extension'
|
||||
, 'tf-filename' => '/rdf:RDF/rdf:Description/PHRASEANET:tf-filename'
|
||||
, 'tf-filepath' => '/rdf:RDF/rdf:Description/PHRASEANET:tf-filepath'
|
||||
, 'tf-height' => '/rdf:RDF/rdf:Description/PHRASEANET:tf-height'
|
||||
, 'tf-mimetype' => '/rdf:RDF/rdf:Description/PHRASEANET:tf-mimetype'
|
||||
, 'tf-recordid' => '/rdf:RDF/rdf:Description/PHRASEANET:tf-recordid'
|
||||
, 'tf-size' => '/rdf:RDF/rdf:Description/PHRASEANET:tf-size'
|
||||
, 'tf-width' => '/rdf:RDF/rdf:Description/PHRASEANET:tf-width'
|
||||
'pdftext' => '/rdf:RDF/rdf:Description/PHRASEANET:pdftext'
|
||||
, 'tf-archivedate' => '/rdf:RDF/rdf:Description/PHRASEANET:tf-archivedate'
|
||||
, 'tf-atime' => '/rdf:RDF/rdf:Description/PHRASEANET:tf-atime'
|
||||
, 'tf-chgdocdate' => '/rdf:RDF/rdf:Description/PHRASEANET:tf-chgdocdate'
|
||||
, 'tf-ctime' => '/rdf:RDF/rdf:Description/PHRASEANET:tf-ctime'
|
||||
, 'tf-editdate' => '/rdf:RDF/rdf:Description/PHRASEANET:tf-editdate'
|
||||
, 'tf-mtime' => '/rdf:RDF/rdf:Description/PHRASEANET:tf-mtime'
|
||||
, 'tf-parentdir' => '/rdf:RDF/rdf:Description/PHRASEANET:tf-parentdir'
|
||||
, 'tf-bits' => '/rdf:RDF/rdf:Description/PHRASEANET:tf-bits'
|
||||
, 'tf-channels' => '/rdf:RDF/rdf:Description/PHRASEANET:tf-channels'
|
||||
, 'tf-extension' => '/rdf:RDF/rdf:Description/PHRASEANET:tf-extension'
|
||||
, 'tf-filename' => '/rdf:RDF/rdf:Description/PHRASEANET:tf-filename'
|
||||
, 'tf-filepath' => '/rdf:RDF/rdf:Description/PHRASEANET:tf-filepath'
|
||||
, 'tf-height' => '/rdf:RDF/rdf:Description/PHRASEANET:tf-height'
|
||||
, 'tf-mimetype' => '/rdf:RDF/rdf:Description/PHRASEANET:tf-mimetype'
|
||||
, 'tf-recordid' => '/rdf:RDF/rdf:Description/PHRASEANET:tf-recordid'
|
||||
, 'tf-size' => '/rdf:RDF/rdf:Description/PHRASEANET:tf-size'
|
||||
, 'tf-width' => '/rdf:RDF/rdf:Description/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)
|
||||
{
|
||||
foreach ($sxe->description->children() as $fname => $field) {
|
||||
$src = trim(isset($field['src']) ? $field['src'] : '');
|
||||
|
||||
if (array_key_exists($src, $phrasea_maps))
|
||||
{
|
||||
if (array_key_exists($src, $phrasea_maps)) {
|
||||
$src = $phrasea_maps[$src];
|
||||
}
|
||||
|
||||
$nodes = $xp_struct->query('/record/description/' . $fname);
|
||||
if ($nodes->length > 0)
|
||||
{
|
||||
if ($nodes->length > 0) {
|
||||
$node = $nodes->item(0);
|
||||
$node->setAttribute('src', $src);
|
||||
$node->removeAttribute('meta_id');
|
||||
@@ -131,7 +127,7 @@ class patch_320c implements patchInterface
|
||||
(null, 0, 0, "stopped", 0, 1, "upgrade to v3.2 for sbas ' . $databox->get_sbas_id() . '",
|
||||
"0000-00-00 00:00:00", "task_period_upgradetov32",
|
||||
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>' .
|
||||
'<tasksettings><sbas_id>' . $databox->get_sbas_id() . '</sbas_id></tasksettings>", -1)';
|
||||
'<tasksettings><sbas_id>' . $databox->get_sbas_id() . '</sbas_id></tasksettings>", -1)';
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
$stmt->closeCursor();
|
||||
@@ -145,18 +141,16 @@ class patch_320c implements patchInterface
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
class extended_databox extends databox
|
||||
{
|
||||
|
||||
public function __construct($sbas_id)
|
||||
{
|
||||
parent::__construct($sbas_id);
|
||||
}
|
||||
|
||||
|
||||
public function migrate_fields()
|
||||
{
|
||||
$this->feed_meta_fields();
|
||||
|
@@ -17,12 +17,12 @@
|
||||
*/
|
||||
class patch_320d implements patchInterface
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $release = '3.2.0.0.a5';
|
||||
|
||||
/**
|
||||
*
|
||||
* @var Array
|
||||
@@ -65,11 +65,10 @@ class patch_320d implements patchInterface
|
||||
WHERE base_id = :base_id AND usr_id = :usr_id';
|
||||
$stmt = $appbox->get_connection()->prepare($sql);
|
||||
|
||||
foreach ($rs as $row)
|
||||
{
|
||||
foreach ($rs as $row) {
|
||||
$params = array(
|
||||
':base_id' => $row['base_id'],
|
||||
':usr_id' => $row['usr_id']
|
||||
':base_id' => $row['base_id'],
|
||||
':usr_id' => $row['usr_id']
|
||||
);
|
||||
$stmt->execute($params);
|
||||
}
|
||||
@@ -78,5 +77,4 @@ class patch_320d implements patchInterface
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -17,7 +17,6 @@
|
||||
*/
|
||||
class patch_320e implements patchInterface
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
@@ -80,8 +79,7 @@ class patch_320e implements patchInterface
|
||||
|
||||
$nodes = $xpath->query('//record/subdefs/subdefgroup/subdef');
|
||||
|
||||
foreach ($nodes as $node)
|
||||
{
|
||||
foreach ($nodes as $node) {
|
||||
$name = mb_strtolower(trim($node->getAttribute('name')));
|
||||
if ($name === '')
|
||||
continue;
|
||||
@@ -92,5 +90,4 @@ class patch_320e implements patchInterface
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -17,12 +17,12 @@
|
||||
*/
|
||||
class patch_320f implements patchInterface
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $release = '3.2.0.0.a4';
|
||||
|
||||
/**
|
||||
*
|
||||
* @var Array
|
||||
@@ -56,15 +56,12 @@ class patch_320f implements patchInterface
|
||||
{
|
||||
$feeds = array();
|
||||
|
||||
try
|
||||
{
|
||||
try {
|
||||
$sql = 'ALTER TABLE `ssel` ADD `migrated` INT NOT NULL DEFAULT "0"';
|
||||
$stmt = $appbox->get_connection()->prepare($sql);
|
||||
$stmt->execute();
|
||||
$stmt->closeCursor();
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
} catch (Exception $e) {
|
||||
|
||||
}
|
||||
|
||||
@@ -79,26 +76,22 @@ class patch_320f implements patchInterface
|
||||
|
||||
$date_ref = new DateTime();
|
||||
|
||||
foreach ($rs as $row)
|
||||
{
|
||||
foreach ($rs as $row) {
|
||||
$user = User_Adapter::getInstance($row['usr_id'], $appbox);
|
||||
|
||||
$feed = $this->get_feed($appbox, $user, $row['pub_restrict'], $row['homelink']);
|
||||
|
||||
if(!$feed instanceof Feed_Adapter)
|
||||
{
|
||||
if ( ! $feed instanceof Feed_Adapter) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$entry = Feed_Entry_Adapter::create($appbox, $feed, array_shift($feed->get_publishers()), $row['name'], $row['descript'], $user->get_display_name(), $user->get_email());
|
||||
$date_create = new DateTime($row['pub_date']);
|
||||
if ($date_create < $date_ref)
|
||||
{
|
||||
if ($date_create < $date_ref) {
|
||||
$date_ref = $date_create;
|
||||
}
|
||||
$entry->set_created_on($date_create);
|
||||
if ($row['updater'] != '0000-00-00 00:00:00')
|
||||
{
|
||||
if ($row['updater'] != '0000-00-00 00:00:00') {
|
||||
$date_update = new DateTime($row['updater']);
|
||||
$entry->set_updated_on($date_update);
|
||||
}
|
||||
@@ -110,15 +103,11 @@ class patch_320f implements patchInterface
|
||||
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
$stmt->closeCursor();
|
||||
|
||||
foreach ($rs as $row)
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach ($rs as $row) {
|
||||
try {
|
||||
$record = new record_adapter(phrasea::sbasFromBas($row['base_id']), $row['record_id']);
|
||||
$item = Feed_Entry_Item::create($appbox, $entry, $record);
|
||||
}
|
||||
catch (Exception_NotFound $e)
|
||||
{
|
||||
} catch (Exception_NotFound $e) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -136,17 +125,14 @@ class patch_320f implements patchInterface
|
||||
|
||||
protected function set_feed_dates(DateTime $date_ref)
|
||||
{
|
||||
foreach (self::$feeds as $array_feeds)
|
||||
{
|
||||
foreach ($array_feeds as $feed)
|
||||
{
|
||||
foreach (self::$feeds as $array_feeds) {
|
||||
foreach ($array_feeds as $feed) {
|
||||
$feed->set_created_on($date_ref);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
protected static $feeds = array();
|
||||
|
||||
protected function get_feed(appbox &$appbox, User_Adapter &$user, $pub_restrict, $homelink)
|
||||
@@ -159,8 +145,7 @@ class patch_320f implements patchInterface
|
||||
else
|
||||
$feed_key = 'feed_public';
|
||||
|
||||
if (!array_key_exists($user_key, self::$feeds) || !isset(self::$feeds[$user_key][$feed_key]))
|
||||
{
|
||||
if ( ! array_key_exists($user_key, self::$feeds) || ! isset(self::$feeds[$user_key][$feed_key])) {
|
||||
if ($homelink == '1')
|
||||
$title = $user->get_display_name() . ' - ' . 'homelink Feed';
|
||||
elseif ($pub_restrict == '1')
|
||||
@@ -170,19 +155,13 @@ class patch_320f implements patchInterface
|
||||
|
||||
$feed = Feed_Adapter::create($appbox, $user, $title, '');
|
||||
|
||||
if ($homelink)
|
||||
{
|
||||
if ($homelink) {
|
||||
$feed->set_public(true);
|
||||
}
|
||||
elseif ($pub_restrict == 1)
|
||||
{
|
||||
} elseif ($pub_restrict == 1) {
|
||||
$collection = array_shift($user->ACL()->get_granted_base());
|
||||
if (!($collection instanceof collection))
|
||||
{
|
||||
foreach ($appbox->get_databoxes() as $databox)
|
||||
{
|
||||
foreach ($databox->get_collections() as $coll)
|
||||
{
|
||||
if ( ! ($collection instanceof collection)) {
|
||||
foreach ($appbox->get_databoxes() as $databox) {
|
||||
foreach ($databox->get_collections() as $coll) {
|
||||
$collection = $coll;
|
||||
break;
|
||||
}
|
||||
@@ -191,8 +170,7 @@ class patch_320f implements patchInterface
|
||||
}
|
||||
}
|
||||
|
||||
if (!($collection instanceof collection))
|
||||
{
|
||||
if ( ! ($collection instanceof collection)) {
|
||||
echo "unable to find a collection to protect feeds";
|
||||
|
||||
return false;
|
||||
@@ -200,13 +178,10 @@ class patch_320f implements patchInterface
|
||||
$feed->set_collection($collection);
|
||||
}
|
||||
self::$feeds[$user_key][$feed_key] = $feed;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$feed = self::$feeds[$user_key][$feed_key];
|
||||
}
|
||||
|
||||
return $feed;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -17,12 +17,12 @@
|
||||
*/
|
||||
class patch_320h implements patchInterface
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $release = '3.2.0.0.a8';
|
||||
|
||||
/**
|
||||
*
|
||||
* @var Array
|
||||
@@ -62,5 +62,4 @@ class patch_320h implements patchInterface
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -17,7 +17,6 @@
|
||||
*/
|
||||
class patch_360 implements patchInterface
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
@@ -57,9 +56,8 @@ class patch_360 implements patchInterface
|
||||
{
|
||||
$tables = array('StoryWZ', 'ValidationDatas', 'ValidationParticipants', 'ValidationSessions', 'BasketElements', 'Baskets');
|
||||
|
||||
foreach ($tables as $table)
|
||||
{
|
||||
$sql = 'DELETE FROM ' . $table;
|
||||
foreach ($tables as $table) {
|
||||
$sql = 'DELETE FROM ' . $table;
|
||||
$stmt = $appbox->get_connection()->prepare($sql);
|
||||
$stmt->execute();
|
||||
$stmt->closeCursor();
|
||||
@@ -79,25 +77,22 @@ class patch_360 implements patchInterface
|
||||
|
||||
$current = array();
|
||||
|
||||
foreach ($rs_s as $row_story)
|
||||
{
|
||||
foreach ($rs_s as $row_story) {
|
||||
$serial = $row_story['sbas_id'] . '_' . $row_story['usr_id'] . '_' . $row_story['record_id'];
|
||||
|
||||
if (isset($current[$serial]))
|
||||
{
|
||||
if (isset($current[$serial])) {
|
||||
$stories[] = $row_story;
|
||||
}
|
||||
|
||||
$current[$serial] = $serial;
|
||||
}
|
||||
|
||||
$sql = 'DELETE FROM ssel
|
||||
$sql = 'DELETE FROM ssel
|
||||
WHERE temporaryType="1" AND record_id = :record_id
|
||||
AND usr_id = :usr_id AND sbas_id = :sbas_id';
|
||||
$stmt = $appbox->get_connection()->prepare($sql);
|
||||
|
||||
foreach ($stories as $row)
|
||||
{
|
||||
foreach ($stories as $row) {
|
||||
$params = array(
|
||||
':usr_id' => $row['usr_id'],
|
||||
':sbas_id' => $row['sbas_id'],
|
||||
@@ -133,16 +128,15 @@ class patch_360 implements patchInterface
|
||||
$stmt->closeCursor();
|
||||
|
||||
|
||||
$sql = 'SELECT ssel_id FROM ssel WHERE temporaryType = "0"';
|
||||
$sql = 'SELECT ssel_id FROM ssel WHERE temporaryType = "0"';
|
||||
$stmt = $appbox->get_connection()->prepare($sql);
|
||||
$stmt->execute();
|
||||
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
$stmt->closeCursor();
|
||||
|
||||
$sselcont_ids = array();
|
||||
|
||||
foreach ($rs as $row)
|
||||
{
|
||||
foreach ($rs as $row) {
|
||||
$sql = 'SELECT c.sselcont_id, c.record_id, b.sbas_id
|
||||
FROM sselcont c, bas b, ssel s
|
||||
WHERE s.temporaryType = "0" AND b.base_id = c.base_id
|
||||
@@ -150,17 +144,15 @@ class patch_360 implements patchInterface
|
||||
|
||||
$stmt = $appbox->get_connection()->prepare($sql);
|
||||
$stmt->execute(array(':ssel_id' => $row['ssel_id']));
|
||||
$rs_be = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
$rs_be = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
$stmt->closeCursor();
|
||||
|
||||
$current = array();
|
||||
|
||||
foreach ($rs_be as $row_sselcont)
|
||||
{
|
||||
foreach ($rs_be as $row_sselcont) {
|
||||
$serial = $row_sselcont['sbas_id'] . '_' . $row_sselcont['record_id'];
|
||||
|
||||
if (isset($current[$serial]))
|
||||
{
|
||||
if (isset($current[$serial])) {
|
||||
$sselcont_ids[] = $row_sselcont['sselcont_id'];
|
||||
}
|
||||
|
||||
@@ -168,11 +160,10 @@ class patch_360 implements patchInterface
|
||||
}
|
||||
}
|
||||
|
||||
$sql = 'DELETE FROM sselcont WHERE sselcont_id = :sselcont_id';
|
||||
$stmt = $appbox->get_connection()->prepare($sql);
|
||||
$sql = 'DELETE FROM sselcont WHERE sselcont_id = :sselcont_id';
|
||||
$stmt = $appbox->get_connection()->prepare($sql);
|
||||
|
||||
foreach ($sselcont_ids as $sselcont_id)
|
||||
{
|
||||
foreach ($sselcont_ids as $sselcont_id) {
|
||||
$stmt->execute(array(':sselcont_id' => $sselcont_id));
|
||||
}
|
||||
|
||||
@@ -232,11 +223,11 @@ class patch_360 implements patchInterface
|
||||
|
||||
$stmt = $appbox->get_connection()->prepare($sql);
|
||||
$stmt->execute();
|
||||
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
$stmt->closeCursor();
|
||||
|
||||
|
||||
$sql = 'INSERT INTO ValidationDatas (
|
||||
$sql = 'INSERT INTO ValidationDatas (
|
||||
SELECT d.id , :participant_id as participant_id, d.sselcont_id, d.agreement,
|
||||
d.note, d.updated_on as updated
|
||||
FROM validate v, validate_datas d, sselcont c
|
||||
@@ -244,8 +235,7 @@ class patch_360 implements patchInterface
|
||||
AND v.usr_id = :usr_id AND v.ssel_id = :basket_id
|
||||
)';
|
||||
$stmt = $appbox->get_connection()->prepare($sql);
|
||||
foreach ($rs as $row)
|
||||
{
|
||||
foreach ($rs as $row) {
|
||||
$params = array(
|
||||
':participant_id' => $row['participant_id'],
|
||||
':basket_id' => $row['basket_id'],
|
||||
@@ -272,5 +262,4 @@ class patch_360 implements patchInterface
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -17,12 +17,12 @@
|
||||
*/
|
||||
class patch_3602 implements patchInterface
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $release = '3.6.0a1';
|
||||
|
||||
/**
|
||||
*
|
||||
* @var Array
|
||||
@@ -54,20 +54,16 @@ class patch_3602 implements patchInterface
|
||||
|
||||
function apply(base &$databox)
|
||||
{
|
||||
try
|
||||
{
|
||||
try {
|
||||
$sql = 'ALTER TABLE `metadatas` DROP INDEX `unique`';
|
||||
|
||||
$stmt = $databox->get_connection()->prepare($sql);
|
||||
$stmt->execute();
|
||||
$stmt->closeCursor();
|
||||
}
|
||||
catch(\PDOException $e)
|
||||
{
|
||||
} catch (\PDOException $e) {
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -17,12 +17,12 @@
|
||||
*/
|
||||
class patch_3603 implements patchInterface
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $release = '3.6.0a2';
|
||||
|
||||
/**
|
||||
*
|
||||
* @var Array
|
||||
@@ -64,5 +64,4 @@ class patch_3603 implements patchInterface
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -17,7 +17,6 @@
|
||||
*/
|
||||
class patch_3604 implements patchInterface
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
@@ -58,9 +57,8 @@ class patch_3604 implements patchInterface
|
||||
/**
|
||||
* Fail if upgrade has previously failed, no problem
|
||||
*/
|
||||
try
|
||||
{
|
||||
$sql = "ALTER TABLE `metadatas`
|
||||
try {
|
||||
$sql = "ALTER TABLE `metadatas`
|
||||
ADD `updated` TINYINT( 1 ) UNSIGNED NOT NULL DEFAULT '1',
|
||||
ADD INDEX ( `updated` )";
|
||||
|
||||
@@ -68,29 +66,24 @@ class patch_3604 implements patchInterface
|
||||
$stmt->execute();
|
||||
$stmt->closeCursor();
|
||||
|
||||
$sql = 'UPDATE metadatas SET updated = "0"
|
||||
$sql = 'UPDATE metadatas SET updated = "0"
|
||||
WHERE meta_struct_id
|
||||
IN (SELECT id FROM metadatas_structure WHERE multi = "1")';
|
||||
$stmt = $databox->get_connection()->prepare($sql);
|
||||
$stmt->execute();
|
||||
$stmt->closeCursor();
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
try {
|
||||
$sql = 'ALTER TABLE `metadatas` DROP INDEX `unique`';
|
||||
|
||||
$stmt = $databox->get_connection()->prepare($sql);
|
||||
$stmt->execute();
|
||||
$stmt->closeCursor();
|
||||
}
|
||||
catch(\PDOException $e)
|
||||
{
|
||||
} catch (\PDOException $e) {
|
||||
|
||||
}
|
||||
|
||||
@@ -99,16 +92,15 @@ class patch_3604 implements patchInterface
|
||||
WHERE m.meta_struct_id = s.id
|
||||
AND s.multi = "1" AND updated="0"';
|
||||
|
||||
$stmt = $databox->get_connection()->prepare($sql);
|
||||
$stmt = $databox->get_connection()->prepare($sql);
|
||||
$stmt->execute();
|
||||
$rowCount = $stmt->rowCount();
|
||||
$stmt->closeCursor();
|
||||
|
||||
$n = 0;
|
||||
$n = 0;
|
||||
$perPage = 1000;
|
||||
|
||||
while ($n < $rowCount)
|
||||
{
|
||||
while ($n < $rowCount) {
|
||||
$sql = 'SELECT m . *
|
||||
FROM metadatas_structure s, metadatas m
|
||||
WHERE m.meta_struct_id = s.id
|
||||
@@ -116,30 +108,27 @@ class patch_3604 implements patchInterface
|
||||
|
||||
$stmt = $databox->get_connection()->prepare($sql);
|
||||
$stmt->execute();
|
||||
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
$stmt->closeCursor();
|
||||
|
||||
$databox->get_connection()->beginTransaction();
|
||||
|
||||
$sql = 'INSERT INTO metadatas(id, record_id, meta_struct_id, value)
|
||||
$sql = 'INSERT INTO metadatas(id, record_id, meta_struct_id, value)
|
||||
VALUES (null, :record_id, :meta_struct_id, :value)';
|
||||
$stmt = $databox->get_connection()->prepare($sql);
|
||||
|
||||
$databox_fields = array();
|
||||
|
||||
foreach ($rs as $row)
|
||||
{
|
||||
foreach ($rs as $row) {
|
||||
$meta_struct_id = $row['meta_struct_id'];
|
||||
|
||||
if ( ! isset($databox_fields[$meta_struct_id]))
|
||||
{
|
||||
if ( ! isset($databox_fields[$meta_struct_id])) {
|
||||
$databox_fields[$meta_struct_id] = \databox_field::get_instance($databox, $meta_struct_id);
|
||||
}
|
||||
|
||||
$values = \caption_field::get_multi_values($row['value'], $databox_fields[$meta_struct_id]->get_separator());
|
||||
|
||||
foreach ($values as $value)
|
||||
{
|
||||
foreach ($values as $value) {
|
||||
$params = array(
|
||||
':record_id' => $row['record_id'],
|
||||
':meta_struct_id' => $row['meta_struct_id'],
|
||||
@@ -152,11 +141,10 @@ class patch_3604 implements patchInterface
|
||||
$stmt->closeCursor();
|
||||
|
||||
|
||||
$sql = 'DELETE FROM metadatas WHERE id = :id';
|
||||
$sql = 'DELETE FROM metadatas WHERE id = :id';
|
||||
$stmt = $databox->get_connection()->prepare($sql);
|
||||
|
||||
foreach ($rs as $row)
|
||||
{
|
||||
foreach ($rs as $row) {
|
||||
$params = array(':id' => $row['id']);
|
||||
$stmt->execute($params);
|
||||
}
|
||||
@@ -171,19 +159,15 @@ class patch_3604 implements patchInterface
|
||||
/**
|
||||
* Remove the extra column
|
||||
*/
|
||||
try
|
||||
{
|
||||
$sql = "ALTER TABLE `metadatas` DROP `updated`";
|
||||
try {
|
||||
$sql = "ALTER TABLE `metadatas` DROP `updated`";
|
||||
$stmt = $databox->get_connection()->prepare($sql);
|
||||
$stmt->execute();
|
||||
$stmt->closeCursor();
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -19,7 +19,6 @@ use Doctrine\ORM\Tools\Pagination\Paginator;
|
||||
*/
|
||||
class patch_361 implements patchInterface
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
@@ -63,35 +62,30 @@ class patch_361 implements patchInterface
|
||||
|
||||
$conn = $appbox->get_connection();
|
||||
|
||||
$sql = 'SELECT sbas_id, record_id, id FROM BasketElements';
|
||||
$stmt = $conn->prepare($sql);
|
||||
$sql = 'SELECT sbas_id, record_id, id FROM BasketElements';
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
$stmt->closeCursor();
|
||||
|
||||
foreach ($result as $row)
|
||||
{
|
||||
foreach ($result as $row) {
|
||||
$sbas_id = (int) $row['sbas_id'];
|
||||
|
||||
try
|
||||
{
|
||||
try {
|
||||
$connbas = connection::getPDOConnection($sbas_id);
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
} catch (\Exception $e) {
|
||||
$conn->exec('DELETE FROM ValidationDatas WHERE basket_element_id = ' . $row['id']);
|
||||
$conn->exec('DELETE FROM BasketElements WHERE id = ' . $row['id']);
|
||||
continue;
|
||||
}
|
||||
|
||||
$sql = 'SELECT record_id FROM record WHERE record_id = :record_id';
|
||||
$sql = 'SELECT record_id FROM record WHERE record_id = :record_id';
|
||||
$stmt = $connbas->prepare($sql);
|
||||
$stmt->execute(array(':record_id' => $row['record_id']));
|
||||
$rowCount = $stmt->rowCount();
|
||||
$rowCount = $stmt->rowCount();
|
||||
$stmt->closeCursor();
|
||||
|
||||
if ($rowCount == 0)
|
||||
{
|
||||
if ($rowCount == 0) {
|
||||
$conn->exec('DELETE FROM ValidationDatas WHERE basket_element_id = ' . $row['id']);
|
||||
$conn->exec('DELETE FROM BasketElements WHERE id = ' . $row['id']);
|
||||
}
|
||||
@@ -100,7 +94,7 @@ class patch_361 implements patchInterface
|
||||
|
||||
$dql = "SELECT b FROM Entities\Basket b WHERE b.description != ''";
|
||||
|
||||
$n = 0;
|
||||
$n = 0;
|
||||
$perPage = 100;
|
||||
|
||||
$query = $em->createQuery($dql)
|
||||
@@ -111,22 +105,19 @@ class patch_361 implements patchInterface
|
||||
|
||||
$count = count($paginator);
|
||||
|
||||
while ($n < $count)
|
||||
{
|
||||
while ($n < $count) {
|
||||
$query = $em->createQuery($dql)
|
||||
->setFirstResult($n)
|
||||
->setMaxResults($perPage);
|
||||
|
||||
$paginator = new Paginator($query, true);
|
||||
|
||||
foreach ($paginator as $basket)
|
||||
{
|
||||
foreach ($paginator as $basket) {
|
||||
$htmlDesc = $basket->getDescription();
|
||||
|
||||
$description = trim(strip_tags(str_replace("<br />", "\n", $htmlDesc)));
|
||||
|
||||
if ($htmlDesc == $description)
|
||||
{
|
||||
if ($htmlDesc == $description) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -142,6 +133,5 @@ class patch_361 implements patchInterface
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@@ -19,7 +19,6 @@ use Doctrine\ORM\Tools\Pagination\Paginator;
|
||||
*/
|
||||
class patch_370 implements patchInterface
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
@@ -59,14 +58,13 @@ class patch_370 implements patchInterface
|
||||
{
|
||||
$conn = $databox->get_connection();
|
||||
|
||||
$sql = 'SELECT value FROM pref WHERE prop = "structure"';
|
||||
$stmt = $conn->prepare($sql);
|
||||
$sql = 'SELECT value FROM pref WHERE prop = "structure"';
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
$result = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
$stmt->closeCursor();
|
||||
|
||||
if ( ! $result)
|
||||
{
|
||||
if ( ! $result) {
|
||||
throw new \RuntimeException('Unable to find structure');
|
||||
}
|
||||
|
||||
@@ -75,18 +73,16 @@ class patch_370 implements patchInterface
|
||||
|
||||
$XPath = new DOMXPath($DOMDocument);
|
||||
|
||||
foreach ($XPath->query('/record/subdefs/subdefgroup/subdef/delay') as $delay)
|
||||
{
|
||||
foreach ($XPath->query('/record/subdefs/subdefgroup/subdef/delay') as $delay) {
|
||||
$delay->nodeValue = min(500, max(50, (int) $delay->nodeValue * 400));
|
||||
}
|
||||
|
||||
$sql = 'UPDATE pref SET value = :structure WHERE prop = "structure"';
|
||||
$sql = 'UPDATE pref SET value = :structure WHERE prop = "structure"';
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute(array(':structure' => $DOMDocument->saveXML()));
|
||||
$stmt->closeCursor();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user