X-Payments:Regen-codebook.php

From X-Cart 4 Classic
Jump to: navigation, search

The regen-codebook.php script is used to re-create the codebook contained in the <lib/XPay/Model/Codebook.php> script.

When you run this script, it will also change:

  • the PIN-codes table,
  • cardholder data encryption keys,
  • online store keys,
  • the 'force to change password' flag for all user accounts (including the Administrator).

since this information is encrypted using the codebook.

Note: Before using the script, make sure that SSH and CLI SAPI are available on your server. Contact your hosting provider regarding the matter.

To re-generate the codebook please follow the below steps (do it carefully in order to avoid losing data):

  1. Copy the file <lib/XPay/Model/Codebook.php> to the file <lib/XPay/Model/Codebook.prev.php>
  2. Create your X-Payments' database dump.
  3. Log in to the server via SSH.
  4. Go to the X-Payments installation directory, for example
    $ cd /home/www/xpayments
  5. Run the regen-codebook.php script with two parameters -run and <xpayments_dir>, where <xpayments_dir> is the full path to the directory where your X-Payments intallation is located, for example:
    $ php regen-codebook.php -run /home/www/xpayments
  6. If the script failed, copy the file <lib/XPay/Model/Codebook.prev.php> to the file <lib/XPay/Model/Codebook.php>, restore the database from the saved dump and repeat step 3.
  7. If the script completed successfully delete the database dump file and the <lib/XPay/Model/Codebook.prev.php> file.