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:
@@ -18,131 +18,131 @@
|
|||||||
class patch_303 implements patchInterface
|
class patch_303 implements patchInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $release = '3.0.3';
|
private $release = '3.0.3';
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var Array
|
* @var Array
|
||||||
*/
|
*/
|
||||||
private $concern = array(base::APPLICATION_BOX);
|
private $concern = array(base::APPLICATION_BOX);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function get_release()
|
function get_release()
|
||||||
{
|
|
||||||
return $this->release;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function require_all_upgrades()
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @return Array
|
|
||||||
*/
|
|
||||||
function concern()
|
|
||||||
{
|
|
||||||
return $this->concern;
|
|
||||||
}
|
|
||||||
|
|
||||||
function apply(base &$appbox)
|
|
||||||
{
|
|
||||||
$this->update_users_log_datas($appbox);
|
|
||||||
$this->update_users_search_datas($appbox);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @return patch_303
|
|
||||||
*/
|
|
||||||
function update_users_log_datas(appbox &$appbox)
|
|
||||||
{
|
|
||||||
$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(
|
return $this->release;
|
||||||
'fonction' => $row['fonction'],
|
|
||||||
'societe' => $row['societe'],
|
|
||||||
'activite' => $row['activite'],
|
|
||||||
'pays' => $row['pays']
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($appbox->get_databoxes() as $databox)
|
public function require_all_upgrades()
|
||||||
{
|
{
|
||||||
foreach ($tab_usr as $id => $columns)
|
return false;
|
||||||
{
|
}
|
||||||
$f_req = array();
|
|
||||||
$params = array(':usr_id' => $id, ':site' => $appbox->get_registry()->get('GV_sit'));
|
/**
|
||||||
foreach ($columns as $column => $value)
|
*
|
||||||
{
|
* @return Array
|
||||||
$column = trim($column);
|
*/
|
||||||
$f_req[] = $column . " = :" . $column;
|
function concern()
|
||||||
$params[':' . $column] = $value;
|
{
|
||||||
}
|
return $this->concern;
|
||||||
$f_req = implode(', ', $f_req);
|
}
|
||||||
$sql = "UPDATE log SET " . $f_req . "
|
|
||||||
WHERE usrid = :usr_id AND site = :site";
|
function apply(base &$appbox)
|
||||||
$stmt = $databox->get_connection()->prepare($sql);
|
{
|
||||||
$stmt->execute($params);
|
$this->update_users_log_datas($appbox);
|
||||||
|
$this->update_users_search_datas($appbox);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return patch_303
|
||||||
|
*/
|
||||||
|
function update_users_log_datas(appbox &$appbox)
|
||||||
|
{
|
||||||
|
$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();
|
$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' => $appbox->get_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 $this;
|
/**
|
||||||
}
|
*
|
||||||
|
* @return patch_303
|
||||||
/**
|
*/
|
||||||
*
|
function update_users_search_datas(appbox &$appbox)
|
||||||
* @return patch_303
|
|
||||||
*/
|
|
||||||
function update_users_search_datas(appbox &$appbox)
|
|
||||||
{
|
|
||||||
foreach ($appbox->get_databoxes() as $databox)
|
|
||||||
{
|
{
|
||||||
$date_debut = '0000-00-00 00:00:00';
|
foreach ($appbox->get_databoxes() as $databox)
|
||||||
|
{
|
||||||
|
$date_debut = '0000-00-00 00:00:00';
|
||||||
|
|
||||||
$sql = 'SELECT MAX(date) as debut FROM `log_search`';
|
$sql = 'SELECT MAX(date) as debut FROM `log_search`';
|
||||||
|
|
||||||
$stmt = $databox->get_connection()->prepare($sql);
|
$stmt = $databox->get_connection()->prepare($sql);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$row = $stmt->fetch(PDO::FETCH_ASSOC);
|
$row = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
||||||
if ($row)
|
if ($row)
|
||||||
{
|
{
|
||||||
$date_debut = $row['debut'];
|
$date_debut = $row['debut'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = 'REPLACE INTO log_search
|
$sql = 'REPLACE INTO log_search
|
||||||
(SELECT null as id, logid as log_id, date, askquest as search,
|
(SELECT null as id, logid as log_id, date, askquest as search,
|
||||||
nbrep as results, coll_id
|
nbrep as results, coll_id
|
||||||
FROM quest
|
FROM quest
|
||||||
WHERE `date` > :date)';
|
WHERE `date` > :date)';
|
||||||
$stmt = $databox->get_connection()->prepare($sql);
|
$stmt = $databox->get_connection()->prepare($sql);
|
||||||
$stmt->execute(array(':date' => $date_debut));
|
$stmt->execute(array(':date' => $date_debut));
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -18,61 +18,61 @@
|
|||||||
class patch_304 implements patchInterface
|
class patch_304 implements patchInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $release = '3.0.4';
|
private $release = '3.0.4';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var Array
|
* @var Array
|
||||||
*/
|
*/
|
||||||
private $concern = array(base::DATA_BOX);
|
private $concern = array(base::DATA_BOX);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function get_release()
|
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 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
|
return $this->release;
|
||||||
(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;
|
public function require_all_upgrades()
|
||||||
}
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return Array
|
||||||
|
*/
|
||||||
|
function concern()
|
||||||
|
{
|
||||||
|
return $this->concern;
|
||||||
|
}
|
||||||
|
|
||||||
|
function apply(base &$databox)
|
||||||
|
{
|
||||||
|
$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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -18,52 +18,52 @@
|
|||||||
class patch_305 implements patchInterface
|
class patch_305 implements patchInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $release = '3.0.5';
|
private $release = '3.0.5';
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var Array
|
* @var Array
|
||||||
*/
|
*/
|
||||||
private $concern = array(base::APPLICATION_BOX);
|
private $concern = array(base::APPLICATION_BOX);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function get_release()
|
function get_release()
|
||||||
{
|
{
|
||||||
return $this->release;
|
return $this->release;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function require_all_upgrades()
|
public function require_all_upgrades()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return Array
|
* @return Array
|
||||||
*/
|
*/
|
||||||
function concern()
|
function concern()
|
||||||
{
|
{
|
||||||
return $this->concern;
|
return $this->concern;
|
||||||
}
|
}
|
||||||
|
|
||||||
function apply(base &$appbox)
|
function apply(base &$appbox)
|
||||||
{
|
{
|
||||||
$sql = 'REPLACE INTO usr_settings
|
$sql = 'REPLACE INTO usr_settings
|
||||||
(SELECT usr_id, "start_page_query" as prop, last_query as value
|
(SELECT usr_id, "start_page_query" as prop, last_query as value
|
||||||
FROM usr
|
FROM usr
|
||||||
WHERE model_of="0" AND usr_login NOT LIKE "(#deleted_%")';
|
WHERE model_of="0" AND usr_login NOT LIKE "(#deleted_%")';
|
||||||
|
|
||||||
$stmt = $appbox->get_connection()->prepare($sql);
|
$stmt = $appbox->get_connection()->prepare($sql);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -18,69 +18,69 @@
|
|||||||
class patch_306 implements patchInterface
|
class patch_306 implements patchInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $release = '3.0.6';
|
private $release = '3.0.6';
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var Array
|
* @var Array
|
||||||
*/
|
*/
|
||||||
private $concern = array(base::DATA_BOX);
|
private $concern = array(base::DATA_BOX);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function get_release()
|
function get_release()
|
||||||
{
|
|
||||||
return $this->release;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function require_all_upgrades()
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @return Array
|
|
||||||
*/
|
|
||||||
function concern()
|
|
||||||
{
|
|
||||||
return $this->concern;
|
|
||||||
}
|
|
||||||
|
|
||||||
function apply(base &$databox)
|
|
||||||
{
|
|
||||||
$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')
|
return $this->release;
|
||||||
{
|
|
||||||
$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);
|
public function require_all_upgrades()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
/**
|
||||||
}
|
*
|
||||||
|
* @return Array
|
||||||
|
*/
|
||||||
|
function concern()
|
||||||
|
{
|
||||||
|
return $this->concern;
|
||||||
|
}
|
||||||
|
|
||||||
|
function apply(base &$databox)
|
||||||
|
{
|
||||||
|
$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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -18,160 +18,160 @@
|
|||||||
class patch_310 implements patchInterface
|
class patch_310 implements patchInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $release = '3.1.0';
|
private $release = '3.1.0';
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var Array
|
* @var Array
|
||||||
*/
|
*/
|
||||||
private $concern = array(base::DATA_BOX);
|
private $concern = array(base::DATA_BOX);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function get_release()
|
function get_release()
|
||||||
{
|
|
||||||
return $this->release;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function require_all_upgrades()
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @return Array
|
|
||||||
*/
|
|
||||||
function concern()
|
|
||||||
{
|
|
||||||
return $this->concern;
|
|
||||||
}
|
|
||||||
|
|
||||||
function apply(base &$databox)
|
|
||||||
{
|
|
||||||
$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';
|
return $this->release;
|
||||||
|
|
||||||
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)
|
public function require_all_upgrades()
|
||||||
$new_subefs_node->appendChild($node);
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$record = $dom_structure->documentElement;
|
/**
|
||||||
|
*
|
||||||
|
* @return Array
|
||||||
|
*/
|
||||||
|
function concern()
|
||||||
|
{
|
||||||
|
return $this->concern;
|
||||||
|
}
|
||||||
|
|
||||||
$record->replaceChild(
|
function apply(base &$databox)
|
||||||
$new_subefs_node,
|
{
|
||||||
$record->getElementsByTagName('subdefs')->item(0)
|
$dom_structure = $databox->get_dom_structure();
|
||||||
);
|
$sx_structure = $databox->get_sxml_structure();
|
||||||
|
|
||||||
$databox->saveStructure($dom_structure);
|
$subdefgroups = $sx_structure->xpath('//subdefgroup');
|
||||||
|
|
||||||
return true;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -18,79 +18,79 @@
|
|||||||
class patch_3102 implements patchInterface
|
class patch_3102 implements patchInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $release = '3.1.20';
|
private $release = '3.1.20';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var Array
|
* @var Array
|
||||||
*/
|
*/
|
||||||
private $concern = array(base::APPLICATION_BOX, base::DATA_BOX);
|
private $concern = array(base::APPLICATION_BOX, base::DATA_BOX);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function get_release()
|
function get_release()
|
||||||
{
|
|
||||||
return $this->release;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function require_all_upgrades()
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @return Array
|
|
||||||
*/
|
|
||||||
function concern()
|
|
||||||
{
|
|
||||||
return $this->concern;
|
|
||||||
}
|
|
||||||
|
|
||||||
function apply(base &$base)
|
|
||||||
{
|
|
||||||
$conn = connection::getPDOConnection();
|
|
||||||
|
|
||||||
$sql = 'SELECT task_id FROM task2 WHERE `class` = "task_period_upgradetov31"';
|
|
||||||
|
|
||||||
$stmt = $conn->prepare($sql);
|
|
||||||
$stmt->execute();
|
|
||||||
$rowcount = $stmt->rowCount();
|
|
||||||
$stmt->closeCursor();
|
|
||||||
|
|
||||||
if ($rowcount == 0)
|
|
||||||
{
|
{
|
||||||
$sql = 'INSERT INTO `task2`
|
return $this->release;
|
||||||
(`task_id`, `usr_id_owner`, `pid`, `status`, `crashed`,
|
|
||||||
`active`, `name`, `last_exec_time`, `class`, `settings`, `completed`)
|
|
||||||
VALUES
|
|
||||||
(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)';
|
|
||||||
|
|
||||||
$stmt = $conn->prepare($sql);
|
|
||||||
$stmt->execute();
|
|
||||||
$stmt->closeCursor();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function require_all_upgrades()
|
||||||
if ($base->get_base_type() == base::DATA_BOX)
|
|
||||||
{
|
{
|
||||||
$sql = 'UPDATE record SET sha256 = ""
|
return false;
|
||||||
WHERE sha256 IS NULL AND parent_record_id = 0';
|
|
||||||
$stmt = $base->get_connection()->prepare($sql);
|
|
||||||
$stmt->execute();
|
|
||||||
$stmt->closeCursor();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
/**
|
||||||
}
|
*
|
||||||
|
* @return Array
|
||||||
|
*/
|
||||||
|
function concern()
|
||||||
|
{
|
||||||
|
return $this->concern;
|
||||||
|
}
|
||||||
|
|
||||||
|
function apply(base &$base)
|
||||||
|
{
|
||||||
|
$conn = connection::getPDOConnection();
|
||||||
|
|
||||||
|
$sql = 'SELECT task_id FROM task2 WHERE `class` = "task_period_upgradetov31"';
|
||||||
|
|
||||||
|
$stmt = $conn->prepare($sql);
|
||||||
|
$stmt->execute();
|
||||||
|
$rowcount = $stmt->rowCount();
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
|
if ($rowcount == 0)
|
||||||
|
{
|
||||||
|
$sql = 'INSERT INTO `task2`
|
||||||
|
(`task_id`, `usr_id_owner`, `pid`, `status`, `crashed`,
|
||||||
|
`active`, `name`, `last_exec_time`, `class`, `settings`, `completed`)
|
||||||
|
VALUES
|
||||||
|
(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)';
|
||||||
|
|
||||||
|
$stmt = $conn->prepare($sql);
|
||||||
|
$stmt->execute();
|
||||||
|
$stmt->closeCursor();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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);
|
||||||
|
$stmt->execute();
|
||||||
|
$stmt->closeCursor();
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -18,133 +18,133 @@
|
|||||||
class patch_3103 implements patchInterface
|
class patch_3103 implements patchInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $release = '3.1.0';
|
private $release = '3.1.0';
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var Array
|
* @var Array
|
||||||
*/
|
*/
|
||||||
private $concern = array(base::APPLICATION_BOX);
|
private $concern = array(base::APPLICATION_BOX);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function get_release()
|
function get_release()
|
||||||
{
|
|
||||||
return $this->release;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function require_all_upgrades()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @return Array
|
|
||||||
*/
|
|
||||||
function concern()
|
|
||||||
{
|
|
||||||
return $this->concern;
|
|
||||||
}
|
|
||||||
|
|
||||||
function apply(base &$appbox)
|
|
||||||
{
|
|
||||||
$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'];
|
return $this->release;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = 'SELECT u.*, s.ssel_id, c.base_id, c.record_id , s.usr_id as pushFrom
|
public function require_all_upgrades()
|
||||||
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']]) ||
|
return true;
|
||||||
!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)
|
* @return Array
|
||||||
VALUES
|
*/
|
||||||
(null, :ssel_id, :created_on, :updated_on, :expires_on, null,
|
function concern()
|
||||||
:usr_id, "0", :can_agree, :can_see)';
|
{
|
||||||
|
return $this->concern;
|
||||||
|
}
|
||||||
|
|
||||||
|
function apply(base &$appbox)
|
||||||
|
{
|
||||||
|
$conn = $appbox->get_connection();
|
||||||
|
|
||||||
|
$validate_process = array();
|
||||||
|
|
||||||
|
$sql = 'SELECT id, ssel_id, usr_id FROM validate';
|
||||||
$stmt = $conn->prepare($sql);
|
$stmt = $conn->prepare($sql);
|
||||||
|
$stmt->execute();
|
||||||
$expire = new DateTime($row['dateFin']);
|
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
$expire = $expire->format('u') == 0 ?
|
|
||||||
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']
|
|
||||||
);
|
|
||||||
$stmt->execute($params);
|
|
||||||
|
|
||||||
$validate_process[$row['ssel_id']][$row['usr_id']] = $conn->lastInsertId();
|
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
||||||
$sbas_id = phrasea::sbasFromBas($row['base_id']);
|
foreach ($rs as $row)
|
||||||
$record = new record_adapter($sbas_id, $row['record_id']);
|
{
|
||||||
|
$validate_process[$row['ssel_id']][$row['usr_id']] = $row['id'];
|
||||||
|
}
|
||||||
|
|
||||||
$user = User_Adapter::getInstance($row['usr_id'], $appbox);
|
$sql = 'SELECT u.*, s.ssel_id, c.base_id, c.record_id , s.usr_id as pushFrom
|
||||||
$pusher = User_Adapter::getInstance($row['pushFrom'], $appbox);
|
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';
|
||||||
|
|
||||||
if ($row['canHD'])
|
$stmt = $conn->prepare($sql);
|
||||||
$user->ACL()->grant_hd_on($record, $pusher, 'validate');
|
$stmt->execute();
|
||||||
else
|
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
$user->ACL()->grant_preview_on($record, $pusher, 'validate');
|
$stmt->closeCursor();
|
||||||
}
|
|
||||||
|
|
||||||
$sql = 'REPLACE INTO validate_datas
|
foreach ($rs as $row)
|
||||||
(id, validate_id, sselcont_id, updated_on, agreement)
|
{
|
||||||
VALUES
|
if (!isset($validate_process[$row['ssel_id']]) ||
|
||||||
(null, :validate_id, :sselcont_id, :updated_on, :agreement)';
|
!array_key_exists($row['usr_id'], $validate_process[$row['ssel_id']])
|
||||||
|
)
|
||||||
|
{
|
||||||
|
|
||||||
$stmt = $conn->prepare($sql);
|
$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)';
|
||||||
|
|
||||||
$params = array(
|
$stmt = $conn->prepare($sql);
|
||||||
':validate_id' => $validate_process[$row['ssel_id']][$row['usr_id']]
|
|
||||||
, ':sselcont_id' => $row['sselcont_id']
|
$expire = new DateTime($row['dateFin']);
|
||||||
, ':updated_on' => $row['date_maj']
|
$expire = $expire->format('u') == 0 ?
|
||||||
, ':agreement' => $row['agree']
|
null : phraseadate::format_mysql($expire);
|
||||||
);
|
|
||||||
$stmt->execute($params);
|
|
||||||
$stmt->closeCursor();
|
$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($row['base_id']);
|
||||||
|
$record = new record_adapter($sbas_id, $row['record_id']);
|
||||||
|
|
||||||
|
$user = User_Adapter::getInstance($row['usr_id'], $appbox);
|
||||||
|
$pusher = User_Adapter::getInstance($row['pushFrom'], $appbox);
|
||||||
|
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -18,51 +18,51 @@
|
|||||||
class patch_311 implements patchInterface
|
class patch_311 implements patchInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $release = '3.1.1';
|
private $release = '3.1.1';
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var Array
|
* @var Array
|
||||||
*/
|
*/
|
||||||
private $concern = array(base::DATA_BOX);
|
private $concern = array(base::DATA_BOX);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function get_release()
|
function get_release()
|
||||||
{
|
{
|
||||||
return $this->release;
|
return $this->release;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function require_all_upgrades()
|
public function require_all_upgrades()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return Array
|
* @return Array
|
||||||
*/
|
*/
|
||||||
function concern()
|
function concern()
|
||||||
{
|
{
|
||||||
return $this->concern;
|
return $this->concern;
|
||||||
}
|
}
|
||||||
|
|
||||||
function apply(base &$databox)
|
function apply(base &$databox)
|
||||||
{
|
{
|
||||||
$sql = 'UPDATE record SET jeton = '
|
$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 = $databox->get_connection()->prepare($sql);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -18,50 +18,50 @@
|
|||||||
class patch_320 implements patchInterface
|
class patch_320 implements patchInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $release = '3.2.0.0.a1';
|
private $release = '3.2.0.0.a1';
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var Array
|
* @var Array
|
||||||
*/
|
*/
|
||||||
private $concern = array(base::DATA_BOX);
|
private $concern = array(base::DATA_BOX);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function get_release()
|
function get_release()
|
||||||
{
|
{
|
||||||
return $this->release;
|
return $this->release;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function require_all_upgrades()
|
public function require_all_upgrades()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return Array
|
* @return Array
|
||||||
*/
|
*/
|
||||||
function concern()
|
function concern()
|
||||||
{
|
{
|
||||||
return $this->concern;
|
return $this->concern;
|
||||||
}
|
}
|
||||||
|
|
||||||
function apply(base &$databox)
|
function apply(base &$databox)
|
||||||
{
|
{
|
||||||
$sql = 'UPDATE record SET parent_record_id = "1"
|
$sql = 'UPDATE record SET parent_record_id = "1"
|
||||||
WHERE parent_record_id != "0"';
|
WHERE parent_record_id != "0"';
|
||||||
$stmt = $databox->get_connection()->prepare($sql);
|
$stmt = $databox->get_connection()->prepare($sql);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -18,87 +18,87 @@
|
|||||||
class patch_320a implements patchInterface
|
class patch_320a implements patchInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $release = '3.2.0.0.a2';
|
private $release = '3.2.0.0.a2';
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var Array
|
* @var Array
|
||||||
*/
|
*/
|
||||||
private $concern = array(base::APPLICATION_BOX);
|
private $concern = array(base::APPLICATION_BOX);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function get_release()
|
function get_release()
|
||||||
{
|
|
||||||
return $this->release;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function require_all_upgrades()
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @return Array
|
|
||||||
*/
|
|
||||||
function concern()
|
|
||||||
{
|
|
||||||
return $this->concern;
|
|
||||||
}
|
|
||||||
|
|
||||||
function apply(base &$appbox)
|
|
||||||
{
|
|
||||||
$sql = 'SELECT * FROM usr WHERE nonce IS NULL';
|
|
||||||
|
|
||||||
$stmt = $appbox->get_connection()->prepare($sql);
|
|
||||||
$stmt->execute();
|
|
||||||
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
||||||
$stmt->closeCursor();
|
|
||||||
|
|
||||||
$sql = 'UPDATE usr SET nonce = :nonce WHERE usr_id = :usr_id';
|
|
||||||
$stmt = $appbox->get_connection()->prepare($sql);
|
|
||||||
foreach ($rs as $row)
|
|
||||||
{
|
{
|
||||||
$nonce = random::generatePassword(16);
|
return $this->release;
|
||||||
$params = array(':usr_id' => $row['usr_id'], ':nonce' => $nonce);
|
|
||||||
$stmt->execute($params);
|
|
||||||
}
|
|
||||||
$stmt->closeCursor();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$sql = 'SELECT task_id, `class` FROM task2';
|
|
||||||
$stmt = $appbox->get_connection()->prepare($sql);
|
|
||||||
$stmt->execute();
|
|
||||||
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
||||||
$stmt->closeCursor();
|
|
||||||
|
|
||||||
$tasks = array();
|
|
||||||
|
|
||||||
$sql = 'UPDATE task2 SET `class` = :class WHERE task_id = :task_id';
|
|
||||||
$stmt = $appbox->get_connection()->prepare($sql);
|
|
||||||
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'])
|
|
||||||
);
|
|
||||||
|
|
||||||
$stmt->execute($params);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$stmt->closeCursor();
|
public function require_all_upgrades()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
/**
|
||||||
}
|
*
|
||||||
|
* @return Array
|
||||||
|
*/
|
||||||
|
function concern()
|
||||||
|
{
|
||||||
|
return $this->concern;
|
||||||
|
}
|
||||||
|
|
||||||
|
function apply(base &$appbox)
|
||||||
|
{
|
||||||
|
$sql = 'SELECT * FROM usr WHERE nonce IS NULL';
|
||||||
|
|
||||||
|
$stmt = $appbox->get_connection()->prepare($sql);
|
||||||
|
$stmt->execute();
|
||||||
|
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
|
$sql = 'UPDATE usr SET nonce = :nonce WHERE usr_id = :usr_id';
|
||||||
|
$stmt = $appbox->get_connection()->prepare($sql);
|
||||||
|
foreach ($rs as $row)
|
||||||
|
{
|
||||||
|
$nonce = random::generatePassword(16);
|
||||||
|
$params = array(':usr_id' => $row['usr_id'], ':nonce' => $nonce);
|
||||||
|
$stmt->execute($params);
|
||||||
|
}
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$sql = 'SELECT task_id, `class` FROM task2';
|
||||||
|
$stmt = $appbox->get_connection()->prepare($sql);
|
||||||
|
$stmt->execute();
|
||||||
|
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
|
$tasks = array();
|
||||||
|
|
||||||
|
$sql = 'UPDATE task2 SET `class` = :class WHERE task_id = :task_id';
|
||||||
|
$stmt = $appbox->get_connection()->prepare($sql);
|
||||||
|
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'])
|
||||||
|
);
|
||||||
|
|
||||||
|
$stmt->execute($params);
|
||||||
|
}
|
||||||
|
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -18,95 +18,95 @@
|
|||||||
class patch_320aa implements patchInterface
|
class patch_320aa implements patchInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $release = '3.2.0.0.a1';
|
private $release = '3.2.0.0.a1';
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var Array
|
* @var Array
|
||||||
*/
|
*/
|
||||||
private $concern = array(base::APPLICATION_BOX);
|
private $concern = array(base::APPLICATION_BOX);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function get_release()
|
function get_release()
|
||||||
{
|
|
||||||
return $this->release;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function require_all_upgrades()
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @return Array
|
|
||||||
*/
|
|
||||||
function concern()
|
|
||||||
{
|
|
||||||
return $this->concern;
|
|
||||||
}
|
|
||||||
|
|
||||||
function apply(base &$appbox)
|
|
||||||
{
|
|
||||||
if(is_file(__DIR__ . '/../../../config/_GV.php'))
|
|
||||||
require __DIR__ . '/../../../config/_GV.php';
|
|
||||||
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', '');
|
|
||||||
|
|
||||||
$registry = $appbox->get_registry();
|
|
||||||
|
|
||||||
foreach ($GV as $section => $datas_section)
|
|
||||||
{
|
{
|
||||||
foreach ($datas_section['vars'] as $datas)
|
return $this->release;
|
||||||
{
|
|
||||||
|
|
||||||
$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;
|
|
||||||
|
|
||||||
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'])
|
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
$registry->set($datas['name'], $val, $type);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
$registry->un_set('registry_loaded');
|
|
||||||
|
|
||||||
return true;
|
public function require_all_upgrades()
|
||||||
}
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return Array
|
||||||
|
*/
|
||||||
|
function concern()
|
||||||
|
{
|
||||||
|
return $this->concern;
|
||||||
|
}
|
||||||
|
|
||||||
|
function apply(base &$appbox)
|
||||||
|
{
|
||||||
|
if(is_file(__DIR__ . '/../../../config/_GV.php'))
|
||||||
|
require __DIR__ . '/../../../config/_GV.php';
|
||||||
|
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', '');
|
||||||
|
|
||||||
|
$registry = $appbox->get_registry();
|
||||||
|
|
||||||
|
foreach ($GV as $section => $datas_section)
|
||||||
|
{
|
||||||
|
foreach ($datas_section['vars'] as $datas)
|
||||||
|
{
|
||||||
|
|
||||||
|
$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;
|
||||||
|
|
||||||
|
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'])
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
$registry->set($datas['name'], $val, $type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$registry->un_set('registry_loaded');
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -18,54 +18,54 @@
|
|||||||
class patch_320ab implements patchInterface
|
class patch_320ab implements patchInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $release = '3.2.0.0.a1';
|
private $release = '3.2.0.0.a1';
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var Array
|
* @var Array
|
||||||
*/
|
*/
|
||||||
private $concern = array(base::APPLICATION_BOX);
|
private $concern = array(base::APPLICATION_BOX);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function get_release()
|
function get_release()
|
||||||
{
|
{
|
||||||
return $this->release;
|
return $this->release;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function require_all_upgrades()
|
public function require_all_upgrades()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return Array
|
* @return Array
|
||||||
*/
|
*/
|
||||||
function concern()
|
function concern()
|
||||||
{
|
{
|
||||||
return $this->concern;
|
return $this->concern;
|
||||||
}
|
}
|
||||||
|
|
||||||
function apply(base &$appbox)
|
function apply(base &$appbox)
|
||||||
{
|
{
|
||||||
$sql = 'REPLACE INTO records_rights
|
$sql = 'REPLACE INTO records_rights
|
||||||
(SELECT null as id, usr_id, b.sbas_id, record_id, "1" as document
|
(SELECT null as id, usr_id, b.sbas_id, record_id, "1" as document
|
||||||
, null as preview, "push" as `case`, pushFrom as pusher_usr_id
|
, null as preview, "push" as `case`, pushFrom as pusher_usr_id
|
||||||
FROM sselcont c, ssel s, bas b
|
FROM sselcont c, ssel s, bas b
|
||||||
WHERE c.ssel_id = s.ssel_id
|
WHERE c.ssel_id = s.ssel_id
|
||||||
AND b.base_id = c.base_id AND c.canHD = 1
|
AND b.base_id = c.base_id AND c.canHD = 1
|
||||||
)';
|
)';
|
||||||
$stmt = $appbox->get_connection()->prepare($sql);
|
$stmt = $appbox->get_connection()->prepare($sql);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -19,49 +19,49 @@
|
|||||||
class patch_320b implements patchInterface
|
class patch_320b implements patchInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $release = '3.2.0.0.a3';
|
private $release = '3.2.0.0.a3';
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var Array
|
* @var Array
|
||||||
*/
|
*/
|
||||||
private $concern = array(base::APPLICATION_BOX);
|
private $concern = array(base::APPLICATION_BOX);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function get_release()
|
function get_release()
|
||||||
{
|
{
|
||||||
return $this->release;
|
return $this->release;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function require_all_upgrades()
|
public function require_all_upgrades()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return Array
|
* @return Array
|
||||||
*/
|
*/
|
||||||
function concern()
|
function concern()
|
||||||
{
|
{
|
||||||
return $this->concern;
|
return $this->concern;
|
||||||
}
|
}
|
||||||
|
|
||||||
function apply(base &$appbox)
|
function apply(base &$appbox)
|
||||||
{
|
{
|
||||||
$sql = 'UPDATE basusr SET nowatermark=1 WHERE needwatermark=0';
|
$sql = 'UPDATE basusr SET nowatermark=1 WHERE needwatermark=0';
|
||||||
$stmt = $appbox->get_connection()->prepare($sql);
|
$stmt = $appbox->get_connection()->prepare($sql);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
unset($stmt);
|
unset($stmt);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -18,149 +18,149 @@
|
|||||||
class patch_320c implements patchInterface
|
class patch_320c implements patchInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $release = '3.2.0.0.a4';
|
private $release = '3.2.0.0.a4';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var Array
|
* @var Array
|
||||||
*/
|
*/
|
||||||
private $concern = array(base::DATA_BOX);
|
private $concern = array(base::DATA_BOX);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function get_release()
|
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 = '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 = 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'
|
|
||||||
);
|
|
||||||
|
|
||||||
$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'] : '');
|
return $this->release;
|
||||||
|
|
||||||
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);
|
public function require_all_upgrades()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$ext_databox = new extended_databox($databox->get_sbas_id());
|
/**
|
||||||
$ext_databox->migrate_fields();
|
*
|
||||||
|
* @return Array
|
||||||
|
*/
|
||||||
|
function concern()
|
||||||
|
{
|
||||||
|
return $this->concern;
|
||||||
|
}
|
||||||
|
|
||||||
$databox->delete_data_from_cache(databox::CACHE_STRUCTURE);
|
function apply(base &$databox)
|
||||||
$databox->delete_data_from_cache(databox::CACHE_META_STRUCT);
|
{
|
||||||
|
$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();
|
||||||
|
|
||||||
|
|
||||||
$conn = connection::getPDOConnection();
|
$phrasea_maps = array(
|
||||||
$sql = 'INSERT INTO `task2`
|
'pdftext' => '/rdf:RDF/rdf:Description/PHRASEANET:pdftext'
|
||||||
(`task_id`, `usr_id_owner`, `pid`, `status`, `crashed`,
|
, 'tf-archivedate' => '/rdf:RDF/rdf:Description/PHRASEANET:tf-archivedate'
|
||||||
`active`, `name`, `last_exec_time`, `class`, `settings`, `completed`)
|
, 'tf-atime' => '/rdf:RDF/rdf:Description/PHRASEANET:tf-atime'
|
||||||
VALUES
|
, 'tf-chgdocdate' => '/rdf:RDF/rdf:Description/PHRASEANET:tf-chgdocdate'
|
||||||
(null, 0, 0, "stopped", 0, 1, "upgrade to v3.2 for sbas ' . $databox->get_sbas_id() . '",
|
, 'tf-ctime' => '/rdf:RDF/rdf:Description/PHRASEANET:tf-ctime'
|
||||||
"0000-00-00 00:00:00", "task_period_upgradetov32",
|
, 'tf-editdate' => '/rdf:RDF/rdf:Description/PHRASEANET:tf-editdate'
|
||||||
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>' .
|
, 'tf-mtime' => '/rdf:RDF/rdf:Description/PHRASEANET:tf-mtime'
|
||||||
'<tasksettings><sbas_id>' . $databox->get_sbas_id() . '</sbas_id></tasksettings>", -1)';
|
, 'tf-parentdir' => '/rdf:RDF/rdf:Description/PHRASEANET:tf-parentdir'
|
||||||
$stmt = $conn->prepare($sql);
|
, 'tf-bits' => '/rdf:RDF/rdf:Description/PHRASEANET:tf-bits'
|
||||||
$stmt->execute();
|
, 'tf-channels' => '/rdf:RDF/rdf:Description/PHRASEANET:tf-channels'
|
||||||
$stmt->closeCursor();
|
, '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'
|
||||||
|
);
|
||||||
|
|
||||||
$sql = 'DELETE FROM `task2` WHERE class="readmeta"';
|
$sxe = $databox->get_sxml_structure();
|
||||||
$stmt = $conn->prepare($sql);
|
$dom_struct = $databox->get_dom_structure();
|
||||||
$stmt->execute();
|
$xp_struct = $databox->get_xpath_structure();
|
||||||
$stmt->closeCursor();
|
|
||||||
unset($stmt);
|
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);
|
||||||
|
|
||||||
|
$ext_databox = new extended_databox($databox->get_sbas_id());
|
||||||
|
$ext_databox->migrate_fields();
|
||||||
|
|
||||||
|
$databox->delete_data_from_cache(databox::CACHE_STRUCTURE);
|
||||||
|
$databox->delete_data_from_cache(databox::CACHE_META_STRUCT);
|
||||||
|
|
||||||
|
|
||||||
return true;
|
$conn = connection::getPDOConnection();
|
||||||
}
|
$sql = 'INSERT INTO `task2`
|
||||||
|
(`task_id`, `usr_id_owner`, `pid`, `status`, `crashed`,
|
||||||
|
`active`, `name`, `last_exec_time`, `class`, `settings`, `completed`)
|
||||||
|
VALUES
|
||||||
|
(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)';
|
||||||
|
$stmt = $conn->prepare($sql);
|
||||||
|
$stmt->execute();
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
|
$sql = 'DELETE FROM `task2` WHERE class="readmeta"';
|
||||||
|
$stmt = $conn->prepare($sql);
|
||||||
|
$stmt->execute();
|
||||||
|
$stmt->closeCursor();
|
||||||
|
unset($stmt);
|
||||||
|
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class extended_databox extends databox
|
class extended_databox extends databox
|
||||||
{
|
{
|
||||||
public function __construct($sbas_id)
|
public function __construct($sbas_id)
|
||||||
{
|
{
|
||||||
parent::__construct($sbas_id);
|
parent::__construct($sbas_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function migrate_fields()
|
public function migrate_fields()
|
||||||
{
|
{
|
||||||
$this->feed_meta_fields();
|
$this->feed_meta_fields();
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -18,65 +18,65 @@
|
|||||||
class patch_320d implements patchInterface
|
class patch_320d implements patchInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $release = '3.2.0.0.a5';
|
private $release = '3.2.0.0.a5';
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var Array
|
* @var Array
|
||||||
*/
|
*/
|
||||||
private $concern = array(base::APPLICATION_BOX);
|
private $concern = array(base::APPLICATION_BOX);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function get_release()
|
function get_release()
|
||||||
{
|
|
||||||
return $this->release;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function require_all_upgrades()
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @return Array
|
|
||||||
*/
|
|
||||||
function concern()
|
|
||||||
{
|
|
||||||
return $this->concern;
|
|
||||||
}
|
|
||||||
|
|
||||||
function apply(base &$appbox)
|
|
||||||
{
|
|
||||||
|
|
||||||
$sql = 'SELECT base_id, usr_id FROM order_masters';
|
|
||||||
$stmt = $appbox->get_connection()->prepare($sql);
|
|
||||||
$stmt->execute();
|
|
||||||
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
||||||
$stmt->closeCursor();
|
|
||||||
|
|
||||||
$sql = 'UPDATE basusr SET order_master="1"
|
|
||||||
WHERE base_id = :base_id AND usr_id = :usr_id';
|
|
||||||
$stmt = $appbox->get_connection()->prepare($sql);
|
|
||||||
|
|
||||||
foreach ($rs as $row)
|
|
||||||
{
|
{
|
||||||
$params = array(
|
return $this->release;
|
||||||
':base_id' => $row['base_id'],
|
|
||||||
':usr_id' => $row['usr_id']
|
|
||||||
);
|
|
||||||
$stmt->execute($params);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$stmt->closeCursor();
|
public function require_all_upgrades()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
/**
|
||||||
}
|
*
|
||||||
|
* @return Array
|
||||||
|
*/
|
||||||
|
function concern()
|
||||||
|
{
|
||||||
|
return $this->concern;
|
||||||
|
}
|
||||||
|
|
||||||
|
function apply(base &$appbox)
|
||||||
|
{
|
||||||
|
|
||||||
|
$sql = 'SELECT base_id, usr_id FROM order_masters';
|
||||||
|
$stmt = $appbox->get_connection()->prepare($sql);
|
||||||
|
$stmt->execute();
|
||||||
|
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
|
$sql = 'UPDATE basusr SET order_master="1"
|
||||||
|
WHERE base_id = :base_id AND usr_id = :usr_id';
|
||||||
|
$stmt = $appbox->get_connection()->prepare($sql);
|
||||||
|
|
||||||
|
foreach ($rs as $row)
|
||||||
|
{
|
||||||
|
$params = array(
|
||||||
|
':base_id' => $row['base_id'],
|
||||||
|
':usr_id' => $row['usr_id']
|
||||||
|
);
|
||||||
|
$stmt->execute($params);
|
||||||
|
}
|
||||||
|
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -18,79 +18,79 @@
|
|||||||
class patch_320e implements patchInterface
|
class patch_320e implements patchInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $release = '3.2.0.0.a6';
|
private $release = '3.2.0.0.a6';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var Array
|
* @var Array
|
||||||
*/
|
*/
|
||||||
private $concern = array(base::DATA_BOX);
|
private $concern = array(base::DATA_BOX);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function get_release()
|
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 = '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')));
|
return $this->release;
|
||||||
if ($name === '')
|
|
||||||
continue;
|
|
||||||
$node->setAttribute('name', $name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$databox->saveStructure($dom);
|
public function require_all_upgrades()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
/**
|
||||||
}
|
*
|
||||||
|
* @return Array
|
||||||
|
*/
|
||||||
|
function concern()
|
||||||
|
{
|
||||||
|
return $this->concern;
|
||||||
|
}
|
||||||
|
|
||||||
|
function apply(base &$databox)
|
||||||
|
{
|
||||||
|
$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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -18,195 +18,195 @@
|
|||||||
class patch_320f implements patchInterface
|
class patch_320f implements patchInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $release = '3.2.0.0.a4';
|
private $release = '3.2.0.0.a4';
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var Array
|
* @var Array
|
||||||
*/
|
*/
|
||||||
private $concern = array(base::APPLICATION_BOX);
|
private $concern = array(base::APPLICATION_BOX);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function get_release()
|
function get_release()
|
||||||
{
|
|
||||||
return $this->release;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function require_all_upgrades()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @return Array
|
|
||||||
*/
|
|
||||||
function concern()
|
|
||||||
{
|
|
||||||
return $this->concern;
|
|
||||||
}
|
|
||||||
|
|
||||||
function apply(base &$appbox)
|
|
||||||
{
|
|
||||||
$feeds = array();
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
$sql = 'ALTER TABLE `ssel` ADD `migrated` INT NOT NULL DEFAULT "0"';
|
return $this->release;
|
||||||
$stmt = $appbox->get_connection()->prepare($sql);
|
|
||||||
$stmt->execute();
|
|
||||||
$stmt->closeCursor();
|
|
||||||
}
|
|
||||||
catch(Exception $e)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = 'SELECT ssel_id, usr_id, name, descript, pub_date
|
public function require_all_upgrades()
|
||||||
, updater, pub_restrict, homelink
|
|
||||||
FROM ssel WHERE (public = "1" or homelink="1") and migrated = 0';
|
|
||||||
|
|
||||||
$stmt = $appbox->get_connection()->prepare($sql);
|
|
||||||
$stmt->execute();
|
|
||||||
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
||||||
$stmt->closeCursor();
|
|
||||||
|
|
||||||
$date_ref = new DateTime();
|
|
||||||
|
|
||||||
foreach ($rs as $row)
|
|
||||||
{
|
{
|
||||||
$user = User_Adapter::getInstance($row['usr_id'], $appbox);
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
$feed = $this->get_feed($appbox, $user, $row['pub_restrict'], $row['homelink']);
|
/**
|
||||||
|
*
|
||||||
|
* @return Array
|
||||||
|
*/
|
||||||
|
function concern()
|
||||||
|
{
|
||||||
|
return $this->concern;
|
||||||
|
}
|
||||||
|
|
||||||
if(!$feed instanceof Feed_Adapter)
|
function apply(base &$appbox)
|
||||||
{
|
{
|
||||||
continue;
|
$feeds = array();
|
||||||
}
|
|
||||||
|
|
||||||
$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)
|
|
||||||
{
|
|
||||||
$date_ref = $date_create;
|
|
||||||
}
|
|
||||||
$entry->set_created_on($date_create);
|
|
||||||
if ($row['updater'] != '0000-00-00 00:00:00')
|
|
||||||
{
|
|
||||||
$date_update = new DateTime($row['updater']);
|
|
||||||
$entry->set_updated_on($date_update);
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = 'SELECT sselcont_id, ssel_id, base_id, record_id
|
|
||||||
FROM sselcont WHERE ssel_id = :ssel_id ORDER BY ord ASC';
|
|
||||||
$stmt = $appbox->get_connection()->prepare($sql);
|
|
||||||
$stmt->execute(array(':ssel_id' => $row['ssel_id']));
|
|
||||||
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
||||||
$stmt->closeCursor();
|
|
||||||
|
|
||||||
foreach ($rs as $row)
|
|
||||||
{
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$record = new record_adapter(phrasea::sbasFromBas($row['base_id']), $row['record_id']);
|
$sql = 'ALTER TABLE `ssel` ADD `migrated` INT NOT NULL DEFAULT "0"';
|
||||||
$item = Feed_Entry_Item::create($appbox, $entry, $record);
|
$stmt = $appbox->get_connection()->prepare($sql);
|
||||||
|
$stmt->execute();
|
||||||
|
$stmt->closeCursor();
|
||||||
}
|
}
|
||||||
catch (Exception_NotFound $e)
|
catch(Exception $e)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
$sql = 'UPDATE ssel SET deleted = "1", migrated="1"
|
$sql = 'SELECT ssel_id, usr_id, name, descript, pub_date
|
||||||
WHERE ssel_id = :ssel_id';
|
, updater, pub_restrict, homelink
|
||||||
$stmt = $appbox->get_connection()->prepare($sql);
|
FROM ssel WHERE (public = "1" or homelink="1") and migrated = 0';
|
||||||
$stmt->execute(array(':ssel_id' => $row['ssel_id']));
|
|
||||||
$stmt->closeCursor();
|
|
||||||
}
|
|
||||||
$this->set_feed_dates($date_ref);
|
|
||||||
|
|
||||||
return true;
|
$stmt = $appbox->get_connection()->prepare($sql);
|
||||||
}
|
$stmt->execute();
|
||||||
|
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
protected function set_feed_dates(DateTime $date_ref)
|
$date_ref = new DateTime();
|
||||||
{
|
|
||||||
foreach (self::$feeds as $array_feeds)
|
|
||||||
{
|
|
||||||
foreach ($array_feeds as $feed)
|
|
||||||
{
|
|
||||||
$feed->set_created_on($date_ref);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
foreach ($rs as $row)
|
||||||
}
|
|
||||||
|
|
||||||
protected static $feeds = array();
|
|
||||||
|
|
||||||
protected function get_feed(appbox &$appbox, User_Adapter &$user, $pub_restrict, $homelink)
|
|
||||||
{
|
|
||||||
$user_key = 'user_' . $user->get_id();
|
|
||||||
if ($homelink == '1')
|
|
||||||
$feed_key = 'feed_homelink';
|
|
||||||
elseif ($pub_restrict == '1')
|
|
||||||
$feed_key = 'feed_restricted';
|
|
||||||
else
|
|
||||||
$feed_key = 'feed_public';
|
|
||||||
|
|
||||||
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')
|
|
||||||
$title = $user->get_display_name() . ' - ' . 'private Feed';
|
|
||||||
else
|
|
||||||
$title = $user->get_display_name() . ' - ' . 'public Feed';
|
|
||||||
|
|
||||||
$feed = Feed_Adapter::create($appbox, $user, $title, '');
|
|
||||||
|
|
||||||
if ($homelink)
|
|
||||||
{
|
|
||||||
$feed->set_public(true);
|
|
||||||
}
|
|
||||||
elseif ($pub_restrict == 1)
|
|
||||||
{
|
|
||||||
$collection = array_shift($user->ACL()->get_granted_base());
|
|
||||||
if (!($collection instanceof collection))
|
|
||||||
{
|
{
|
||||||
foreach ($appbox->get_databoxes() as $databox)
|
$user = User_Adapter::getInstance($row['usr_id'], $appbox);
|
||||||
{
|
|
||||||
foreach ($databox->get_collections() as $coll)
|
$feed = $this->get_feed($appbox, $user, $row['pub_restrict'], $row['homelink']);
|
||||||
|
|
||||||
|
if(!$feed instanceof Feed_Adapter)
|
||||||
{
|
{
|
||||||
$collection = $coll;
|
continue;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
if ($collection instanceof collection)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!($collection instanceof collection))
|
$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']);
|
||||||
echo "unable to find a collection to protect feeds";
|
if ($date_create < $date_ref)
|
||||||
|
{
|
||||||
|
$date_ref = $date_create;
|
||||||
|
}
|
||||||
|
$entry->set_created_on($date_create);
|
||||||
|
if ($row['updater'] != '0000-00-00 00:00:00')
|
||||||
|
{
|
||||||
|
$date_update = new DateTime($row['updater']);
|
||||||
|
$entry->set_updated_on($date_update);
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
$sql = 'SELECT sselcont_id, ssel_id, base_id, record_id
|
||||||
|
FROM sselcont WHERE ssel_id = :ssel_id ORDER BY ord ASC';
|
||||||
|
$stmt = $appbox->get_connection()->prepare($sql);
|
||||||
|
$stmt->execute(array(':ssel_id' => $row['ssel_id']));
|
||||||
|
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = 'UPDATE ssel SET deleted = "1", migrated="1"
|
||||||
|
WHERE ssel_id = :ssel_id';
|
||||||
|
$stmt = $appbox->get_connection()->prepare($sql);
|
||||||
|
$stmt->execute(array(':ssel_id' => $row['ssel_id']));
|
||||||
|
$stmt->closeCursor();
|
||||||
}
|
}
|
||||||
$feed->set_collection($collection);
|
$this->set_feed_dates($date_ref);
|
||||||
}
|
|
||||||
self::$feeds[$user_key][$feed_key] = $feed;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
protected function set_feed_dates(DateTime $date_ref)
|
||||||
{
|
{
|
||||||
$feed = self::$feeds[$user_key][$feed_key];
|
foreach (self::$feeds as $array_feeds)
|
||||||
|
{
|
||||||
|
foreach ($array_feeds as $feed)
|
||||||
|
{
|
||||||
|
$feed->set_created_on($date_ref);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $feed;
|
protected static $feeds = array();
|
||||||
}
|
|
||||||
|
protected function get_feed(appbox &$appbox, User_Adapter &$user, $pub_restrict, $homelink)
|
||||||
|
{
|
||||||
|
$user_key = 'user_' . $user->get_id();
|
||||||
|
if ($homelink == '1')
|
||||||
|
$feed_key = 'feed_homelink';
|
||||||
|
elseif ($pub_restrict == '1')
|
||||||
|
$feed_key = 'feed_restricted';
|
||||||
|
else
|
||||||
|
$feed_key = 'feed_public';
|
||||||
|
|
||||||
|
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')
|
||||||
|
$title = $user->get_display_name() . ' - ' . 'private Feed';
|
||||||
|
else
|
||||||
|
$title = $user->get_display_name() . ' - ' . 'public Feed';
|
||||||
|
|
||||||
|
$feed = Feed_Adapter::create($appbox, $user, $title, '');
|
||||||
|
|
||||||
|
if ($homelink)
|
||||||
|
{
|
||||||
|
$feed->set_public(true);
|
||||||
|
}
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
$collection = $coll;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if ($collection instanceof collection)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!($collection instanceof collection))
|
||||||
|
{
|
||||||
|
echo "unable to find a collection to protect feeds";
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$feed->set_collection($collection);
|
||||||
|
}
|
||||||
|
self::$feeds[$user_key][$feed_key] = $feed;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$feed = self::$feeds[$user_key][$feed_key];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $feed;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -18,49 +18,49 @@
|
|||||||
class patch_320h implements patchInterface
|
class patch_320h implements patchInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $release = '3.2.0.0.a8';
|
private $release = '3.2.0.0.a8';
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var Array
|
* @var Array
|
||||||
*/
|
*/
|
||||||
private $concern = array(base::APPLICATION_BOX);
|
private $concern = array(base::APPLICATION_BOX);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function get_release()
|
function get_release()
|
||||||
{
|
{
|
||||||
return $this->release;
|
return $this->release;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function require_all_upgrades()
|
public function require_all_upgrades()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return Array
|
* @return Array
|
||||||
*/
|
*/
|
||||||
function concern()
|
function concern()
|
||||||
{
|
{
|
||||||
return $this->concern;
|
return $this->concern;
|
||||||
}
|
}
|
||||||
|
|
||||||
function apply(base &$appbox)
|
function apply(base &$appbox)
|
||||||
{
|
{
|
||||||
$sql = 'DELETE FROM basusr WHERE actif = "0"';
|
$sql = 'DELETE FROM basusr WHERE actif = "0"';
|
||||||
|
|
||||||
$stmt = $appbox->get_connection()->prepare($sql);
|
$stmt = $appbox->get_connection()->prepare($sql);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -18,259 +18,259 @@
|
|||||||
class patch_360 implements patchInterface
|
class patch_360 implements patchInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $release = '3.6.0a1';
|
private $release = '3.6.0a1';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var Array
|
* @var Array
|
||||||
*/
|
*/
|
||||||
private $concern = array(base::APPLICATION_BOX);
|
private $concern = array(base::APPLICATION_BOX);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function get_release()
|
function get_release()
|
||||||
{
|
|
||||||
return $this->release;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function require_all_upgrades()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @return Array
|
|
||||||
*/
|
|
||||||
function concern()
|
|
||||||
{
|
|
||||||
return $this->concern;
|
|
||||||
}
|
|
||||||
|
|
||||||
function apply(base &$appbox)
|
|
||||||
{
|
|
||||||
$tables = array('StoryWZ', 'ValidationDatas', 'ValidationParticipants', 'ValidationSessions', 'BasketElements', 'Baskets');
|
|
||||||
|
|
||||||
foreach ($tables as $table)
|
|
||||||
{
|
{
|
||||||
$sql = 'DELETE FROM ' . $table;
|
return $this->release;
|
||||||
$stmt = $appbox->get_connection()->prepare($sql);
|
|
||||||
$stmt->execute();
|
|
||||||
$stmt->closeCursor();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function require_all_upgrades()
|
||||||
$stories = array();
|
|
||||||
|
|
||||||
$sql = 'SELECT sbas_id, rid as record_id, usr_id
|
|
||||||
FROM ssel
|
|
||||||
WHERE temporaryType = "1"';
|
|
||||||
|
|
||||||
$stmt = $appbox->get_connection()->prepare($sql);
|
|
||||||
$stmt->execute();
|
|
||||||
$rs_s = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
||||||
$stmt->closeCursor();
|
|
||||||
|
|
||||||
$current = array();
|
|
||||||
|
|
||||||
foreach ($rs_s as $row_story)
|
|
||||||
{
|
{
|
||||||
$serial = $row_story['sbas_id'] . '_' . $row_story['usr_id'] . '_' . $row_story['record_id'];
|
return true;
|
||||||
|
|
||||||
if (isset($current[$serial]))
|
|
||||||
{
|
|
||||||
$stories[] = $row_story;
|
|
||||||
}
|
|
||||||
|
|
||||||
$current[$serial] = $serial;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = 'DELETE FROM ssel
|
/**
|
||||||
WHERE temporaryType="1" AND record_id = :record_id
|
*
|
||||||
AND usr_id = :usr_id AND sbas_id = :sbas_id';
|
* @return Array
|
||||||
$stmt = $appbox->get_connection()->prepare($sql);
|
*/
|
||||||
|
function concern()
|
||||||
foreach ($stories as $row)
|
|
||||||
{
|
{
|
||||||
$params = array(
|
return $this->concern;
|
||||||
':usr_id' => $row['usr_id'],
|
|
||||||
':sbas_id' => $row['sbas_id'],
|
|
||||||
':record_id' => $row['record_id']
|
|
||||||
);
|
|
||||||
$stmt->execute($params);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$stmt->closeCursor();
|
function apply(base &$appbox)
|
||||||
|
|
||||||
$sql = 'INSERT INTO StoryWZ
|
|
||||||
(
|
|
||||||
SELECT null as id, sbas_id, rid as record_id, usr_id, date as created
|
|
||||||
FROM ssel
|
|
||||||
WHERE temporaryType = "1"
|
|
||||||
)';
|
|
||||||
|
|
||||||
$stmt = $appbox->get_connection()->prepare($sql);
|
|
||||||
$stmt->execute();
|
|
||||||
$stmt->closeCursor();
|
|
||||||
|
|
||||||
$sql = 'INSERT INTO Baskets
|
|
||||||
(
|
|
||||||
SELECT ssel_id as id, name, descript as description, usr_id, 1 as is_read
|
|
||||||
, pushFrom as pusher_id,
|
|
||||||
0 as archived, date as created, updater as updated
|
|
||||||
FROM ssel
|
|
||||||
WHERE temporaryType = "0"
|
|
||||||
)';
|
|
||||||
|
|
||||||
$stmt = $appbox->get_connection()->prepare($sql);
|
|
||||||
$stmt->execute();
|
|
||||||
$stmt->closeCursor();
|
|
||||||
|
|
||||||
|
|
||||||
$sql = 'SELECT ssel_id FROM ssel WHERE temporaryType = "0"';
|
|
||||||
$stmt = $appbox->get_connection()->prepare($sql);
|
|
||||||
$stmt->execute();
|
|
||||||
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
||||||
$stmt->closeCursor();
|
|
||||||
|
|
||||||
$sselcont_ids = array();
|
|
||||||
|
|
||||||
foreach ($rs as $row)
|
|
||||||
{
|
{
|
||||||
$sql = 'SELECT c.sselcont_id, c.record_id, b.sbas_id
|
$tables = array('StoryWZ', 'ValidationDatas', 'ValidationParticipants', 'ValidationSessions', 'BasketElements', 'Baskets');
|
||||||
FROM sselcont c, bas b, ssel s
|
|
||||||
WHERE s.temporaryType = "0" AND b.base_id = c.base_id
|
|
||||||
AND c.ssel_id = :ssel_id AND s.ssel_id = c.ssel_id';
|
|
||||||
|
|
||||||
$stmt = $appbox->get_connection()->prepare($sql);
|
foreach ($tables as $table)
|
||||||
$stmt->execute(array(':ssel_id' => $row['ssel_id']));
|
|
||||||
$rs_be = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
||||||
$stmt->closeCursor();
|
|
||||||
|
|
||||||
$current = array();
|
|
||||||
|
|
||||||
foreach ($rs_be as $row_sselcont)
|
|
||||||
{
|
|
||||||
$serial = $row_sselcont['sbas_id'] . '_' . $row_sselcont['record_id'];
|
|
||||||
|
|
||||||
if (isset($current[$serial]))
|
|
||||||
{
|
{
|
||||||
$sselcont_ids[] = $row_sselcont['sselcont_id'];
|
$sql = 'DELETE FROM ' . $table;
|
||||||
|
$stmt = $appbox->get_connection()->prepare($sql);
|
||||||
|
$stmt->execute();
|
||||||
|
$stmt->closeCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
$current[$serial] = $serial;
|
|
||||||
}
|
$stories = array();
|
||||||
|
|
||||||
|
$sql = 'SELECT sbas_id, rid as record_id, usr_id
|
||||||
|
FROM ssel
|
||||||
|
WHERE temporaryType = "1"';
|
||||||
|
|
||||||
|
$stmt = $appbox->get_connection()->prepare($sql);
|
||||||
|
$stmt->execute();
|
||||||
|
$rs_s = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
|
$current = array();
|
||||||
|
|
||||||
|
foreach ($rs_s as $row_story)
|
||||||
|
{
|
||||||
|
$serial = $row_story['sbas_id'] . '_' . $row_story['usr_id'] . '_' . $row_story['record_id'];
|
||||||
|
|
||||||
|
if (isset($current[$serial]))
|
||||||
|
{
|
||||||
|
$stories[] = $row_story;
|
||||||
|
}
|
||||||
|
|
||||||
|
$current[$serial] = $serial;
|
||||||
|
}
|
||||||
|
|
||||||
|
$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)
|
||||||
|
{
|
||||||
|
$params = array(
|
||||||
|
':usr_id' => $row['usr_id'],
|
||||||
|
':sbas_id' => $row['sbas_id'],
|
||||||
|
':record_id' => $row['record_id']
|
||||||
|
);
|
||||||
|
$stmt->execute($params);
|
||||||
|
}
|
||||||
|
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
|
$sql = 'INSERT INTO StoryWZ
|
||||||
|
(
|
||||||
|
SELECT null as id, sbas_id, rid as record_id, usr_id, date as created
|
||||||
|
FROM ssel
|
||||||
|
WHERE temporaryType = "1"
|
||||||
|
)';
|
||||||
|
|
||||||
|
$stmt = $appbox->get_connection()->prepare($sql);
|
||||||
|
$stmt->execute();
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
|
$sql = 'INSERT INTO Baskets
|
||||||
|
(
|
||||||
|
SELECT ssel_id as id, name, descript as description, usr_id, 1 as is_read
|
||||||
|
, pushFrom as pusher_id,
|
||||||
|
0 as archived, date as created, updater as updated
|
||||||
|
FROM ssel
|
||||||
|
WHERE temporaryType = "0"
|
||||||
|
)';
|
||||||
|
|
||||||
|
$stmt = $appbox->get_connection()->prepare($sql);
|
||||||
|
$stmt->execute();
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
|
|
||||||
|
$sql = 'SELECT ssel_id FROM ssel WHERE temporaryType = "0"';
|
||||||
|
$stmt = $appbox->get_connection()->prepare($sql);
|
||||||
|
$stmt->execute();
|
||||||
|
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
|
$sselcont_ids = array();
|
||||||
|
|
||||||
|
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
|
||||||
|
AND c.ssel_id = :ssel_id AND s.ssel_id = c.ssel_id';
|
||||||
|
|
||||||
|
$stmt = $appbox->get_connection()->prepare($sql);
|
||||||
|
$stmt->execute(array(':ssel_id' => $row['ssel_id']));
|
||||||
|
$rs_be = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
|
$current = array();
|
||||||
|
|
||||||
|
foreach ($rs_be as $row_sselcont)
|
||||||
|
{
|
||||||
|
$serial = $row_sselcont['sbas_id'] . '_' . $row_sselcont['record_id'];
|
||||||
|
|
||||||
|
if (isset($current[$serial]))
|
||||||
|
{
|
||||||
|
$sselcont_ids[] = $row_sselcont['sselcont_id'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$current[$serial] = $serial;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = 'DELETE FROM sselcont WHERE sselcont_id = :sselcont_id';
|
||||||
|
$stmt = $appbox->get_connection()->prepare($sql);
|
||||||
|
|
||||||
|
foreach ($sselcont_ids as $sselcont_id)
|
||||||
|
{
|
||||||
|
$stmt->execute(array(':sselcont_id' => $sselcont_id));
|
||||||
|
}
|
||||||
|
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
|
$sql = 'INSERT INTO BasketElements
|
||||||
|
(
|
||||||
|
SELECT sselcont_id as id, c.ssel_id as basket_id, record_id, b.sbas_id, c.ord,
|
||||||
|
s.date as created, s.updater as updated
|
||||||
|
FROM sselcont c, ssel s, bas b
|
||||||
|
WHERE temporaryType = "0" AND b.base_id = c.base_id AND s.ssel_id = c.ssel_id
|
||||||
|
)';
|
||||||
|
|
||||||
|
$stmt = $appbox->get_connection()->prepare($sql);
|
||||||
|
$stmt->execute();
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
|
$sql = 'UPDATE Baskets SET pusher_id = NULL WHERE pusher_id = 0';
|
||||||
|
|
||||||
|
$stmt = $appbox->get_connection()->prepare($sql);
|
||||||
|
$stmt->execute();
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
|
|
||||||
|
$sql = 'INSERT INTO ValidationSessions
|
||||||
|
(
|
||||||
|
SELECT null as id, v.ssel_id as basket_id ,created_on as created
|
||||||
|
,updated_on as updated ,expires_on as expires
|
||||||
|
,v.usr_id as initiator_id
|
||||||
|
FROM ssel s, validate v
|
||||||
|
WHERE v.ssel_id = s.ssel_id AND v.usr_id = s.usr_id
|
||||||
|
)';
|
||||||
|
|
||||||
|
$stmt = $appbox->get_connection()->prepare($sql);
|
||||||
|
$stmt->execute();
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
|
$sql = 'INSERT INTO ValidationParticipants
|
||||||
|
(
|
||||||
|
SELECT v.id as id, v.usr_id
|
||||||
|
, 1 AS is_aware, confirmed as is_confirmed, 1 as can_agree
|
||||||
|
, can_see_others, last_reminder AS reminded
|
||||||
|
, vs.`id` AS ValidationSession_id
|
||||||
|
FROM validate v, ssel s, ValidationSessions vs
|
||||||
|
WHERE s.ssel_id = v.ssel_id AND vs.basket_id = v.ssel_id
|
||||||
|
)';
|
||||||
|
|
||||||
|
$stmt = $appbox->get_connection()->prepare($sql);
|
||||||
|
$stmt->execute();
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
|
|
||||||
|
$sql = 'SELECT usr_id, basket_id, p.id as participant_id
|
||||||
|
FROM ValidationParticipants p, ValidationSessions s
|
||||||
|
WHERE p.ValidationSession_Id = s.id';
|
||||||
|
|
||||||
|
|
||||||
|
$stmt = $appbox->get_connection()->prepare($sql);
|
||||||
|
$stmt->execute();
|
||||||
|
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
|
|
||||||
|
$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
|
||||||
|
WHERE c.sselcont_id = d.sselcont_id AND v.id = d.validate_id
|
||||||
|
AND v.usr_id = :usr_id AND v.ssel_id = :basket_id
|
||||||
|
)';
|
||||||
|
$stmt = $appbox->get_connection()->prepare($sql);
|
||||||
|
foreach ($rs as $row)
|
||||||
|
{
|
||||||
|
$params = array(
|
||||||
|
':participant_id' => $row['participant_id'],
|
||||||
|
':basket_id' => $row['basket_id'],
|
||||||
|
':usr_id' => $row['usr_id'],
|
||||||
|
);
|
||||||
|
$stmt->execute($params);
|
||||||
|
}
|
||||||
|
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
|
$sql = 'UPDATE ValidationDatas
|
||||||
|
SET agreement = NULL where agreement = "0"';
|
||||||
|
|
||||||
|
$stmt = $appbox->get_connection()->prepare($sql);
|
||||||
|
$stmt->execute();
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
|
$sql = 'UPDATE ValidationDatas
|
||||||
|
SET agreement = "0" where agreement = "-1"';
|
||||||
|
|
||||||
|
$stmt = $appbox->get_connection()->prepare($sql);
|
||||||
|
$stmt->execute();
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = 'DELETE FROM sselcont WHERE sselcont_id = :sselcont_id';
|
|
||||||
$stmt = $appbox->get_connection()->prepare($sql);
|
|
||||||
|
|
||||||
foreach ($sselcont_ids as $sselcont_id)
|
|
||||||
{
|
|
||||||
$stmt->execute(array(':sselcont_id' => $sselcont_id));
|
|
||||||
}
|
|
||||||
|
|
||||||
$stmt->closeCursor();
|
|
||||||
|
|
||||||
$sql = 'INSERT INTO BasketElements
|
|
||||||
(
|
|
||||||
SELECT sselcont_id as id, c.ssel_id as basket_id, record_id, b.sbas_id, c.ord,
|
|
||||||
s.date as created, s.updater as updated
|
|
||||||
FROM sselcont c, ssel s, bas b
|
|
||||||
WHERE temporaryType = "0" AND b.base_id = c.base_id AND s.ssel_id = c.ssel_id
|
|
||||||
)';
|
|
||||||
|
|
||||||
$stmt = $appbox->get_connection()->prepare($sql);
|
|
||||||
$stmt->execute();
|
|
||||||
$stmt->closeCursor();
|
|
||||||
|
|
||||||
$sql = 'UPDATE Baskets SET pusher_id = NULL WHERE pusher_id = 0';
|
|
||||||
|
|
||||||
$stmt = $appbox->get_connection()->prepare($sql);
|
|
||||||
$stmt->execute();
|
|
||||||
$stmt->closeCursor();
|
|
||||||
|
|
||||||
|
|
||||||
$sql = 'INSERT INTO ValidationSessions
|
|
||||||
(
|
|
||||||
SELECT null as id, v.ssel_id as basket_id ,created_on as created
|
|
||||||
,updated_on as updated ,expires_on as expires
|
|
||||||
,v.usr_id as initiator_id
|
|
||||||
FROM ssel s, validate v
|
|
||||||
WHERE v.ssel_id = s.ssel_id AND v.usr_id = s.usr_id
|
|
||||||
)';
|
|
||||||
|
|
||||||
$stmt = $appbox->get_connection()->prepare($sql);
|
|
||||||
$stmt->execute();
|
|
||||||
$stmt->closeCursor();
|
|
||||||
|
|
||||||
$sql = 'INSERT INTO ValidationParticipants
|
|
||||||
(
|
|
||||||
SELECT v.id as id, v.usr_id
|
|
||||||
, 1 AS is_aware, confirmed as is_confirmed, 1 as can_agree
|
|
||||||
, can_see_others, last_reminder AS reminded
|
|
||||||
, vs.`id` AS ValidationSession_id
|
|
||||||
FROM validate v, ssel s, ValidationSessions vs
|
|
||||||
WHERE s.ssel_id = v.ssel_id AND vs.basket_id = v.ssel_id
|
|
||||||
)';
|
|
||||||
|
|
||||||
$stmt = $appbox->get_connection()->prepare($sql);
|
|
||||||
$stmt->execute();
|
|
||||||
$stmt->closeCursor();
|
|
||||||
|
|
||||||
|
|
||||||
$sql = 'SELECT usr_id, basket_id, p.id as participant_id
|
|
||||||
FROM ValidationParticipants p, ValidationSessions s
|
|
||||||
WHERE p.ValidationSession_Id = s.id';
|
|
||||||
|
|
||||||
|
|
||||||
$stmt = $appbox->get_connection()->prepare($sql);
|
|
||||||
$stmt->execute();
|
|
||||||
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
||||||
$stmt->closeCursor();
|
|
||||||
|
|
||||||
|
|
||||||
$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
|
|
||||||
WHERE c.sselcont_id = d.sselcont_id AND v.id = d.validate_id
|
|
||||||
AND v.usr_id = :usr_id AND v.ssel_id = :basket_id
|
|
||||||
)';
|
|
||||||
$stmt = $appbox->get_connection()->prepare($sql);
|
|
||||||
foreach ($rs as $row)
|
|
||||||
{
|
|
||||||
$params = array(
|
|
||||||
':participant_id' => $row['participant_id'],
|
|
||||||
':basket_id' => $row['basket_id'],
|
|
||||||
':usr_id' => $row['usr_id'],
|
|
||||||
);
|
|
||||||
$stmt->execute($params);
|
|
||||||
}
|
|
||||||
|
|
||||||
$stmt->closeCursor();
|
|
||||||
|
|
||||||
$sql = 'UPDATE ValidationDatas
|
|
||||||
SET agreement = NULL where agreement = "0"';
|
|
||||||
|
|
||||||
$stmt = $appbox->get_connection()->prepare($sql);
|
|
||||||
$stmt->execute();
|
|
||||||
$stmt->closeCursor();
|
|
||||||
|
|
||||||
$sql = 'UPDATE ValidationDatas
|
|
||||||
SET agreement = "0" where agreement = "-1"';
|
|
||||||
|
|
||||||
$stmt = $appbox->get_connection()->prepare($sql);
|
|
||||||
$stmt->execute();
|
|
||||||
$stmt->closeCursor();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -18,56 +18,56 @@
|
|||||||
class patch_3602 implements patchInterface
|
class patch_3602 implements patchInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $release = '3.6.0a1';
|
private $release = '3.6.0a1';
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var Array
|
* @var Array
|
||||||
*/
|
*/
|
||||||
private $concern = array(base::DATA_BOX);
|
private $concern = array(base::DATA_BOX);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function get_release()
|
function get_release()
|
||||||
{
|
|
||||||
return $this->release;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function require_all_upgrades()
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @return Array
|
|
||||||
*/
|
|
||||||
function concern()
|
|
||||||
{
|
|
||||||
return $this->concern;
|
|
||||||
}
|
|
||||||
|
|
||||||
function apply(base &$databox)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
$sql = 'ALTER TABLE `metadatas` DROP INDEX `unique`';
|
return $this->release;
|
||||||
|
|
||||||
$stmt = $databox->get_connection()->prepare($sql);
|
|
||||||
$stmt->execute();
|
|
||||||
$stmt->closeCursor();
|
|
||||||
}
|
|
||||||
catch(\PDOException $e)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
public function require_all_upgrades()
|
||||||
}
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return Array
|
||||||
|
*/
|
||||||
|
function concern()
|
||||||
|
{
|
||||||
|
return $this->concern;
|
||||||
|
}
|
||||||
|
|
||||||
|
function apply(base &$databox)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$sql = 'ALTER TABLE `metadatas` DROP INDEX `unique`';
|
||||||
|
|
||||||
|
$stmt = $databox->get_connection()->prepare($sql);
|
||||||
|
$stmt->execute();
|
||||||
|
$stmt->closeCursor();
|
||||||
|
}
|
||||||
|
catch(\PDOException $e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -18,51 +18,51 @@
|
|||||||
class patch_3603 implements patchInterface
|
class patch_3603 implements patchInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $release = '3.6.0a2';
|
private $release = '3.6.0a2';
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var Array
|
* @var Array
|
||||||
*/
|
*/
|
||||||
private $concern = array(base::APPLICATION_BOX);
|
private $concern = array(base::APPLICATION_BOX);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function get_release()
|
function get_release()
|
||||||
{
|
{
|
||||||
return $this->release;
|
return $this->release;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function require_all_upgrades()
|
public function require_all_upgrades()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return Array
|
* @return Array
|
||||||
*/
|
*/
|
||||||
function concern()
|
function concern()
|
||||||
{
|
{
|
||||||
return $this->concern;
|
return $this->concern;
|
||||||
}
|
}
|
||||||
|
|
||||||
function apply(base &$appbox)
|
function apply(base &$appbox)
|
||||||
{
|
{
|
||||||
|
|
||||||
$sql = 'UPDATE usr SET usr_mail = NULL
|
$sql = 'UPDATE usr SET usr_mail = NULL
|
||||||
WHERE usr_mail IS NOT NULL AND usr_login LIKE "(#deleted%"';
|
WHERE usr_mail IS NOT NULL AND usr_login LIKE "(#deleted%"';
|
||||||
|
|
||||||
$stmt = $appbox->get_connection()->prepare($sql);
|
$stmt = $appbox->get_connection()->prepare($sql);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -18,172 +18,172 @@
|
|||||||
class patch_3604 implements patchInterface
|
class patch_3604 implements patchInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private $release = '3.6.0a2';
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @var Array
|
|
||||||
*/
|
|
||||||
private $concern = array(base::DATA_BOX);
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
function get_release()
|
|
||||||
{
|
|
||||||
return $this->release;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function require_all_upgrades()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @return Array
|
|
||||||
*/
|
|
||||||
function concern()
|
|
||||||
{
|
|
||||||
return $this->concern;
|
|
||||||
}
|
|
||||||
|
|
||||||
function apply(base &$databox)
|
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* Fail if upgrade has previously failed, no problem
|
*
|
||||||
|
* @var string
|
||||||
*/
|
*/
|
||||||
try
|
private $release = '3.6.0a2';
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @var Array
|
||||||
|
*/
|
||||||
|
private $concern = array(base::DATA_BOX);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
function get_release()
|
||||||
{
|
{
|
||||||
$sql = "ALTER TABLE `metadatas`
|
return $this->release;
|
||||||
ADD `updated` TINYINT( 1 ) UNSIGNED NOT NULL DEFAULT '1',
|
|
||||||
ADD INDEX ( `updated` )";
|
|
||||||
|
|
||||||
$stmt = $databox->get_connection()->prepare($sql);
|
|
||||||
$stmt->execute();
|
|
||||||
$stmt->closeCursor();
|
|
||||||
|
|
||||||
$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)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function require_all_upgrades()
|
||||||
try
|
|
||||||
{
|
{
|
||||||
$sql = 'ALTER TABLE `metadatas` DROP INDEX `unique`';
|
return true;
|
||||||
|
|
||||||
$stmt = $databox->get_connection()->prepare($sql);
|
|
||||||
$stmt->execute();
|
|
||||||
$stmt->closeCursor();
|
|
||||||
}
|
|
||||||
catch(\PDOException $e)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = 'SELECT m . *
|
|
||||||
FROM metadatas_structure s, metadatas m
|
|
||||||
WHERE m.meta_struct_id = s.id
|
|
||||||
AND s.multi = "1" AND updated="0"';
|
|
||||||
|
|
||||||
$stmt = $databox->get_connection()->prepare($sql);
|
|
||||||
$stmt->execute();
|
|
||||||
$rowCount = $stmt->rowCount();
|
|
||||||
$stmt->closeCursor();
|
|
||||||
|
|
||||||
$n = 0;
|
|
||||||
$perPage = 1000;
|
|
||||||
|
|
||||||
while ($n < $rowCount)
|
|
||||||
{
|
|
||||||
$sql = 'SELECT m . *
|
|
||||||
FROM metadatas_structure s, metadatas m
|
|
||||||
WHERE m.meta_struct_id = s.id
|
|
||||||
AND s.multi = "1" LIMIT ' . $n . ', ' . $perPage;
|
|
||||||
|
|
||||||
$stmt = $databox->get_connection()->prepare($sql);
|
|
||||||
$stmt->execute();
|
|
||||||
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
||||||
$stmt->closeCursor();
|
|
||||||
|
|
||||||
$databox->get_connection()->beginTransaction();
|
|
||||||
|
|
||||||
$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)
|
|
||||||
{
|
|
||||||
$meta_struct_id = $row['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)
|
|
||||||
{
|
|
||||||
$params = array(
|
|
||||||
':record_id' => $row['record_id'],
|
|
||||||
':meta_struct_id' => $row['meta_struct_id'],
|
|
||||||
':value' => $value,
|
|
||||||
);
|
|
||||||
$stmt->execute($params);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$stmt->closeCursor();
|
|
||||||
|
|
||||||
|
|
||||||
$sql = 'DELETE FROM metadatas WHERE id = :id';
|
|
||||||
$stmt = $databox->get_connection()->prepare($sql);
|
|
||||||
|
|
||||||
foreach ($rs as $row)
|
|
||||||
{
|
|
||||||
$params = array(':id' => $row['id']);
|
|
||||||
$stmt->execute($params);
|
|
||||||
}
|
|
||||||
|
|
||||||
$stmt->closeCursor();
|
|
||||||
|
|
||||||
$databox->get_connection()->commit();
|
|
||||||
|
|
||||||
$n+= $perPage;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the extra column
|
*
|
||||||
|
* @return Array
|
||||||
*/
|
*/
|
||||||
try
|
function concern()
|
||||||
{
|
{
|
||||||
$sql = "ALTER TABLE `metadatas` DROP `updated`";
|
return $this->concern;
|
||||||
$stmt = $databox->get_connection()->prepare($sql);
|
|
||||||
$stmt->execute();
|
|
||||||
$stmt->closeCursor();
|
|
||||||
}
|
|
||||||
catch (\Exception $e)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
function apply(base &$databox)
|
||||||
}
|
{
|
||||||
|
/**
|
||||||
|
* Fail if upgrade has previously failed, no problem
|
||||||
|
*/
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$sql = "ALTER TABLE `metadatas`
|
||||||
|
ADD `updated` TINYINT( 1 ) UNSIGNED NOT NULL DEFAULT '1',
|
||||||
|
ADD INDEX ( `updated` )";
|
||||||
|
|
||||||
|
$stmt = $databox->get_connection()->prepare($sql);
|
||||||
|
$stmt->execute();
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
|
$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)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$sql = 'ALTER TABLE `metadatas` DROP INDEX `unique`';
|
||||||
|
|
||||||
|
$stmt = $databox->get_connection()->prepare($sql);
|
||||||
|
$stmt->execute();
|
||||||
|
$stmt->closeCursor();
|
||||||
|
}
|
||||||
|
catch(\PDOException $e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = 'SELECT m . *
|
||||||
|
FROM metadatas_structure s, metadatas m
|
||||||
|
WHERE m.meta_struct_id = s.id
|
||||||
|
AND s.multi = "1" AND updated="0"';
|
||||||
|
|
||||||
|
$stmt = $databox->get_connection()->prepare($sql);
|
||||||
|
$stmt->execute();
|
||||||
|
$rowCount = $stmt->rowCount();
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
|
$n = 0;
|
||||||
|
$perPage = 1000;
|
||||||
|
|
||||||
|
while ($n < $rowCount)
|
||||||
|
{
|
||||||
|
$sql = 'SELECT m . *
|
||||||
|
FROM metadatas_structure s, metadatas m
|
||||||
|
WHERE m.meta_struct_id = s.id
|
||||||
|
AND s.multi = "1" LIMIT ' . $n . ', ' . $perPage;
|
||||||
|
|
||||||
|
$stmt = $databox->get_connection()->prepare($sql);
|
||||||
|
$stmt->execute();
|
||||||
|
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
|
$databox->get_connection()->beginTransaction();
|
||||||
|
|
||||||
|
$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)
|
||||||
|
{
|
||||||
|
$meta_struct_id = $row['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)
|
||||||
|
{
|
||||||
|
$params = array(
|
||||||
|
':record_id' => $row['record_id'],
|
||||||
|
':meta_struct_id' => $row['meta_struct_id'],
|
||||||
|
':value' => $value,
|
||||||
|
);
|
||||||
|
$stmt->execute($params);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
|
|
||||||
|
$sql = 'DELETE FROM metadatas WHERE id = :id';
|
||||||
|
$stmt = $databox->get_connection()->prepare($sql);
|
||||||
|
|
||||||
|
foreach ($rs as $row)
|
||||||
|
{
|
||||||
|
$params = array(':id' => $row['id']);
|
||||||
|
$stmt->execute($params);
|
||||||
|
}
|
||||||
|
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
|
$databox->get_connection()->commit();
|
||||||
|
|
||||||
|
$n+= $perPage;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the extra column
|
||||||
|
*/
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$sql = "ALTER TABLE `metadatas` DROP `updated`";
|
||||||
|
$stmt = $databox->get_connection()->prepare($sql);
|
||||||
|
$stmt->execute();
|
||||||
|
$stmt->closeCursor();
|
||||||
|
}
|
||||||
|
catch (\Exception $e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -20,128 +20,128 @@ use Doctrine\ORM\Tools\Pagination\Paginator;
|
|||||||
class patch_361 implements patchInterface
|
class patch_361 implements patchInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $release = '3.6.1';
|
private $release = '3.6.1';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var Array
|
* @var Array
|
||||||
*/
|
*/
|
||||||
private $concern = array(base::APPLICATION_BOX);
|
private $concern = array(base::APPLICATION_BOX);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function get_release()
|
function get_release()
|
||||||
{
|
|
||||||
return $this->release;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function require_all_upgrades()
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @return Array
|
|
||||||
*/
|
|
||||||
function concern()
|
|
||||||
{
|
|
||||||
return $this->concern;
|
|
||||||
}
|
|
||||||
|
|
||||||
function apply(base &$appbox)
|
|
||||||
{
|
|
||||||
$Core = \bootstrap::getCore();
|
|
||||||
|
|
||||||
$em = $Core->getEntityManager();
|
|
||||||
|
|
||||||
$conn = $appbox->get_connection();
|
|
||||||
|
|
||||||
$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)
|
|
||||||
{
|
{
|
||||||
$sbas_id = (int) $row['sbas_id'];
|
return $this->release;
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
$connbas = connection::getPDOConnection($sbas_id);
|
|
||||||
}
|
|
||||||
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';
|
|
||||||
$stmt = $connbas->prepare($sql);
|
|
||||||
$stmt->execute(array(':record_id' => $row['record_id']));
|
|
||||||
$rowCount = $stmt->rowCount();
|
|
||||||
$stmt->closeCursor();
|
|
||||||
|
|
||||||
if ($rowCount == 0)
|
|
||||||
{
|
|
||||||
$conn->exec('DELETE FROM ValidationDatas WHERE basket_element_id = ' . $row['id']);
|
|
||||||
$conn->exec('DELETE FROM BasketElements WHERE id = ' . $row['id']);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function require_all_upgrades()
|
||||||
$dql = "SELECT b FROM Entities\Basket b WHERE b.description != ''";
|
|
||||||
|
|
||||||
$n = 0;
|
|
||||||
$perPage = 100;
|
|
||||||
|
|
||||||
$query = $em->createQuery($dql)
|
|
||||||
->setFirstResult($n)
|
|
||||||
->setMaxResults($perPage);
|
|
||||||
|
|
||||||
$paginator = new Paginator($query, true);
|
|
||||||
|
|
||||||
$count = count($paginator);
|
|
||||||
|
|
||||||
while ($n < $count)
|
|
||||||
{
|
{
|
||||||
$query = $em->createQuery($dql)
|
return false;
|
||||||
->setFirstResult($n)
|
}
|
||||||
->setMaxResults($perPage);
|
|
||||||
|
|
||||||
$paginator = new Paginator($query, true);
|
/**
|
||||||
|
*
|
||||||
|
* @return Array
|
||||||
|
*/
|
||||||
|
function concern()
|
||||||
|
{
|
||||||
|
return $this->concern;
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($paginator as $basket)
|
function apply(base &$appbox)
|
||||||
{
|
{
|
||||||
$htmlDesc = $basket->getDescription();
|
$Core = \bootstrap::getCore();
|
||||||
|
|
||||||
$description = trim(strip_tags(str_replace("<br />", "\n", $htmlDesc)));
|
$em = $Core->getEntityManager();
|
||||||
|
|
||||||
if ($htmlDesc == $description)
|
$conn = $appbox->get_connection();
|
||||||
|
|
||||||
|
$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)
|
||||||
{
|
{
|
||||||
continue;
|
$sbas_id = (int) $row['sbas_id'];
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$connbas = connection::getPDOConnection($sbas_id);
|
||||||
|
}
|
||||||
|
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';
|
||||||
|
$stmt = $connbas->prepare($sql);
|
||||||
|
$stmt->execute(array(':record_id' => $row['record_id']));
|
||||||
|
$rowCount = $stmt->rowCount();
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
|
if ($rowCount == 0)
|
||||||
|
{
|
||||||
|
$conn->exec('DELETE FROM ValidationDatas WHERE basket_element_id = ' . $row['id']);
|
||||||
|
$conn->exec('DELETE FROM BasketElements WHERE id = ' . $row['id']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$basket->setDescription($description);
|
|
||||||
}
|
|
||||||
|
|
||||||
$n += $perPage;
|
$dql = "SELECT b FROM Entities\Basket b WHERE b.description != ''";
|
||||||
$em->flush();
|
|
||||||
|
$n = 0;
|
||||||
|
$perPage = 100;
|
||||||
|
|
||||||
|
$query = $em->createQuery($dql)
|
||||||
|
->setFirstResult($n)
|
||||||
|
->setMaxResults($perPage);
|
||||||
|
|
||||||
|
$paginator = new Paginator($query, true);
|
||||||
|
|
||||||
|
$count = count($paginator);
|
||||||
|
|
||||||
|
while ($n < $count)
|
||||||
|
{
|
||||||
|
$query = $em->createQuery($dql)
|
||||||
|
->setFirstResult($n)
|
||||||
|
->setMaxResults($perPage);
|
||||||
|
|
||||||
|
$paginator = new Paginator($query, true);
|
||||||
|
|
||||||
|
foreach ($paginator as $basket)
|
||||||
|
{
|
||||||
|
$htmlDesc = $basket->getDescription();
|
||||||
|
|
||||||
|
$description = trim(strip_tags(str_replace("<br />", "\n", $htmlDesc)));
|
||||||
|
|
||||||
|
if ($htmlDesc == $description)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$basket->setDescription($description);
|
||||||
|
}
|
||||||
|
|
||||||
|
$n += $perPage;
|
||||||
|
$em->flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
$em->flush();
|
||||||
|
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$em->flush();
|
|
||||||
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user