diff --git a/include/modele.inc.php b/include/modele.inc.php
index f76ce6392..b472cad8d 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 deb80e468..c39619762 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 ''._('Ne pas recharger la page, sinon votre base de données sera restaurée une fois de plus').'';
Dossier::synchro_admin($id);
User::remove_inexistant_user($id);
+ $new_cn->clean_orphan_lob();
echo $retour;
echo '';
@@ -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 ''._('Ne pas recharger la page, sinon votre base de données sera restaurée une fois de plus').'';
echo $retour;
diff --git a/include/upgrade.inc.php b/include/upgrade.inc.php
index 17afab216..991c1e327 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
{