How to Upgrade phpCOIN

From PhpCOIN Documentation

Jump to: navigation, search


Basic Upgrade Procedure

If you have an older version of phpCOIN running you can easily upgrade to the latest version at any time in one-shot, without having to upgrade to each intermediate version. To upgrade phpCOIN, follow these steps:

  • Download phpCOIN to your desktop and unzip it, making sure to maintain the directory structure contained within the .zip file.
  • Open "config.php" in your favourite text editor. Edit the settings for the database name, username and password using the information from the existing "config.php" file. Make sure that your editor does not save an extra line feed at the end of the file (make sure nothing comes after the final ?>; in the file). Many times an editor adds an extra line-feed to the file end and this will cause issues with php. Beginning with phpCOIN v1.2.6 you can skip this step if you use an over-ride file.
  • If you are calling your cron jobs by php, you will have to edit the setting for the $_COINURL entry in the /coin_cron/cron_config.php file. Beginning with phpCOIN v1.4.1 you can skip this step if you use an over-ride file.
  • Upload ALL the files to your website, making sure to maintain the directory structure. Upload images and fonts in binary mode, and all other files in ascii mode. The files should all over-write existing files.
  • Open your favourite web-browser and browse to your website (or to the subdirectory on your website, depending on where you installed phpCOIN). phpCOIN will realize that it is being upgraded, and automatically redirect you to the upgrade procedure page.
  • Follow the prompts on-screen, and voila! phpCOIN is ready to use once again.

Note For Fantastico Users

When you installed phpCOIN through Fantastico, you did not manually edit config.php to enter the database username and password. Fantastico did this for you "behind the scenes", and did not tell you what the password was. Before you replace the files on the web-server, open config.php to see what Fantastico entered for the username and password. You will need to enter this information into the new config.php file (unless you use an over-ride file), and you will be asked for this password during the database upgrade process.

Security Note

Since the setup files are no longer needed, a prudent precaution would be to delete the /coin_setup folder and all contents.


IF YOU HAVE JUST UPGRADED PHPCOIN AND YOU FORCE SETUP.PHP TO RUN A SECOND TIME, IT WILL DELETE YOUR DATABASE AND OVERWRITE IT WITH A FRESH EMPTY DEFAULT DATABASE. phpCOIN will warn you that the database will be overwritten, but will also allow you to proceed. phpCOIN does this so that if you mess-up big-time during the configuration phase, you can always re-start with a fresh database.

Notes When upgrading from phpCOIN v1.3.1 or Older

phpCOIN v1.4.0 re-organized its paths information and it's database access to improve page rendering speed, so third-party themes or modules written for phpCOIN v1.3.1 and lower may not work with phpCOIN v1.4.0 and higher.

The config.php file has a switch $_CCFG['ENABLE_COMPATIBILITY_MODE'] that if set to 1 tells phpCOIN to include a special file so the functions and variables that were removed in phpCOIN v1.4.0 will be available for the older theme or add-on module. This is intended only as a stop-gap measure however, because using this switch will negate the speed improvements. Our recommendation is to modify the theme or module so the $_CCFG['ENABLE_COMPATIBILITY_MODE'] switch can be left at 0, thereby retaining the speed improvements.

The major changes for programmers/designers are as follows:

Logo location changed

In phpCOIN v1.3.1 and lower, the site logo was expected to be located within the /coin_images directory. That is fine unless you change themes, in which case you may also need to goto Admin -> Parameters to also change the logo to match the new theme. Beginning with phpCOIN v1.4.0 the logo is now expected to be located within the theme's /images directory. If you have several themes, and a specific logo for each theme, name them all the same and as you switch themes phpCOIN will automatically switch logos.

The file /coin_includes/db.php was removed

In phpCOIN v1.3.1 and lower you could access the database by either calling a method of the $db_coin object, or by simply calling the method name as if it was a function. The /coin_includes/db.php file automatically called the relevant $db_coin method and returned the result. Beginning with phpCOIN v1.4.0 the /coin_includes/db.php file has been removed, so all database calls now must be by object->method. To accomplish this, simply prefix all db_xxxxx calls with $db_coin-> in your code customizations that access the database.

The functions do_addslashes() and do_stripslashes() were removed

In phpCOIN v1.3.1 and lower you could pass a string to these functions which would prepare the string for database insertion or extraction, as appropriate. Beginning with phpCOIN v1.4.0 these functions have been removed. When inserting data into the database, wrap the data within a call to $db_coin->db_sanitize_data() like this:

$query  = 'INSERT INTO '.$_DBCFG['test'];
$query .= ' (test_data, test_data2) VALUES (';
$query .= "'".$db_coin->db_sanitize_data($variable_1)."', ";
$query .= "'".$db_coin->db_sanitize_data($variable_2)."'";
$query .= ')';
$result = $db_coin->db_query_execute($query) OR DIE("Unable to complete request");

Most paths are now DEFINEs

