|
jforum example source code file (1.txt)
This example jforum source code file (1.txt) is included in the DevDaily.com
"Java Source Code
Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.
The jforum 1.txt source code
%%commentbox
If you are willing to upgrade from version 2.1.5 to 2.1.6, please read [Patching 2.1.5 to 2.1.6]
%%
Upgrading from JForum version _2.1.4_ to version _2.1.6_ is very simple.
First, make a backup of the database and the current directory where JForum is installed. Backup everything (templates, images etc). The suggested approach to use is to unpack JForum 2.1.6 into some directory, made the changes there and then, when all is finished, copy it over the directory where the previous vesrion is located.
You'll like to take special care for _SystemGlobals.properties_ and _jforum-custom.conf_, as these are the main configuration files.
h4. Merging _SystemGlobals.properties_
Most changes were made to the database structure and main board configuration files. _SystemGlobals.properties_ has changed a lot - most of the changes were made to organize the file.
You can use a diff tool, like [WinMerge|http://winmerge.sf.net] to check the differences. Special care is necessary for the following keys:
||Key name||
|forum.link|
|homepage.link|
|forum.name|
|forum.page.title|
|user.hash.sequence|
|encoding|
|database.driver.name|
|database.connection.implementation|
|i18n.board.default|
|mail.sender|
|mail.smtp.auth|
|mail.smtp.host|
|mail.smtp.port|
|mail.smtp.username|
|mail.smtp.password|
h4. Merging Database settings
Open the file _WEB-INF/config/<DBNAME>/.properties_ and check the username, password and host to connect.
{info:title=MySQL 4.1+}
If you're going to use MySQL 4.1 or more recent, please set the value of the keys _mysql.encoding_ and _mysql.unicode_ to empty, as shown below:
{code}
mysql.unicode=
mysql.encoding=
{code}
{info}
Also for MySQL 4.1+ users: Open _WEB-INF/config/database/mysql/mysql.sql_ and *remove all data* from the file - yes, *the file should be empty*.
h4. Checking _jforum-custom.conf_
Now, open _WEB-INF/config/jforum-custom.conf and make sure that the configuration options values are as expected. It may sound like an unnecessary step, since your forum is working already, but even that, just to be sure that none of the keys you changes in SystemGlobals.properties are being overwritten by this file.
h4. Upgrading the database
Now, import the SQL file named "<DBNAME>_2.1.4_to_2.1.6.sql" (like _mysql_2.1.4_to_2.1.6.sql_) into your database. This script will convert the tables and create the new ones.
*Optional step*: If you're going to keep your current _<DBNAME>.properties_, you'll have to change the value of the key _dao.driver_, according to the following table:
||Database||Old value||New value||
|MySQL|net.jforum.drivers.mysql.DataAccessDriver|net.jforum.dao.mysql.MysqlDataAccessDriver|
|HSQLDB|net.jforum.drivers.hsqldb.DataAccessDriver|net.jforum.dao.hsqldb.HsqldbDataAccessDriver|
|PostgreSQL|net.jforum.drivers.postgresql.DataAccessDriver|net.jforum.dao.postgresql.PostgresqlDataAccessDriver|
Also, please ensure that your _jforum-custom.conf_ - if you are going to keep the old one - has the updated value as well.
h4. About permissions
You'll have to re-save the permissions from all groups again. The step is simple: just to _Admin Panel -> Groups -> Permissions_, check the options and then click _Save_.
Starting from version 2.1.6, it is only possible to set permissions for _Groups_. User Permissions were removed because they were confusing and hard to maintain.
h4. Removing installation files
Now, do this:
- Rename the file ___index.redirect_ to _index.htm_ (you can remove the existing _index.htm_)
- Open _SystemGlobals.properties_ and add the following line:
{code}
installed = true
{code}
Open _WEB-INF/config/modulesMapping.properties_ and remove from it the following line:
{code}
install = net.jforum.view.install.InstallAction
{code}
h4. Testing
Now, if possible, test JForum 2.1.6 before copying it over 2.1.4. The easier way is to put it under some another _Context_. If the system starts without problems, then you can proceed to the final step.
As mentioned in the previous section, you may experience some issues with access rights. If the user you use in JForum 2.1.4 for the administrative tasks does not have access to the _Admin Panel_, please do this:
* Find the user id of your user by executing the query
{code:sql}
SELECT user_id FROM jforum_users WHERE username = 'YOUR USERNAME HERE';
{code}
* Go to your database console (or any administration tool use may use) and run the following SQL query:
{code:sql}
INSERT INTO jforum_roles (name, user_id, role_type) VALUES ('perm_administration', YOUR_USER_ID, 1);
{code}
Other jforum examples (source code examples)
Here is a short list of links related to this jforum 1.txt source code file:
|