partially fix some old update tools

This commit is contained in:
Uwe Steinmann 2022-09-08 17:50:01 +02:00
parent 2eeb3771ee
commit 64f75009bf
6 changed files with 165 additions and 171 deletions

View File

@ -1,42 +1,42 @@
<?php
// MyDMS. Document Management System
// Copyright (C) 2002-2005 Markus Westphal
// Copyright (C) 2006-2008 Malcolm Cowe
<?php
// MyDMS. Document Management System
// Copyright (C) 2002-2005 Markus Westphal
// Copyright (C) 2006-2008 Malcolm Cowe
// Copyright (C) 2010 Matteo Lucarelli
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// 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");
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// 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");
print "<html></body>";
if (!$user->isAdmin()) {
print "<b>ERROR: You must be administrator to execute the update</b>";
die;
die;
}
function update_content()
function update_content()
{
GLOBAL $db,$settings;
@ -45,7 +45,7 @@ function update_content()
if (!makedir($settings->_contentDir."/temp")) return false;
// for all contents
$queryStr = "SELECT * FROM tblDocumentContent";
$queryStr = "SELECT * FROM tblDocumentContent";
$contents = $db->getResultArray($queryStr);
if (is_bool($contents)&&!$contents) return false;
@ -75,7 +75,7 @@ function update_db()
GLOBAL $db,$settings;
// for all contents
$queryStr = "SELECT * FROM tblDocumentContent";
$queryStr = "SELECT * FROM tblDocumentContent";
$contents = $db->getResultArray($queryStr);
if (is_bool($contents)&&!$contents) return false;
@ -100,25 +100,24 @@ function update_db()
if (!$db->getResult($queryStr)) return false;
return true;
}
}
print "<b>Updating ...please wait</b><br>";
if (!update_content()) {
if (!update_content()) {
print "<b>ERROR: An error occurred during the directory reordering</b>";
die;
die;
}
if (!update_db()) {
if (!update_db()) {
print "<b>ERROR: An error occurred during the DB update</b>";
print "<br><b>Please try to execute the update.sql manually</b>";
die;
die;
}
print "<b>Update done</b><br>";
print "</body></html>";
?>
print "</body></html>";

View File

@ -1,33 +1,33 @@
-- mysql -uroot -ppassword mydms < update.sql
-- this script must be executed when updating form a version < 1.8.1
-- --------------------------------------------------------
--
-- New table for document-related files
-- --------------------------------------------------------
--
-- New table for document-related files
--
CREATE TABLE `tblDocumentFiles` (
`id` int(11) NOT NULL auto_increment,
`document` int(11) NOT NULL default '0',
`userID` int(11) NOT NULL default '0',
`comment` text,
`name` varchar(150) default NULL,
`date` int(12) default NULL,
`dir` varchar(255) NOT NULL default '',
`orgFileName` varchar(150) NOT NULL default '',
`fileType` varchar(10) NOT NULL default '',
`mimeType` varchar(70) NOT NULL default '',
PRIMARY KEY (`id`)
) ;
CREATE TABLE `tblDocumentFiles` (
`id` int(11) NOT NULL auto_increment,
`document` int(11) NOT NULL default '0',
`userID` int(11) NOT NULL default '0',
`comment` text,
`name` varchar(150) default NULL,
`date` int(12) default NULL,
`dir` varchar(255) NOT NULL default '',
`orgFileName` varchar(150) NOT NULL default '',
`fileType` varchar(10) NOT NULL default '',
`mimeType` varchar(70) NOT NULL default '',
PRIMARY KEY (`id`)
) Engine=MyISAM ;
-- --------------------------------------------------------
--
-- Not longer required by new filesystem structure
-- --------------------------------------------------------
--
-- Not longer required by new filesystem structure
--
DROP TABLE `tblDirPath`;
DROP TABLE `tblPathList`;
DROP TABLE `tblDirPath`;
DROP TABLE `tblPathList`;

View File

@ -1,39 +1,39 @@
<?php
// MyDMS. Document Management System
// Copyright (C) 2002-2005 Markus Westphal
// Copyright (C) 2006-2008 Malcolm Cowe
<?php
// MyDMS. Document Management System
// Copyright (C) 2002-2005 Markus Westphal
// Copyright (C) 2006-2008 Malcolm Cowe
// Copyright (C) 2010 Matteo Lucarelli
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// 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");
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// 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");
print "<html></body>";
if (!$user->isAdmin()) {
print "<b>ERROR: You must be administrator to execute the update</b>";
die;
die;
}
function update_db()
@ -52,22 +52,21 @@ function update_db()
if (!$db->getResult($queryStr)) return false;
return true;
}
}
print "<b>Updating ...please wait</b><br>";
print "<pre>";
print "<pre>";
if (!update_db()) {
print "</pre>";
print "<b>ERROR: An error occurred during the DB update</b>";
print "<br><b>Please try to execute the update.sql manually</b>";
die;
}else print "</pre><b>Update done</b><br>";
print "</body></html>";
?>
print "</body></html>";

View File

@ -1,10 +1,10 @@
-- mysql -uyouruser -pyourpassword yourdb < update.sql
-- this script must be executed when updating form a version < 1.9
-- --------------------------------------------------------
--
-- New field for hidden users
-- --------------------------------------------------------
--
-- New field for hidden users
--
ALTER TABLE `tblUsers` ADD `hidden` smallint(1) NOT NULL default '0' ;
@ -12,27 +12,27 @@ ALTER TABLE `tblUsers` ADD `hidden` smallint(1) NOT NULL default '0' ;
--
-- New field for group manager permission
--
ALTER TABLE `tblGroupMembers` ADD `manager` smallint(1) NOT NULL default '0' ;
--
-- Table structure for mandatory reviewers
--
CREATE TABLE `tblMandatoryReviewers` (
`userID` int(11) NOT NULL default '0',
`reviewerUserID` int(11) NOT NULL default '0',
`reviewerGroupID` int(11) NOT NULL default '0',
PRIMARY KEY (`userID`,`reviewerUserID`,`reviewerGroupID`)
) ;
ALTER TABLE `tblGroupMembers` ADD `manager` smallint(1) NOT NULL default '0' ;
--
-- Table structure for mandatory approvers
--
CREATE TABLE `tblMandatoryApprovers` (
`userID` int(11) NOT NULL default '0',
`approverUserID` int(11) NOT NULL default '0',
`approverGroupID` int(11) NOT NULL default '0',
PRIMARY KEY (`userID`,`approverUserID`,`approverGroupID`)
) ;
--
-- Table structure for mandatory reviewers
--
CREATE TABLE `tblMandatoryReviewers` (
`userID` int(11) NOT NULL default '0',
`reviewerUserID` int(11) NOT NULL default '0',
`reviewerGroupID` int(11) NOT NULL default '0',
PRIMARY KEY (`userID`,`reviewerUserID`,`reviewerGroupID`)
) Engine=MyISAM ;
--
-- Table structure for mandatory approvers
--
CREATE TABLE `tblMandatoryApprovers` (
`userID` int(11) NOT NULL default '0',
`approverUserID` int(11) NOT NULL default '0',
`approverGroupID` int(11) NOT NULL default '0',
PRIMARY KEY (`userID`,`approverUserID`,`approverGroupID`)
) Engine=MyISAM ;

View File

@ -1,39 +1,39 @@
<?php
// MyDMS. Document Management System
// Copyright (C) 2002-2005 Markus Westphal
// Copyright (C) 2006-2008 Malcolm Cowe
<?php
// MyDMS. Document Management System
// Copyright (C) 2002-2005 Markus Westphal
// Copyright (C) 2006-2008 Malcolm Cowe
// Copyright (C) 2010 Matteo Lucarelli
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// 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");
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// 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");
print "<html></body>";
if (!$user->isAdmin()) {
print "<b>ERROR: You must be administrator to execute the update</b>";
die;
die;
}
function update_db()
@ -52,22 +52,20 @@ function update_db()
if (!$db->getResult($queryStr)) return false;
return true;
}
}
print "<b>Updating ...please wait</b><br>";
print "<pre>";
print "<pre>";
if (!update_db()) {
print "</pre>";
print "<b>ERROR: An error occurred during the DB update</b>";
print "<br><b>Please try to execute the update.sql manually</b>";
die;
}else print "</pre><b>Update done</b><br>";
print "</body></html>";
?>
print "</body></html>";

View File

@ -20,9 +20,7 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
function check($doupdate=0) { /* {{{ */
global $db, $settings;
function check($db, $doupdate=0) { /* {{{ */
$arr = array();
$arr['tblDocuments'] = array('key'=>'id', 'fields'=>array('name', 'comment', 'keywords'));
$arr['tblDocumentFiles'] = array('key'=>'id', 'fields'=>array('name', 'comment', 'mimeType'));
@ -91,7 +89,7 @@ else
$doupdate = 0;
$doupdate = 1;
if (!check($doupdate)) {
if (!check($db, $doupdate)) {
print "<p>Update failed</p>";
}