mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 15:03:25 +00:00
Patch CS consistency
This commit is contained in:
@@ -57,7 +57,7 @@ class patch_320alpha1a implements patchInterface
|
||||
public function apply(base $databox, Application $app)
|
||||
{
|
||||
$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->execute();
|
||||
$stmt->closeCursor();
|
||||
|
@@ -56,12 +56,13 @@ class patch_320alpha1b implements patchInterface
|
||||
public function apply(base $appbox, Application $app)
|
||||
{
|
||||
$sql = 'REPLACE INTO records_rights
|
||||
(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
|
||||
FROM sselcont c, ssel s, bas b
|
||||
WHERE c.ssel_id = s.ssel_id
|
||||
AND b.base_id = c.base_id AND c.canHD = 1
|
||||
)';
|
||||
(
|
||||
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
|
||||
FROM sselcont c, ssel s, bas b
|
||||
WHERE c.ssel_id = s.ssel_id
|
||||
AND b.base_id = c.base_id AND c.canHD = 1
|
||||
)';
|
||||
$stmt = $appbox->get_connection()->prepare($sql);
|
||||
$stmt->execute();
|
||||
$stmt->closeCursor();
|
||||
|
@@ -56,7 +56,6 @@ class patch_320alpha2a implements patchInterface
|
||||
public function apply(base $appbox, Application $app)
|
||||
{
|
||||
$sql = 'SELECT * FROM usr WHERE nonce IS NULL';
|
||||
|
||||
$stmt = $appbox->get_connection()->prepare($sql);
|
||||
$stmt->execute();
|
||||
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
@@ -75,9 +75,8 @@ class patch_320alpha4b implements patchInterface
|
||||
|
||||
}
|
||||
|
||||
$sql = 'SELECT ssel_id, usr_id, name, descript, pub_date
|
||||
, updater, pub_restrict, homelink
|
||||
FROM ssel WHERE (public = "1" or homelink="1") and migrated = 0';
|
||||
$sql = 'SELECT ssel_id, usr_id, name, descript, pub_date, updater, pub_restrict, homelink
|
||||
FROM ssel WHERE (public = "1" or homelink="1") and migrated = 0';
|
||||
|
||||
$stmt = $appbox->get_connection()->prepare($sql);
|
||||
$stmt->execute();
|
||||
@@ -119,7 +118,7 @@ class patch_320alpha4b implements patchInterface
|
||||
}
|
||||
|
||||
$sql = 'SELECT sselcont_id, ssel_id, base_id, record_id
|
||||
FROM sselcont WHERE ssel_id = :ssel_id ORDER BY ord ASC';
|
||||
FROM sselcont WHERE ssel_id = :ssel_id ORDER BY ord ASC';
|
||||
$stmt = $appbox->get_connection()->prepare($sql);
|
||||
$stmt->execute([':ssel_id' => $row['ssel_id']]);
|
||||
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
@@ -142,7 +141,7 @@ class patch_320alpha4b implements patchInterface
|
||||
$app['EM']->persist($entry);
|
||||
|
||||
$sql = 'UPDATE ssel SET deleted = "1", migrated="1"
|
||||
WHERE ssel_id = :ssel_id';
|
||||
WHERE ssel_id = :ssel_id';
|
||||
$stmt = $appbox->get_connection()->prepare($sql);
|
||||
$stmt->execute([':ssel_id' => $row['ssel_id']]);
|
||||
$stmt->closeCursor();
|
||||
|
@@ -63,7 +63,7 @@ class patch_320alpha5a implements patchInterface
|
||||
$stmt->closeCursor();
|
||||
|
||||
$sql = 'UPDATE basusr SET order_master="1"
|
||||
WHERE base_id = :base_id AND usr_id = :usr_id';
|
||||
WHERE base_id = :base_id AND usr_id = :usr_id';
|
||||
$stmt = $appbox->get_connection()->prepare($sql);
|
||||
|
||||
foreach ($rs as $row) {
|
||||
|
@@ -56,15 +56,15 @@ class patch_320alpha6a implements patchInterface
|
||||
public function apply(base $databox, Application $app)
|
||||
{
|
||||
$sql = 'UPDATE record r, subdef s
|
||||
SET r.mime = s.mime
|
||||
WHERE r.record_id = s.record_id AND s.name="document"';
|
||||
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';
|
||||
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();
|
||||
|
@@ -57,7 +57,8 @@ class patch_360alpha2a implements patchInterface
|
||||
{
|
||||
|
||||
$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->execute();
|
||||
|
@@ -60,16 +60,18 @@ class patch_360alpha2b implements patchInterface
|
||||
*/
|
||||
try {
|
||||
$sql = "ALTER TABLE `metadatas`
|
||||
ADD `updated` TINYINT( 1 ) UNSIGNED NOT NULL DEFAULT '1',
|
||||
ADD INDEX ( `updated` )";
|
||||
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")';
|
||||
WHERE meta_struct_id IN
|
||||
(
|
||||
SELECT id FROM metadatas_structure WHERE multi = "1"
|
||||
)';
|
||||
$stmt = $databox->get_connection()->prepare($sql);
|
||||
$stmt->execute();
|
||||
$stmt->closeCursor();
|
||||
@@ -88,9 +90,9 @@ class patch_360alpha2b implements patchInterface
|
||||
}
|
||||
|
||||
$sql = 'SELECT m . *
|
||||
FROM metadatas_structure s, metadatas m
|
||||
WHERE m.meta_struct_id = s.id
|
||||
AND s.multi = "1" AND updated="0"';
|
||||
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();
|
||||
@@ -102,9 +104,9 @@ class patch_360alpha2b implements patchInterface
|
||||
|
||||
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;
|
||||
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();
|
||||
@@ -114,7 +116,7 @@ class patch_360alpha2b implements patchInterface
|
||||
$databox->get_connection()->beginTransaction();
|
||||
|
||||
$sql = 'INSERT INTO metadatas(id, record_id, meta_struct_id, value)
|
||||
VALUES (null, :record_id, :meta_struct_id, :value)';
|
||||
VALUES (null, :record_id, :meta_struct_id, :value)';
|
||||
$stmt = $databox->get_connection()->prepare($sql);
|
||||
|
||||
$databox_fields = [];
|
||||
|
@@ -69,5 +69,7 @@ class patch_370alpha3a implements patchInterface
|
||||
$client->set_type(\API_OAuth2_Application::DESKTOP_TYPE);
|
||||
$client->set_redirect_uri(\API_OAuth2_Application::NATIVE_APP_REDIRECT_URI);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -55,7 +55,6 @@ class patch_370alpha4a implements patchInterface
|
||||
|
||||
public function apply(base $databox, Application $app)
|
||||
{
|
||||
|
||||
$sql = 'SELECT id, src FROM metadatas_structure';
|
||||
$stmt = $databox->get_connection()->prepare($sql);
|
||||
$stmt->execute();
|
||||
|
@@ -153,7 +153,7 @@ class patch_370alpha7a implements patchInterface
|
||||
|
||||
$stmt->closeCursor();
|
||||
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
private function truncateTable(\Doctrine\ORM\EntityManager $em, $className)
|
||||
|
@@ -62,5 +62,7 @@ class patch_371alpha1a implements patchInterface
|
||||
foreach ($databox->get_meta_structure() as $databox_field) {
|
||||
$databox_field->save();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -65,5 +65,7 @@ class patch_380alpha10a implements patchInterface
|
||||
}
|
||||
|
||||
$stmt->closeCursor();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -63,7 +63,7 @@ class patch_380alpha11a implements patchInterface
|
||||
$stmt->closeCursor();
|
||||
} catch (\PDOException $e) {
|
||||
// this may fail on oldest versions
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($rs as $row) {
|
||||
@@ -115,5 +115,7 @@ class patch_380alpha11a implements patchInterface
|
||||
}
|
||||
|
||||
$app['EM']->flush();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -66,5 +66,7 @@ class patch_380alpha2a implements patchInterface
|
||||
}
|
||||
|
||||
$app['configuration']->setConfig($config);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -70,6 +70,6 @@ class patch_380alpha2b implements patchInterface
|
||||
$app['phraseanet.appbox']->get_connection()->exec($sql);
|
||||
}
|
||||
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -68,44 +68,44 @@ class patch_380alpha3a implements patchInterface
|
||||
$procedure = "
|
||||
CREATE PROCEDURE explode_log_table(bound VARCHAR(255))
|
||||
BEGIN
|
||||
DECLARE l_log_id INT UNSIGNED DEFAULT 0;
|
||||
DECLARE l_coll_list TEXT;
|
||||
DECLARE occurance INT DEFAULT 0;
|
||||
DECLARE i INT DEFAULT 0;
|
||||
DECLARE dest_coll_id INT;
|
||||
DECLARE done INT DEFAULT 0;
|
||||
DECLARE result_set CURSOR FOR
|
||||
DECLARE l_log_id INT UNSIGNED DEFAULT 0;
|
||||
DECLARE l_coll_list TEXT;
|
||||
DECLARE occurance INT DEFAULT 0;
|
||||
DECLARE i INT DEFAULT 0;
|
||||
DECLARE dest_coll_id INT;
|
||||
DECLARE done INT DEFAULT 0;
|
||||
DECLARE result_set CURSOR FOR
|
||||
SELECT l.id, l.coll_list
|
||||
FROM log l
|
||||
LEFT JOIN log_colls lc ON (lc.log_id = l.id)
|
||||
WHERE (lc.log_id IS NULL) AND coll_list != '';
|
||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;
|
||||
OPEN result_set;
|
||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;
|
||||
OPEN result_set;
|
||||
read_loop: LOOP
|
||||
FETCH result_set INTO l_log_id, l_coll_list;
|
||||
IF done THEN
|
||||
FETCH result_set INTO l_log_id, l_coll_list;
|
||||
IF done THEN
|
||||
LEAVE read_loop;
|
||||
END IF;
|
||||
SET occurance = (SELECT LENGTH(l_coll_list) - LENGTH(REPLACE(l_coll_list, bound, ''))+1);
|
||||
SET i=1;
|
||||
START TRANSACTION;
|
||||
WHILE i <= occurance DO
|
||||
SET dest_coll_id = (SELECT REPLACE(
|
||||
SUBSTRING(
|
||||
SUBSTRING_INDEX(l_coll_list, bound, i),
|
||||
LENGTH(SUBSTRING_INDEX(l_coll_list, bound, i - 1)) + 1
|
||||
),
|
||||
',',
|
||||
''
|
||||
));
|
||||
IF dest_coll_id > 0 THEN
|
||||
INSERT INTO log_colls VALUES (null, l_log_id, dest_coll_id);
|
||||
END IF;
|
||||
SET i = i + 1;
|
||||
END WHILE;
|
||||
COMMIT;
|
||||
SET occurance = (SELECT LENGTH(l_coll_list) - LENGTH(REPLACE(l_coll_list, bound, ''))+1);
|
||||
SET i=1;
|
||||
START TRANSACTION;
|
||||
WHILE i <= occurance DO
|
||||
SET dest_coll_id = (SELECT REPLACE(
|
||||
SUBSTRING(
|
||||
SUBSTRING_INDEX(l_coll_list, bound, i),
|
||||
LENGTH(SUBSTRING_INDEX(l_coll_list, bound, i - 1)) + 1
|
||||
),
|
||||
',',
|
||||
''
|
||||
));
|
||||
IF dest_coll_id > 0 THEN
|
||||
INSERT INTO log_colls VALUES (null, l_log_id, dest_coll_id);
|
||||
END IF;
|
||||
SET i = i + 1;
|
||||
END WHILE;
|
||||
COMMIT;
|
||||
END LOOP;
|
||||
CLOSE result_set;
|
||||
CLOSE result_set;
|
||||
END;";
|
||||
|
||||
$stmt = $conn->prepare($procedure);
|
||||
|
@@ -81,5 +81,7 @@ class patch_380alpha4a implements patchInterface
|
||||
|
||||
$app['EM']->flush();
|
||||
$app['EM']->clear();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -50,5 +50,7 @@ class patch_380alpha6a implements patchInterface
|
||||
{
|
||||
$app['configuration']->setDefault('registration-fields');
|
||||
$app['configuration']->setDefault('authentication');
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -57,7 +57,7 @@ class patch_380alpha8a implements patchInterface
|
||||
$stmt->closeCursor();
|
||||
|
||||
if (!$row) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
$sxe = simplexml_load_string($row['settings']);
|
||||
|
@@ -70,5 +70,7 @@ class patch_380alpha9a implements patchInterface
|
||||
$dom->loadXML($sxe->asXML());
|
||||
|
||||
$databox->saveStructure($dom);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -49,8 +49,8 @@ class patch_381alpha1a implements patchInterface
|
||||
public function apply(base $appbox, Application $app)
|
||||
{
|
||||
$sql = 'SELECT base_id, ord, sbas_id
|
||||
FROM `bas`
|
||||
ORDER BY sbas_id, ord';
|
||||
FROM `bas`
|
||||
ORDER BY sbas_id, ord';
|
||||
$stmt = $appbox->get_connection()->prepare($sql);
|
||||
$stmt->execute();
|
||||
$rs = $stmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||
|
@@ -88,5 +88,7 @@ class patch_390alpha1a implements patchInterface
|
||||
|
||||
$em->flush();
|
||||
$em->clear();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -123,5 +123,7 @@ class patch_390alpha1b implements patchInterface
|
||||
$em->clear();
|
||||
|
||||
$em->getEventManager()->addEventSubscriber(new TimestampableListener());
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -68,6 +68,8 @@ class patch_390alpha2a implements patchInterface
|
||||
$this->updateModels($em, $conn);
|
||||
|
||||
$em->getEventManager()->addEventSubscriber(new TimestampableListener());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -76,10 +78,10 @@ class patch_390alpha2a implements patchInterface
|
||||
private function updateUsers(EntityManager $em, $conn)
|
||||
{
|
||||
$sql = 'SELECT activite, adresse, create_db, canchgftpprofil, canchgprofil, ville,
|
||||
societe, pays, usr_mail, fax, usr_prenom, geonameid, invite, fonction, last_conn, lastModel,
|
||||
usr_nom, ldap_created, locale, usr_login, mail_locked, mail_notifications, nonce, usr_password, push_list,
|
||||
request_notifications, salted_password, usr_sexe, tel, timezone, cpostal, usr_creationdate, usr_modificationdate
|
||||
FROM usr WHERE model_of = 0';
|
||||
societe, pays, usr_mail, fax, usr_prenom, geonameid, invite, fonction, last_conn, lastModel,
|
||||
usr_nom, ldap_created, locale, usr_login, mail_locked, mail_notifications, nonce, usr_password, push_list,
|
||||
request_notifications, salted_password, usr_sexe, tel, timezone, cpostal, usr_creationdate, usr_modificationdate
|
||||
FROM usr WHERE model_of = 0';
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
$rows = $stmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||
|
@@ -84,5 +84,7 @@ class patch_390alpha3a implements patchInterface
|
||||
|
||||
$em->flush();
|
||||
$em->clear();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -89,5 +89,7 @@ class patch_390alpha4a implements patchInterface
|
||||
|
||||
$em->flush();
|
||||
$em->clear();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -85,5 +85,7 @@ class patch_390alpha5a implements patchInterface
|
||||
|
||||
$em->flush();
|
||||
$em->clear();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -80,8 +80,7 @@ class patch_390alpha6a implements patchInterface
|
||||
$rs = $stmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||
$stmt->closeCursor();
|
||||
|
||||
$sql = 'SELECT base_id, record_id, subdef, filename, folder, error,
|
||||
done, businessfields
|
||||
$sql = 'SELECT base_id, record_id, subdef, filename, folder, error, done, businessfields
|
||||
FROM ftp_export_elements
|
||||
WHERE ftp_export_id = :export_id';
|
||||
$stmt = $conn->prepare($sql);
|
||||
@@ -152,5 +151,7 @@ class patch_390alpha6a implements patchInterface
|
||||
$em->clear();
|
||||
|
||||
$em->getEventManager()->addEventSubscriber(new TimestampableListener());
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -220,5 +220,7 @@ class patch_390alpha7a implements patchInterface
|
||||
|
||||
$em->flush();
|
||||
$em->clear();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user