UPGRADING FROM: PhpDig v.1.8.7 OR PhpDig v.1.8.8
UPGRADING TO: PhpDig v.1.8.8 RC1 OR PhpDig v.1.8.9 RC1

ADDITIONAL REQUIREMENTS ====================================================================

- MySQL 4.1.7+ with UTF-8 and ability for SET queries
- PHP 4.3.10+ with mbstring, mbstr-enc-trans, mbregex
- Apache with Linux 2.4.26+ and htaccess file ability
- Understanding of iconv to convert files and tables

LANGUAGE FILES =============================================================================

You may need a UTF-8 acceptable editor to edit the /locales/XX-language.php files.

You can use a TEXT editor to edit the /locales/ascii/XX-language.php files.

If you edit the files in the ascii directory, you will need to convert to UTF-8.

For example:

	shell> iconv -f windows-1251 -t utf-8 -o ru-language.phpx ru-language.php &
	shell> iconv -f iso-8859-2 -t utf-8 -o cs-language.phpx cs-language.php &

The UTF-8 encoded files would then end with phpx so you need to move/rename them.

In general:

	shell> iconv -f <from_encoding> -t <to_encoding> [-o <output_file>] <input_file>

The /locales/XX-language.php files are already in UTF-8 format.

The /locales/ascii/XX-language.php files are in ASCII format.

If a UTF-8 file is in incorrect format, simply run iconv on the ASCII version.

FTP the /locales/XX-language.php files in BINARY format.

FTP the /locales/ascii/XX-language.php files in ASCII format.

TEXT_CONTENT FILES =========================================================================

You may need a UTF-8 acceptable editor to convert the /text_content/XXX.txt files.

Otherwise, you can use iconv to convert the /text_content/XXX.txt files to UTF-8.

For example:

	shell> iconv -f windows-1251 -t utf-8 -o XXX.txtx XXX.txt &
	shell> iconv -f iso-8859-2 -t utf-8 -o XXX.txtx XXX.txt &

The UTF-8 encoded files would then end with txtx so you need to move/rename them.

In general:

	shell> iconv -f <from_encoding> -t <to_encoding> [-o <output_file>] <input_file>

The /text_content/XXX.txt files are not in UTF-8 format so you need to convert them.

MYSQL DATABASE TABLES ======================================================================

# Update from the 1.8.7 version
# Add the table prefix if needed
# ---------------------------------

## first backup your current phpdig tables
## capitalizations represent your database information
## http://dev.mysql.com/doc/mysql/en/mysqldump.html
# shell> mysqldump -h LOCALHOST -u DBUSER -p --opt DBNAME clicks engine excludes includes keywords logs site_page sites spider tempspider > phpdig187backup.sql

## http://dev.mysql.com/doc/mysql/en/myisamchk-syntax.html
# if you change the character set when running mysql, that may also change the sort order, 
# so you may need to run myisamchk -r -q --set-character-set=utf8 on the tables, or your 
# indexes might not be ordered correctly. also, utf-8 can take more space than other 
# encodings, so you may need to edit my.cnf and increase the max_allowed_packet size, and 
# then restart mysql.

## find your mysql character set (iso-8859-1 aka latin1 is default)
# SHOW VARIABLES LIKE '%character%';

## run the following alter queries
## http://dev.mysql.com/doc/mysql/en/create-table.html
## http://dev.mysql.com/doc/mysql/en/alter-table.html
ALTER TABLE clicks ENGINE=MyISAM DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE engine ENGINE=MyISAM DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE excludes ENGINE=MyISAM DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE includes ENGINE=MyISAM DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE keywords ENGINE=MyISAM DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE logs ENGINE=MyISAM DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE site_page ENGINE=MyISAM DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE sites ENGINE=MyISAM DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE spider ENGINE=MyISAM DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE tempspider ENGINE=MyISAM DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;

## make another backup of your phpdig tables for use in conversion to utf-8
## capitalizations represent your database information
## http://dev.mysql.com/doc/mysql/en/mysqldump.html
# shell> mysqldump -h LOCALHOST -u DBUSER -p --opt DBNAME clicks engine excludes includes keywords logs site_page sites spider tempspider > phpdigdump.sql

## convert the phpdig tables to utf-8
## change iso-8859-1 to your mysql character set
# shell> iconv -f iso-8859-1 -t utf8 phpdigdump.sql > phpdigutf8.sql

## overwrite the old tables with the new converted tables
## capitalizations represent your database information
## http://dev.mysql.com/doc/mysql/en/mysql.html
# shell> mysql -h LOCALHOST -u DBUSER -p DBNAME < phpdigutf8.sql

## some extra mysql stuff
# shows status of tables
# SHOW TABLE STATUS;
# shows available character sets
# SHOW CHARACTER SET;
# shows utf collations
# SHOW COLLATION LIKE 'utf%';
# show collations and charsets
# SHOW COLLATION;

HTACCESS FILE ==============================================================================

There is a .htaccess file included in PhpDig v.1.8.8 RC1 that is to be placed in the same 
directory as the search.php file. If you already have a .htaccess file in this directory, 
then add the following content to the .htaccess file.

PHP_VALUE default_charset UTF-8
PHP_VALUE mbstring.func_overload 0
PHP_VALUE mbstring.encoding_translation On

CONFIG AND CONNECT FILES ===================================================================

The config.php and connect.php files have changed, so you need to reconfigure them.

OTHER FILES ================================================================================

Many of these files have changed as well, so FTP all the files (except graphics) and 
overwrite the old files with the new files.

FINAL NOTE =================================================================================

There can be give and take: functionality for speed. ;)
