[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 03/04: Clean orphan lob : when upgrade + rest
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 03/04: Clean orphan lob : when upgrade + restore |
Date: |
Tue, 08 Mar 2016 21:41:29 +0000 |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 30b2499b4dba217c863897c67836b6863cffbe1e
Author: Dany De Bontridder <address@hidden>
Date: Tue Mar 8 22:16:16 2016 +0100
Clean orphan lob : when upgrade + restore
---
include/modele.inc.php | 23 +++--------------------
include/restore.inc.php | 7 ++++---
include/upgrade.inc.php | 2 ++
3 files changed, 9 insertions(+), 23 deletions(-)
diff --git a/include/modele.inc.php b/include/modele.inc.php
index f76ce63..b472cad 100644
--- a/include/modele.inc.php
+++ b/include/modele.inc.php
@@ -181,18 +181,6 @@ if (isset($_POST["FMOD_NAME"]))
$Res = $cn_mod->exec_sql("delete from action_tags");
$Res = $cn_mod->exec_sql("delete from document");
- // Remove lob file
- $Res = $cn_mod->exec_sql("select distinct d_lob from document");
- if (Database::num_row($Res) != 0)
- {
- $a_lob = Database::fetch_all($Res);
- $a_lob = ($a_lob == false) ? array():$a_lob;
- //var_dump($a_lob);
- foreach ($a_lob as $lob)
- {
- $cn_mod->lo_unlink($lob['d_lob']);
- }
- }
// reset sequences for Follow-up
$a_seq=$cn_mod->get_array(" select sequence_name "
. " from information_schema.sequences "
@@ -225,14 +213,7 @@ if (isset($_POST["FMOD_NAME"]))
$Res = $cn_mod->exec_sql("delete from document_modele");
$Res = $cn_mod->exec_sql("delete from op_predef");
- // Remove lob file
- $Res = $cn_mod->exec_sql("select distinct loid from
pg_largeobject");
- if (Database::num_row($Res) != 0)
- {
- $a_lob = Database::fetch_all($Res);
- foreach ($a_lob as $lob)
- $cn_mod->lo_unlink($lob['loid']);
- }
+
}
if (isset($_POST['CANAL']))
{
@@ -252,6 +233,8 @@ if (isset($_POST["FMOD_NAME"]))
$cn_mod->exec_sql(" drop schema ".$a_schema[$i]['nspname']."
cascade");
}
}
+ // Clean orphan log
+ $cn_mod->orphan_lob_clean();
}
// Show all available templates
diff --git a/include/restore.inc.php b/include/restore.inc.php
index deb80e4..c396197 100644
--- a/include/restore.inc.php
+++ b/include/restore.inc.php
@@ -131,10 +131,11 @@ if ( isset ($_REQUEST['sa'] ))
}
$new_cn=new Database($id);
- $new_cn->apply_patch($name,0);
+ $new_cn->apply_patch($name);
echo '<span class="error">'._('Ne pas recharger la page, sinon votre
base de données sera restaurée une fois de plus').'</span>';
Dossier::synchro_admin($id);
User::remove_inexistant_user($id);
+ $new_cn->clean_orphan_lob();
echo $retour;
echo '</div>';
@@ -192,8 +193,8 @@ if ( isset ($_REQUEST['sa'] ))
$new_cn=new Database($id,'mod');
- $new_cn->apply_patch($name,0);
-
+ $new_cn->apply_patch($name);
+ $new_cn->clean_orphan_lob();
echo '<span class="error">'._('Ne pas recharger la page, sinon votre
base de données sera restaurée une fois de plus').'</span>';
echo $retour;
diff --git a/include/upgrade.inc.php b/include/upgrade.inc.php
index 17afab2..991c1e3 100644
--- a/include/upgrade.inc.php
+++ b/include/upgrade.inc.php
@@ -72,6 +72,7 @@ if ($sb === "upg_all" &&
(!defined('MULTI')||(defined('MULTI')&&MULTI==1)))
$db->apply_patch($db_row['dos_name']);
Dossier::synchro_admin($db_row['dos_id']);
User::remove_inexistant_user($db_row['dos_id']);
+ $db->clean_orphan_lob();
}
else
{
@@ -96,6 +97,7 @@ if ($sb === "upg_all" &&
(!defined('MULTI')||(defined('MULTI')&&MULTI==1)))
{
$db=new Database($db_row['mod_id'], 'mod');
$db->apply_patch($db_row['mod_name']);
+ $db->clean_orphan_lob();
}
else
{