In phpCOIN v1.3.1 and lower, the config.php file sets paths and URLs as elements of the $_CCG array, like so:

# Common Config File Array for paths
 $_CCFG['_PKG_REDIRECT_ROOT']	= $_PACKAGE['URL'];	# Site- Root used for redirect URL (must have http://)
 $_CCFG['_PKG_URL_INCL']	= $_CCFG['_PKG_URL_BASE'].'coin_includes/';
 $_CCFG['_PKG_URL_THEME']	= $_CCFG['_PKG_URL_BASE'].'coin_themes/'.$_CCFG['_HC_PKG_THEME'].'/';
 $_CCFG['_PKG_URL_THEME_IMGS']	= $_CCFG['_PKG_URL_BASE'].'coin_themes/'.$_CCFG['_HC_PKG_THEME'].'/images/';
 $_CCFG['_PKG_URL_IMGS']	= $_CCFG['_PKG_URL_BASE'].'coin_images/';
 $_CCFG['_PKG_URL_ADDONS']	= $_CCFG['_PKG_URL_BASE'].'coin_addons/';
 $_CCFG['_PKG_URL_MDLS']	= $_CCFG['_PKG_URL_BASE'].'coin_modules/';
 $_CCFG['_PKG_PATH_ADMN']	= $_CCFG['_PKG_PATH_BASE'].'coin_admin/';
 $_CCFG['_PKG_PATH_ADDONS']	= $_CCFG['_PKG_PATH_BASE'].'coin_addons/';
 $_CCFG['_PKG_PATH_AUXP']	= $_CCFG['_PKG_PATH_BASE'].'coin_auxpages/';
 $_CCFG['_PKG_PATH_DBSE']	= $_CCFG['_PKG_PATH_BASE'].'coin_database/';
 $_CCFG['_PKG_PATH_IMGS']	= $_CCFG['_PKG_PATH_BASE'].'coin_images/';
 $_CCFG['_PKG_PATH_INCL']	= $_CCFG['_PKG_PATH_BASE'].'coin_includes/';
 $_CCFG['_PKG_PATH_LANG']	= $_CCFG['_PKG_PATH_BASE'].'coin_lang/'.$_CCFG['_HC_PKG_LANG'].'/';
 $_CCFG['_PKG_PATH_MDLS']	= $_CCFG['_PKG_PATH_BASE'].'coin_modules/';
 $_CCFG['_PKG_PATH_THEME']	= $_CCFG['_PKG_PATH_BASE'].'coin_themes/'.$_CCFG['_HC_PKG_THEME'].'/';

Beginning with phpCOIN v1.4.0 all except for lang and theme are now DEFINEs. lang and theme can be set in config.php or the database, so they still need to be variables. The remainder were converted to DEFINEs as a security precaution.

define('PKG_URL_BASE', $_PACKAGE['URL']);
define('PKG_PATH_BASE', $_PACKAGE['DIR']);
define('PKG_URL_INCL', PKG_URL_BASE.'coin_includes/');
define('PKG_PATH_INCL', PKG_PATH_BASE.'coin_includes/');
define('PKG_URL_MDLS', PKG_URL_BASE.'coin_modules/');
define('PKG_PATH_MDLS', PKG_PATH_BASE.'coin_modules/');
define('PKG_URL_ADDONS', PKG_URL_BASE.'coin_addons/');
define('PKG_PATH_ADDONS', PKG_PATH_BASE.'coin_addons/');
define('PKG_PATH_ADMN', PKG_PATH_BASE.'coin_admin/');
define('PKG_PATH_AUXP', PKG_PATH_BASE.'coin_auxpages/');
define('PKG_PATH_DBSE', PKG_PATH_BASE.'coin_database/');
define('PKG_URL_IMGS', PKG_URL_BASE.'coin_images/');
define('PKG_PATH_IMGS', PKG_PATH_BASE.'coin_images/');

If your theme or module uses an old-style variable path such as


you need to change the code to use the new DEFINE instead:


Enabling WYSIWYG editing within the theme's core.php file is easier

In phpCOIN v1.3.1 and lower, each theme had to include code to determine whether or not the supported WYSIWYG editors were available, and whether or not to output the calls to include the editor.

In phpCOIN v1.4.0 and higher a theme no longer need concern itself with this. Simply check two variables and if set append the output just before the end-head tag and the end-body tag. Here is the header:

# Add WYSIWYG (if found) to output
 $_out .= '</head>'.$_nl;

And here is the footer:

# Add WYSIWYG (if found) to output
 $_out .= '</body>'.$_nl;
Personal tools

Inscrita el Registro Mercantil de Mallorca Tomo 2140, Hoja No. PM-51034, Folio 135
This website owned and operated by: Technology Services RPVW S.L. CIF# B57345084
Avda Constitucion 48 Bajos Alaro 07340 Baleares SPAIN
Tel:+34 971518362    Fax: +34 971518368    eMail: