<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Latest posts for the topic "OLAT 5.2.3->6.0.0升級筆記"]]></title>
		<link>https://forum.andowson.com/posts/list/14.page</link>
		<description><![CDATA[Latest messages posted in the topic "OLAT 5.2.3->6.0.0升級筆記"]]></description>
		<generator>JForum - http://www.jforum.net</generator>
			<item>
				<title>OLAT 5.2.3-&gt;6.0.0升級筆記</title>
				<description><![CDATA[ 這個週末花了兩天終於把現有的OLAT由5.2.3升級至6.0.0, 步驟如下: 
<br>
[code] 
<br>
cd ~/download 
<br>
mv olat3 olat-5.2.3 
<br>
wget http://www.olat.org/downloads/stable/OLAT-6.0.0.zip 
<br>
unzip OLAT-6.0.0.zip 
<br>
mv OLAT-6.0.0-PUBLIC-* olat3 
<br>
cd olat3 
<br>
sed -e "s/\/usr\/local\/opt\/olat\/olat3/\/home\/andowson\/download\/olat3/g" \ 
<br>
-e "s/\/usr\/local\/opt\/olat\/olatdata/\/home\/andowson\/www\/data\/olatdata/g" \ 
<br>
-e "1,$$s/myolat/andowson/g" \ 
<br>
-e "s/smtp.host=smtp.andowson.com/smtp.host=mail.andowson.com/" \ 
<br>
-e "s/\/usr\/local\/opt\/tomcat/\/var\/tomcat5/g" \ 
<br>
-e "1,$$s/net.sf.hibernate/org.hibernate/g" \ 
<br>
-e "48c\server.modjk.enabled=true" \ 
<br>
-e "95,117d" \ 
<br>
-e "1,$$s/#db/db/g" \ 
<br>
-e "s/instantMessaging.enable=false/instantMessaging.enable=true/" \ 
<br>
-e "s/instantMessaging.server.name=jabber.andowson.com/instantMessaging.server.name=www.andowson.com/" \ 
<br>
-e "s/instantMessaging.generateTestUsers=false/instantMessaging.generateTestUsers=true/" \ 
<br>
-e "s/instantMessaging.db.name=wildfire/instantMessaging.db.name=openfire/" \ 
<br>
-e "s/instantMessaging.db.user=wildfire/instantMessaging.db.user=olat/" \ 
<br>
-e "s/instantMessaging.db.pass=wildfire/instantMessaging.db.pass=olat/" build.properties.default &gt; build.properties 
<br>
ant install 
<br>
ant jsmath 
<br>
sudo /etc/init.d/tomcat stop 
<br>
mv ~/www/olat /tmp/olat-5.2.3 
<br>
cp -rf ~/download/olat3/webapp ~/www/olat 
<br>
cp -rf ~/download/olat3/htdocs/* ~/www/olat 
<br>
sed -i -e "13c\ &lt;\!-- default session timeout --&gt;" ~/www/olat/WEB-INF/web.xml 
<br>
rm -rf ~/www/olat/WEB-INF/src 
<br>
rm -rf ~/www/olat/WEB-INF/patchesSrc 
<br>
rm -rf ~/www/olat/WEB-INF/test 
<br>
cp /tmp/olat-5.2.3/WEB-INF/classes/hibernate.properties ~/www/olat/WEB-INF/classes/. 
<br>
chgrp -R tomcat ~/www/olat 
<br>
chgrp -R tomcat ~/www/data/olatdata 
<br>
chmod 775 ~/www/olat/static 
<br>
sudo -u postgres pg_dump olat &gt; /tmp/olat.bak 
<br>
sudo psql -U olat olat -f /home/andowson/download/olat3/database/postgresql/alter_5_2_x_to_6_0_0.sql 
<br>
sudo /etc/init.d/tomcat start 
<br>
[/code] 
<br>
要注意的地方是原始碼內附的PostgreSQL升級SQL script有問題，字串應該用單引號來括起來，而不是用雙引號，另外有些欄位名稱也不對，必須調整後才能正常執行。好在我有先執行資料庫備份，再執行那條upgrade的SQL，不然這個SQL script只能執行一次，並且會把o_user裡面的一些欄位drop掉（這樣子你連執行第二次的機會都沒有了）。所以記住：要做任何系統升級之前，備份！備份！備份！ 
<br>
以下是我修改後的alter_5_2_x_to_6_0_0.sql: 
<br>
[code=sql] 
<br>
-- 
<br>
-- new talbe to store the users properties 
<br>
create table o_userproperty ( 
<br>
 fk_user_id int8 not null, 
<br>
 propname varchar(255) not null, 
<br>
 propvalue varchar(255), 
<br>
 primary key (fk_user_id, propname) 
<br>
); 
<br>
create index propvalue_idx on o_userproperty (propvalue); 
<br>
alter table o_userproperty add constraint FK4B04D83FD1A80C95 foreign key (fk_user_id) references o_user; 
<br>
<br>
-- 
<br>
-- migrate data from old user table to new userproperty table 
<br>
-- make sure you get this right the first time, you can not run this twice! 
<br>
insert into o_userproperty (fk_user_id, propname, propvalue) select user_id, 'firstName', firstname from o_user where firstname IS NOT NULL AND firstname!=''; 
<br>
alter table o_user drop firstname; 
<br>
<br>
insert into o_userproperty (fk_user_id, propname, propvalue) select user_id, 'lastName', lastname from o_user where lastname IS NOT NULL AND lastname!=''; 
<br>
alter table o_user drop lastname; 
<br>
<br>
insert into o_userproperty (fk_user_id, propname, propvalue) select user_id, 'email', email from o_user where email IS NOT NULL AND email!=''; 
<br>
alter table o_user drop email; 
<br>
<br>
insert into o_userproperty (fk_user_id, propname, propvalue) select user_id, 'birthDay', birthday from o_user where birthday IS NOT NULL; 
<br>
alter table o_user drop birthday; 
<br>
<br>
insert into o_userproperty (fk_user_id, propname, propvalue) select user_id, 'gender', gender from o_user where gender IS NOT NULL AND gender!=''; 
<br>
alter table o_user drop gender; 
<br>
<br>
insert into o_userproperty (fk_user_id, propname, propvalue) select user_id, 'telMobile', telmobile from o_user where telmobile IS NOT NULL AND telmobile!=''; 
<br>
alter table o_user drop telmobile; 
<br>
<br>
insert into o_userproperty (fk_user_id, propname, propvalue) select user_id, 'telOffice', teloffice from o_user where teloffice IS NOT NULL AND teloffice!=''; 
<br>
alter table o_user drop teloffice; 
<br>
<br>
insert into o_userproperty (fk_user_id, propname, propvalue) select user_id, 'telPrivate', telprivate from o_user where telprivate IS NOT NULL AND telprivate!=''; 
<br>
alter table o_user drop telprivate; 
<br>
<br>
insert into o_userproperty (fk_user_id, propname, propvalue) select user_id, 'institutionalUserIdentifier', institutionaluseridentifier from o_user where institutionaluseridentifier IS NOT NULL AND institutionaluseridentifier!=''; 
<br>
alter table o_user drop institutionaluseridentifier; 
<br>
<br>
insert into o_userproperty (fk_user_id, propname, propvalue) select user_id, 'institutionalName', institutionalname from o_user where institutionalname IS NOT NULL AND institutionalname!=''; 
<br>
alter table o_user drop institutionalname; 
<br>
<br>
insert into o_userproperty (fk_user_id, propname, propvalue) select user_id, 'institutionalEmail', institutionalemail from o_user where institutionalemail IS NOT NULL AND institutionalemail!=''; 
<br>
alter table o_user drop institutionalemail; 
<br>
<br>
insert into o_userproperty (fk_user_id, propname, propvalue) select user_id, 'street', street from o_user where street IS NOT NULL AND street!=''; 
<br>
alter table o_user drop street; 
<br>
<br>
insert into o_userproperty (fk_user_id, propname, propvalue) select user_id, 'extendedAddress', extendedaddress from o_user where extendedaddress IS NOT NULL AND extendedaddress!=''; 
<br>
alter table o_user drop extendedaddress; 
<br>
<br>
insert into o_userproperty (fk_user_id, propname, propvalue) select user_id, 'poBox', pobox from o_user where pobox IS NOT NULL AND pobox!=''; 
<br>
alter table o_user drop pobox; 
<br>
<br>
insert into o_userproperty (fk_user_id, propname, propvalue) select user_id, 'zipCode', zipcode from o_user where zipcode IS NOT NULL AND zipcode!=''; 
<br>
alter table o_user drop zipcode; 
<br>
<br>
insert into o_userproperty (fk_user_id, propname, propvalue) select user_id, 'region', region from o_user where region IS NOT NULL AND region!=''; 
<br>
alter table o_user drop region; 
<br>
<br>
insert into o_userproperty (fk_user_id, propname, propvalue) select user_id, 'city', city from o_user where city IS NOT NULL AND city!=''; 
<br>
alter table o_user drop city; 
<br>
<br>
insert into o_userproperty (fk_user_id, propname, propvalue) select user_id, 'country', country from o_user where country IS NOT NULL AND country!=''; 
<br>
alter table o_user drop country; 
<br>
-- 
<br>
-- end user properties migration 
<br>
<br>
-- new table to store the read messages, migrate the read messages from the o_property to the new table 
<br>
create table o_readmessage ( 
<br>
 id int8 not null, 
<br>
 lastmodified timestamp not null, 
<br>
 creationdate timestamp, 
<br>
 identity_id int8 not null, 
<br>
 forum_id int8 not null, 
<br>
 message_id int8 not null, 
<br>
 primary key (id)); 
<br>
create index identity_forum_idx on o_readmessage(identity_id, forum_id); 
<br>
<br>
insert into o_readmessage (id, lastmodified, creationdate, identity_id, forum_id, message_id) select id, lastmodified, creationdate, identity, resourcetypeid, longvalue from o_property where category='rvst'; 
<br>
delete from o_property where category='rvst'; 
<br>
<br>
-- end read messages 
<br>
<br>
-- update fontsize to new relative style 
<br>
update o_user set fontsize = '110' where fontsize = 'large'; 
<br>
update o_user set fontsize = '100' where fontsize = 'normal'; 
<br>
update o_user set fontsize = '90' where fontsize = 'small'; 
<br>
-- end fontsize update 
<br>
[/code]]]></description>
				<guid isPermaLink="true">https://forum.andowson.com/posts/preList/267/441.page</guid>
				<link>https://forum.andowson.com/posts/preList/267/441.page</link>
				<pubDate><![CDATA[Mon, 25 Aug 2008 00:23:59]]> GMT</pubDate>
				<author><![CDATA[ andowson]]></author>
			</item>
	</channel>
</rss>