Commit 8d83e440 authored by Claes Sjofors's avatar Claes Sjofors

upgrade script, pass cnvobjects added to set DSupComp.Attribute

parent cb62541a
...@@ -285,29 +285,12 @@ reload_cnvobjects() ...@@ -285,29 +285,12 @@ reload_cnvobjects()
return return
fi fi
echo "***"
echo "*** Note! "
echo "*** This pass should only be executed of you upgrade"
echo "*** from V4.6, not if you upgrade from V4.7.0 "
echo "***"
echo -n "Do you want to execute this pass ? [y/n] " reload_continue "Pass convert objects in loaded database"
read repl
if [ "$repl" == "y" ]; then
reload_continue "Pass convert objects in loaded db"
list=`eval ls -1d $pwrp_db/*.db` for cdb in $databases; do
for file in $list; do wb_cmd -v $cdb @$pwr_exe/upgrade_pb.pwr_com
file=${file##/*/} done
file=${file%%.*}
if [ $file != "directory" ] && [ $file != "rt_eventlog" ]; then
wb_cmd -v $file @$pwr_exe/upgrade_pb.pwr_com
fi
done
fi
reload_status=$reload__success reload_status=$reload__success
} }
...@@ -586,6 +569,7 @@ usage() ...@@ -586,6 +569,7 @@ usage()
cnvdump Convert the dump files. cnvdump Convert the dump files.
loaddb Load dumpfiles. loaddb Load dumpfiles.
compile Compile all plcprograms in the database compile Compile all plcprograms in the database
cnvobjects Convert objects in loaded database
createload Create new loadfiles. createload Create new loadfiles.
createboot Create bootfiles for all nodes in the project. createboot Create bootfiles for all nodes in the project.
...@@ -625,7 +609,7 @@ for db in $tmp; do ...@@ -625,7 +609,7 @@ for db in $tmp; do
fi fi
done done
passes="classvolumes renamedb cnvdump loaddb compile createload createboot" passes="classvolumes renamedb cnvdump loaddb cnvobjects compile createload createboot"
#echo "Pass: $passes" #echo "Pass: $passes"
echo "" echo ""
echo -n "Enter start pass [classvolumes] > " echo -n "Enter start pass [classvolumes] > "
......
!** Invisible: Script for converting OpPlace and WebHandler objects during upgrading from v4.6 to v4.7.0 !** Invisible: Script for moving DSup to DSupComp objects during upgrading from V5.0 to V5.1.0
! !
# Proview Open Source Process Control. # Proview Open Source Process Control.
# Copyright (C) 2005-2014 SSAB EMEA AB. # Copyright (C) 2005-2014 SSAB EMEA AB.
# #
# This file is part of Proview. # This file is part of Proview.
! #
! This program is free software; you can redistribute it and/or # This program is free software; you can redistribute it and/or
! modify it under the terms of the GNU General Public License as # modify it under the terms of the GNU General Public License as
! published by the Free Software Foundation, either version 2 of # published by the Free Software Foundation, either version 2 of
! the License, or (at your option) any later version. # the License, or (at your option) any later version.
! #
! This program is distributed in the hope that it will be useful # This program is distributed in the hope that it will be useful
! but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! GNU General Public License for more details. # GNU General Public License for more details.
! #
! You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Proview. If not, see <http://www.gnu.org/licenses/> # along with Proview. If not, see <http://www.gnu.org/licenses/>
# #
# Linking Proview statically or dynamically with other modules is # Linking Proview statically or dynamically with other modules is
...@@ -35,204 +35,72 @@ ...@@ -35,204 +35,72 @@
# General Public License plus this exception. # General Public License plus this exception.
! !
! !
! Script for converting OpPlace and WebHandler objects during upgrading from V4.6 to V4.7.0, ! Script for set Attribute in DSupComp objects during upgrading from V5.0 to V5.1.0,
! and to remove User and RttConfig objects.
! !
! Find all OpPlace objects and move UserName, FastAvail and SelectList from the user object ! Find all DSupComp objects and set Attribute to parent attribute.
! to the opplace object.
! Replace RttConfig with an OpPlace object named OpDefault.
! Move SelectList from user object to WebHandler object.
! !
main main()
string op; string name;
string user; string oname;
string aname; string aname;
string attr;
int idx;
int idx0 = 0;
int sts; int sts;
int opnumber; int len;
int usernumber;
int found;
string value;
int ivalue;
int i;
string rttconfig;
string webhandler;
string c;
!verify(1); name = GetClassListAttrRef("DSupComp");
op = GetNodeObject(); while ( name != "")
op = op + "-OpDefault";
c = GetObjectClass( op);
if ( c != "")
printf( "Database is already converted\n");
exit();
endif
! For all OpPlace objects idx = strrchr( name, ".");
op = GetClassList( "OpPlace"); idx -= 1;
while ( op != "") oname = extract( 1, idx, name);
aname = op + ".OpNumber"; len = strlen( oname);
opnumber = GetAttribute( aname, sts); idx = len - 7;
if ( !sts) if ( len > 0)
op = GetNextObject( op); attr = extract( idx, len, oname);
continue; if ( attr == ".LimitHH")
endif idx -= 1;
oname = extract( 1, idx, oname);
found = 0; endif
user = GetClassList( "User"); if ( attr == ".LimitLL")
while ( user != "") idx -= 1;
aname = user + ".OpNumber"; oname = extract( 1, idx, oname);
usernumber = GetAttribute( aname, sts);
if ( usernumber == opnumber)
found = 1;
break;
endif endif
user = GetNextObject( user);
endwhile
if ( !found)
printf( "No corresponding User object for %s\n", op);
op = GetNextObject( op);
continue;
endif endif
printf( "Processing %s\n", op);
aname = user + ".UserName"; len = strlen( oname);
value = GetAttribute( aname, sts); idx = len - 6;
aname = op + ".UserName"; if ( len > 0)
SetAttribute( aname, value); attr = extract( idx, len, oname);
for ( i = 0; i < 15; i++) if ( attr == ".LimitH")
aname = user + ".FastAvail[" + i + "]"; idx -= 1;
value = GetAttribute( aname, sts); oname = extract( 1, idx, oname);
if ( value != "" && value != "Undefined attribute")
aname = op + ".FastAvail[" + i + "]";
SetAttribute( aname, value);
endif endif
endfor if ( attr == ".LimitL")
idx -= 1;
for ( i = 0; i < 20; i++) oname = extract( 1, idx, oname);
aname = user + ".SelectList[" + i + "]";
value = GetAttribute( aname, sts);
if ( value != "")
aname = op + ".EventSelectList[" + i + "]";
SetAttribute( aname, value);
endif endif
endfor
aname = user + ".MaxNoOfAlarms";
ivalue = GetAttribute( aname, sts);
aname = op + ".MaxNoOfAlarms";
SetAttribute( aname, ivalue);
aname = user + ".MaxNoOfEvents";
ivalue = GetAttribute( aname, sts);
aname = op + ".MaxNoOfEvents";
SetAttribute( aname, ivalue);
ivalue = 3;
aname = op + ".OpWindPop";
SetAttribute( aname, ivalue);
ivalue = 14;
aname = op + ".OpWindLayout";
SetAttribute( aname, ivalue);
ivalue = 1;
aname = op + ".AlarmBell";
SetAttribute( aname, ivalue);
delete object/name='user'/noconf
op = GetNextObject( op);
endwhile
! Create OpDefault
op = GetNodeObject();
create object/name="OpDefault"/class=opplace/dest='op'/last
op = op + "-OpDefault";
ivalue = 1;
aname = op + ".OpWindLayout";
SetAttribute( aname, ivalue);
! For the RttConfig object
rttconfig = GetClassList( "RttConfig");
if ( rttconfig != "")
aname = rttconfig + ".UserObject";
user = GetAttribute( aname, sts);
if ( user != "" && user != "Undefined attribute")
printf( "Processing %s\n", op);
aname = rttconfig + ".SymbolFileName";
value = GetAttribute( aname, sts);
aname = op + ".SetupScript";
SetAttribute( aname, value);
for ( i = 0; i < 20; i++)
aname = user + ".SelectList[" + i + "]";
value = GetAttribute( aname, sts);
if ( value != "")
aname = op + ".EventSelectList[" + i + "]";
SetAttribute( aname, value);
endif
endfor
aname = user + ".MaxNoOfAlarms";
ivalue = GetAttribute( aname, sts);
aname = op + ".MaxNoOfAlarms";
SetAttribute( aname, ivalue);
aname = user + ".MaxNoOfEvents";
ivalue = GetAttribute( aname, sts);
aname = op + ".MaxNoOfEvents";
SetAttribute( aname, ivalue);
delete object/name='user'/noconf
delete object/name='rttconfig'/noconf
endif endif
endif aname = name + ".Attribute";
if ( oname == "")
printf( "** Not set %s\n", aname);
! For the WebHandler object else
webhandler = GetClassList( "WebHandler"); sts = SetAttribute( aname, oname);
if ( webhandler != "") if ( !(sts & 1))
printf( "** Unable to set %s sts %d\n", aname, sts);
aname = webhandler + ".UserObject"; else
user = GetAttribute( aname, sts); printf( "-- Set %s = %s\n", aname, oname);
if ( user != "" && user != "Undefined attribute") endif
printf( "Processing %s\n", webhandler);
for ( i = 0; i < 20; i++)
aname = user + ".SelectList[" + i + "]";
value = GetAttribute( aname, sts);
if ( value != "")
aname = webhandler + ".EventSelectList[" + i + "]";
SetAttribute( aname, value);
endif
endfor
aname = user + ".MaxNoOfAlarms";
ivalue = GetAttribute( aname, sts);
aname = webhandler + ".MaxNoOfAlarms";
SetAttribute( aname, ivalue);
aname = user + ".MaxNoOfEvents";
ivalue = GetAttribute( aname, sts);
aname = webhandler + ".MaxNoOfEvents";
SetAttribute( aname, ivalue);
delete object/name='user'/noconf
endif endif
endif
name = GetNextAttrRef("DSupComp", name);
endwhile
save save
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment