Visitor Stats 2 logo Upgrade. From v1 to v2

If you are using v1 or v1.1, please read this page (ignore the install page).

This bit is a little tricky...

As version 2 uses a different database structure (for faster results, and more features).

Basically, we need to copy your old tables, and then install the new ones. After this we convert all the old data into the new tables.

If you have alot of records in MySQL, this could take some time... and I do mean awhile. One of my clients had close to 1 million records, this took about 5 hours for MySQL to do.

The good news is that MySQL seems to be pretty good at juggling its resources, so once you start the conversion, it takes care of the rest (even if this takes 5 hours!).

If anyone out there has a better way of doing this, please, please let me know!

 
Turn off Visitor Stats

As we will be renaming database tables, the best thing to do is stop visitor stats from tracking while we upgrade. I have made an easy and safe way of doing this.

Open up 'visitor_stats/visitor_stats.php'. On line 11 to 16, un-comment this section.

It will look like this (when un-commented):

// Use this when swapping from v1 to v2...
// To test if the upgrade was successfull without allowing others in, user the url: www.yourdomain.com/?vs_test=Y
if (empty($vs_test)) {
$vs_test=$vs_test;
$vsadmin="Y";
}

Now save and upload this file into your current '/visitor_stats/' directory.

Do a quick test by going to your website and making sure you aren't being tracked in Visitor Stat 1, or that there are no errors.

 
Rename old tables

Start by renaming these tables (I use phpmyadmin):

  • vistats_pages
  • vistats_user

    TO

  • vistats_pages2
  • vistats_user2


    Don't worry about 'vistats_counter' as this hasn't changed.

    Again, do a quick test by visiting your website, to make sure nothing has stuffed up now that we've renamed the tables.

 
Insert the new Tables

 

Here are the new tables. Cutting and pasting them should work fine.

The exact settings are:

You can just copy all the text from this box and paste it into your 'Run SQL Query' box in PHPmyAdmin.

If you can't copy and paste this into your 'Run SQL Query' box because it's too big, please use the text file 'Visitor Stats 2 mysql import.txt' found in the '/readme/' folder.

Ok, now lets convert your old data...