Since version 2.4, plan settings are stored in XML format, which
allows extracting and moving them to other locations.
Migratable Plans. Migratable plans include all non-reseller plans, namely:
Unix, Windows, Admin, MySQL, E-Mail, Unix Real Server, Windows Real Media.
All end user plans, including those of master admin and resellers, are migratable.
Migration Tools. Plans are migrated with two Java classes,
PlanExtractor and PlanCreator, located in the
~cpanel/shiva/psoft/hsphere/migrator/ directory.
1) PlanExtractor is a Java utility to extract
H-Sphere plans into XML format. Extracted plans are stored in the
file.
2) PlanCreator is a tool for importing plans to a new CP from the
file with plans extracted by PlanExtractor.
Also, you'll need to place the following files in the ~cpanel/shiva/psoft/hsphere/migrator/
directory:
Plan Extractor
Run PlanExtractor as cpanel with the following syntax:
java psoft.hsphere.migrator.PlanExtractor -force -resellername res_name
[-plans the list of plan names] [-ids the list of plan ids]
Options:
- The -force option is used to ignore all possible errors while extracting plans.
- The -resellername option requires the username of the reseller whose plans are extracted.
To extract plans for master admin, use option -resellername admin.
- The -plans option requires names of plans to be extracted for this reseller.
If a plan name contains spaces, it must be quoted, e.g.:
-plans Unix1 'Reseller 2' WinBest33
If you omit both -plans and -ids, all plans will be extracted.
- The -ids option requires IDs of plans to be extracted for this reseller.
If you omit both -plans and -ids, all plans will be extracted.
Examples:
java psoft.hsphere.migrator.PlanExtractor -force -resellername RESELLER -plans silver 'unix gold'
java psoft.hsphere.migrator.PlanExtractor -force -resellername RESELLER -ids 7564 7675
java psoft.hsphere.migrator.PlanExtractor -force -resellername RESELLER
java psoft.hsphere.migrator.PlanExtractor -resellername admin -plans silver -resellername RESELLER -ids 7564
PlanExtractor writes error messages to migrate_plans.log
Plan Creator
Run PlanCreator as cpanel with the following syntax:
java psoft.hsphere.migrator.PlanCreator [-active]
-d plans.xml
[-createprices] [ -r | -rc plan name]
Options:
- -active - activate plans after they are created.
- -d plans.xml - specify plan XML file to be taken.
- -createprices - create prices for plans.
- -r plan name - this option is used when PlanCreator
has previously failed to create a certain plan.
With this option, PlanCreator skips all plans before a specified plan
in plans.xml and tries to recreate that plan.
If the plan's name contains spaces, it must be quoted, e.g.:
-r 'Admin 1'
- -rc plan name - this option is used when PlanCreator
has previously failed to create a certain plan correctly.
With this option, PlanCreator skips all plans before a specified plan
in plans.xml, deletes that plan and then tries to recreate it.
If the plan's name contains spaces, it must be quoted, e.g.:
-rc 'Admin 1'
PlanCreator writes error messages to migrate_plans.log
XML Document Structure
The structure of plans.xml looks as follows:
plans
/ ...
plan
____________/\_________________________
/ | \
periods options \ ...
/ ... | ... _________/\______________________________
period /|\ / | | \
_____/ | \____ resource ifresource ifgroup LogicalGroup
/ | \ | | ... | ...
/ | \ | ... __|__ ___|___
/ | \ | / \ / \
customparam postparam param ____|____ resource ifgroup resource LogicalGroup
/ | \ | | ... |
special fields price ... ___|___ ...
| ... / \
special resource LogicalGroup
|
...
XML Elements and Attributes
- plan - plan description:
- name - plan name
- reseller - reseller name (if not avaliable, admin is assumed)
- wizard - wizard name
- period - plan periods:
- id - period id
- size - period duration
- type - period type (DAY, WEEK, MONTH, YEAR)
- discountusage - usage discount (%)
- discountsetup - setup discount (%)
- discountunit - recurrent discount (%)
- param - plan parameters used for the plan creation:
- name - parameter name
- value - parameter value
Parameters:
- trial - billing type: 0 - Without billing, 1 - Paid, 2 - Trial
- trial_duration - trial period for the billing type trial
- trial_credit - credit limit for the billing type trial
- hard_credit - credit limit
- send_invoice - enable e-mail invoice notification
- mixedip - default IP type (shared or dedicated)
- shared_ip_tag - shared IP Tag
- calias - instant alias for the given shared IP tag
- stopgapalias - stopgap domain for the given shared IP tag
- money_back - enable money back
- money_back_days - money back guarantee in days
- periods - the number of plan periods
- postparam - parameters to be set after the plan creation:
- name - parameter name
- value - parameter value
Parameters:
- billinginfo - enable billing info
- _template - default template
- _TEMPLATES_DIR - template directory
- customparam - custom parameters to be set after the plan creation:
- name - parameter name
- value - parameter value
- resource - resources available for the plan.
Check corresponding plan wizard XML documents in the
~cpanel/psoft/hsphere/plan/wizard/xml/ directory
for the list of available resources and the way they are set:
- name - resource name
- enable - is resource enabled
- include - is resource included
- active - is resource activated
- price - resource price:
- id - price id
- freeunits - free units
- setup - setup units
- unit - monthly units
- usage - extra units
- LogicalGroup - the plan's logical group:
- name - logical group name
- type - logical group type
- groupid - logical group id
- special - special resource parameters:
- name - special field name
- value - special field value
|