Migration script from PAP3 to PAP4+

You can upgrade your system from version 3 to version 4 or higher with the help of our Pap3Compatibility plugin.

This plugin contains two things:
1. script for data migration from PAP3 to PAP4 (or higher) database
2. scripts for compatibility of JavaScript tracking from PAP3 to PAP4 (or higher)


-------------------------------------------------------------------------------
Data migration from PAP3 to PAP4 (or higher)
-------------------------------------------------------------------------------
First of all DO NOT UPLOAD FILES OF PAP4 TO DIRECTORY OF PAP3! Create a new directory, e.g. /pap4 or /affiliation

For migration follow these steps:

1Install new PAP4/5 (or higher) to THE SAME DATABASE as PAP3 - this is an essential requirement.
   You don't need to worry about the old PAP3 tables, they will be not
   damaged, PAP4/5 uses different table names starting with prefix qu_*.
   The old PAP3 installation should be still functional.
   Don't forget to activate feature 'Private campaigns', if you have private campaigns.

2. run script
   http://www.yoursite.com/pap4/plugins/Pap3Compatibility/pap3topap4.php
   it will start data migration from PAP3 to new PAP.
   The data migration can take few minutes, the script handles PHP expiration
   so you can keep it working until it finishes.
   In the successful end it will write : DATA MIGRATION FINISHED SUCCESSFULLY.

   Your PAP3 installation still works normally, and now also when you log in
   to PAP4/5 you'll see all the data copied from PAP3.
    
   What is migrated:
     - Campaigns, Banners
     - Affiliates
     - Transactions (impressions, clicks, sales, commissions)
     - Payouts including payout history
     - Most of the settings

   What is not migrated:
     - Merchants and their permissions - in PAP4/5 you'll have only default
       merchant defined in the PAP4/5 installation.

3. Manual migration steps:
   3.1 Copy banner files from PAP3 /banners directory to PAP4/5 directory
         /accounts/default1/banners
   3.2 If you changed parameter names in PAP3 (a_aid, a_bid, etc.) these
       changes were not migrated to PAP4/5. Log in to PAP4/5 and set the same
       parameter names as in PAP3.

   3.3 Check all the configuration options in PAP4/5 and add missing ones, etc.

   3.4 For the tracking compatibility, copy the files from
         ...pap4/plugins/Pap3Compatibility/scripts
       to  
         ...pap4/scripts
       PAP4/5 uses different JavaScript than PAP3, these scripts will ensure
       that PAP4/5 will track properly also using PAP3 JavaScript.
          
Until now, PAP3 is still fully functional.

4. rename PAP3 directory /affiliate to /affiliate_old
   and PAP4/5 directory /pap4 to /affiliate
   This will replace your old installation with the new one.
    
   Renaming PAP4/5 directory will require you to update the PAP license - you
   can do it by opening merchant panel.
    
5. Test it.
   Test that tracking really works - both clicks (referrals)
   and sales.
    
6. Migrate signup form.
   Signup form from PAP3 will not work with PAP4/5. PAP4/5 uses its own signup form
   that can be configured very flexibly, including it's template from
   the merchant panel.
    
   You would probably need to modify signup form template to include all fields
   that are used for affiliate. You can do it in merchant panel:
   Configuration -> Affiliate Signup -> Customize design -> Edit signup form
   and adding missing field constants.
    
7. Use new JavaScript for tracking
   Tracking with old PAP3 code should be functional also with PAP4/5, but it is
   highly recommended to replace it with new PAP4/5 tracking JavaScript. Without
   this, the new features of PAP4/ like DirectLinks, or advanced sale information
   will not work for you.
    
   You should replace scripts for both click tracking and sales tracking.

Note: If the script takes too long, don't worry. As you can read in the logs:
Data migration was interrupted due to PHP timeout - this is normal, it is not an error. Migration is not finished, please wait for page refresh. Refresh (5 sec)

Since there is huge bunch of records in the database, it will take long to finish. You only have to wait... You can help it a little. Prior to the migration enter the merchant panel of your PAP3  and do the database optimization. This will reduce a lot of records in the database so the migration will take a little less time.

That's all, you are done.