Prevent upgrade over-writing your customizations

From PhpCOIN Documentation

Jump to: navigation, search

Contents

The Issue

Every time phpCOIN issues an update or a fix-file, it will over-write your customized strings, configuration settings, and user-supplied custom functions. There is an easy solution to this, however ~ override files.


Config

It is annoying to have to edit config.php to re-enter your database username and password everytime you upgrade phpCOIN. So a simple solution exists.

Create a file called config_override.php and in it put only those items that you normally change, such as your database info (and your authenticated SMTP settings if you do not use the defaults), and place the file in the /coin_overrides folder.

<?php
# Database Configuration Array
	$_DBCFG['dbms'] 		= "mysql";	// Database System (type)
	$_DBCFG['dbhost'] 		= "localhost";	// Database Host
	$_DBCFG['dbuname'] 		= "username";	// User
	$_DBCFG['dbpass'] 		= "password";	// Password
	$_DBCFG['dbname'] 		= "database";	// Database Name
	$_DBCFG['table_prefix'] 	= "phpcoin_";	// Database table prefix
?>

From now on, when phpCOIN runs it will load it's usual files, then load your override files to override specific config settings. This also means that future upgrades of phpCOIN would not hurt your customizations ~ customize with an over-ride file once, and forget about it forever.


Cron_Config

This same principle applies to the /coin_cron/cron_config.php file.

Create a file called cron_config_override.php and in it put only the value for your $_COINURL setting, and place the file in the /coin_overrides folder.

From now on, when phpCOIN runs it will load it's usual files, then load your override files to override specific cron config settings. This also means that future upgrades of phpCOIN would not hurt your customizations ~ customize with an over-ride file once, and forget about it forever.


Language Strings

Most people do not change all the strings in phpCOIN. Usually they change less than a half dozen strings in only one or two files. An obvious example is the
$_CCFG['SITE_FOOTER_EMAIL_WEBMASTER']
in lang_config.php

To use a language override file, create a php file with the same name as the original but with _override appended to the name and save it in the /coin_overrides/lang_xxxxx folder, where xxxxx is the name of the language such as english, french, etc. This new file should contain only those strings that you normally change. For example, the override file for lang_config.php in English would be /coin_overrides/lang_english/lang_config_override.php and it's contents would be

<?php
$_CCFG['SITE_FOOTER_EMAIL_WEBMASTER'] = 'Email 
 <a href="mailto:webmaster@MYDOMAIN.com">webmaster@MYDOMAIN.com</a> with questions or 
 comments about this site';
?>

If you do not normally change any other strings within lang_config.php, then the override file would have only the single string.

Repeat as necessary for any other language files and strings. From now on, when phpCOIN runs it will load it's usual files and strings, then load your override files to override specific strings. This also means that future upgrades of phpCOIN would not hurt your customizations ~ customize with an over-ride file once, and forget about it forever.


Constants

Although the /coin_includes/constants.php file would rarely if ever be edited, as of v1.6.0, this same principle applies. Create a file called constants_override.php and in it put only those items that you normally change, such as another database table name or a sub-group for admin parameters, and place the file in the /coin_overrides folder.

<?php
# WHM Specific Database Configurations
	$_DBCFG['whm_versions']		= $_DBCFG['table_prefix'].'whm_versions';

# WHM Specific Parameter sub-group
	$_CCFG['_PARM_GROUP_SUB'][]	= 'WHM';
?>

From now on, when phpCOIN runs it will load it's usual files, then load your override files to override specific constants. This also means that future upgrades of phpCOIN would not hurt your customizations ~ customize with an over-ride file once, and forget about it forever.


User-Supplied Custom Functions

phpCOIN supplies a file called /coin_includes/custom.php and the intent was to add any user-supplied custom functions that you want to be globally available to phpCOIN. But again, upgrade overwrites your functions. So the same solution applies to user-supplied functions as to the other settings.

Create a file called custom_override.php and in it put those functions that you created yourself, and place the file in the /coin_overrides folder.

From now on, when phpCOIN runs it will load it's usual files, then load your override files to have your custom functions available globally. This also means that future upgrades of phpCOIN would not hurt your customizations ~ customize with an over-ride file once, and forget about it forever.

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: support@phpcoin.com