make it work in recent versions of seeddms

This commit is contained in:
Uwe Steinmann 2023-01-19 07:06:45 +01:00
parent 9d69bd12eb
commit 2f0fdfca19

View File

@ -18,16 +18,12 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
include("../inc/inc.Settings.php");
include("../inc/inc.AccessUtils.php");
include("../inc/inc.ClassAccess.php");
include("../inc/inc.ClassDocument.php");
include("../inc/inc.ClassFolder.php");
include("../inc/inc.ClassGroup.php");
include("../inc/inc.ClassUser.php");
include("../inc/inc.DBAccess.php");
include("../inc/inc.FileUtils.php");
include("../inc/inc.Authentication.php");
include("../../inc/inc.Settings.php");
include("../../inc/inc.Utils.php");
include("../../inc/inc.LogInit.php");
include("../../inc/inc.Language.php");
include("../../inc/inc.Init.php");
include("../../inc/inc.DBInit.php");
print "<html></body>";
@ -42,7 +38,7 @@ function update_content()
GLOBAL $db,$settings;
// create temp folder
if (!makedir($settings->_contentDir."/temp")) return false;
if (!SeedDMS_Core_File::makeDir($settings->_contentDir."/temp")) return false;
// for all contents
$queryStr = "SELECT * FROM tblDocumentContent";
@ -53,19 +49,19 @@ function update_content()
for ($i=0;$i<count($contents);$i++){
// create temp/documentID folder
if (!makedir($settings->_contentDir."/temp/".$contents[$i]["document"])) return false;
if (!SeedDMS_Core_File::makeDir($settings->_contentDir."/temp/".$contents[$i]["document"])) return false;
// move every content in temp/documentID/version.fileType
$source = $settings->_contentDir."/".$contents[$i]["dir"]."/data".$contents[$i]["fileType"];
$target = $settings->_contentDir."/temp/".$contents[$i]["document"]."/".$contents[$i]["version"].$contents[$i]["fileType"];
if (!copyFile($source, $target)) return false;
if (!SeedDMS_Core_File::copyFile($source, $target)) return false;
}
// change directory
if (!renameDir($settings->_contentDir."/".$settings->_contentOffsetDir,$settings->_contentDir."/old")) return false;
if (!renameDir($settings->_contentDir."/temp",$settings->_contentDir."/".$settings->_contentOffsetDir)) return false;
if (!SeedDMS_Core_File::renameDir($settings->_contentDir."/".$settings->_contentOffsetDir,$settings->_contentDir."/old")) return false;
if (!SeedDMS_Core_File::renameDir($settings->_contentDir."/temp",$settings->_contentDir."/".$settings->_contentOffsetDir)) return false;
return true;
}