Version Description
- Fixed: Database prefix not being used when creating/updating tables correctly.
- Fixed: New installs caused an error in the new upgrade code as the visitor table did not exist yet.
- Fixed: Replaced use of deprecated $table_prefix global during install/update.
Download this release
Release Info
Developer | GregRoss |
Plugin | WP Statistics |
Version | 7.0.2 |
Comparing to | |
See all releases |
Code changes from version 7.0.1 to 7.0.2
- readme.txt +6 -1
- wp-statistics.php +2 -2
- wps-install.php +25 -21
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://mostafa-soufi.ir/donate/
|
|
4 |
Tags: statistics, stats, visit, visitors, chart, browser, blog, today, yesterday, week, month, yearl, total, post, page, sidebar, summary, feedburner, hits, pagerank, google, alexa, live visit
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 3.9.1
|
7 |
-
Stable tag: 7.0.
|
8 |
License: GPL2
|
9 |
|
10 |
Complete statistics for your WordPress site.
|
@@ -139,6 +139,11 @@ No.
|
|
139 |
* If you have enabled statistical reporting you can now use any shortcode that is supported in your WordPress installation, the old variables will continue to work for the time being, however in a future version of WP Statistics they will be removed so please update your message text now with the appropriate shortcodes.
|
140 |
|
141 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
142 |
= 7.0.1 =
|
143 |
* Fixed: Error during new installations due to $wpdb object not being available.
|
144 |
|
4 |
Tags: statistics, stats, visit, visitors, chart, browser, blog, today, yesterday, week, month, yearl, total, post, page, sidebar, summary, feedburner, hits, pagerank, google, alexa, live visit
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 3.9.1
|
7 |
+
Stable tag: 7.0.2
|
8 |
License: GPL2
|
9 |
|
10 |
Complete statistics for your WordPress site.
|
139 |
* If you have enabled statistical reporting you can now use any shortcode that is supported in your WordPress installation, the old variables will continue to work for the time being, however in a future version of WP Statistics they will be removed so please update your message text now with the appropriate shortcodes.
|
140 |
|
141 |
== Changelog ==
|
142 |
+
= 7.0.2 =
|
143 |
+
* Fixed: Database prefix not being used when creating/updating tables correctly.
|
144 |
+
* Fixed: New installs caused an error in the new upgrade code as the visitor table did not exist yet.
|
145 |
+
* Fixed: Replaced use of deprecated $table_prefix global during install/update.
|
146 |
+
|
147 |
= 7.0.1 =
|
148 |
* Fixed: Error during new installations due to $wpdb object not being available.
|
149 |
|
wp-statistics.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: WP Statistics
|
4 |
Plugin URI: http://wp-statistics.com/
|
5 |
Description: Complete statistics for your WordPress site.
|
6 |
-
Version: 7.0.
|
7 |
Author: Mostafa Soufi & Greg Ross
|
8 |
Author URI: http://wp-statistics.com/
|
9 |
Text Domain: wp_statistics
|
@@ -17,7 +17,7 @@ License: GPL2
|
|
17 |
}
|
18 |
|
19 |
// These defines are used later for various reasons.
|
20 |
-
define('WP_STATISTICS_VERSION', '7.0.
|
21 |
define('WP_STATISTICS_MANUAL', 'manual/WP Statistics Admin Manual.');
|
22 |
define('WP_STATISTICS_REQUIRED_GEOIP_PHP_VERSION', '5.3.0');
|
23 |
define('WPS_EXPORT_FILE_NAME', 'wp-statistics');
|
3 |
Plugin Name: WP Statistics
|
4 |
Plugin URI: http://wp-statistics.com/
|
5 |
Description: Complete statistics for your WordPress site.
|
6 |
+
Version: 7.0.2
|
7 |
Author: Mostafa Soufi & Greg Ross
|
8 |
Author URI: http://wp-statistics.com/
|
9 |
Text Domain: wp_statistics
|
17 |
}
|
18 |
|
19 |
// These defines are used later for various reasons.
|
20 |
+
define('WP_STATISTICS_VERSION', '7.0.2');
|
21 |
define('WP_STATISTICS_MANUAL', 'manual/WP Statistics Admin Manual.');
|
22 |
define('WP_STATISTICS_REQUIRED_GEOIP_PHP_VERSION', '5.3.0');
|
23 |
define('WPS_EXPORT_FILE_NAME', 'wp-statistics');
|
wps-install.php
CHANGED
@@ -1,8 +1,11 @@
|
|
1 |
<?php
|
2 |
if( is_admin() ) {
|
|
|
|
|
|
|
3 |
|
4 |
// The follow variables are used to define the table structure for new and upgrade installations.
|
5 |
-
$create_useronline_table = ("CREATE TABLE {$
|
6 |
`ID` int(11) NOT NULL AUTO_INCREMENT,
|
7 |
`ip` varchar(20) NOT NULL,
|
8 |
`timestamp` int(10) NOT NULL,
|
@@ -14,7 +17,7 @@
|
|
14 |
PRIMARY KEY (`ID`)
|
15 |
) CHARSET=utf8");
|
16 |
|
17 |
-
$create_visit_table = ("CREATE TABLE {$
|
18 |
`ID` int(11) NOT NULL AUTO_INCREMENT,
|
19 |
`last_visit` datetime NOT NULL,
|
20 |
`last_counter` date NOT NULL,
|
@@ -22,7 +25,7 @@
|
|
22 |
PRIMARY KEY (`ID`)
|
23 |
) CHARSET=utf8");
|
24 |
|
25 |
-
$create_visitor_table = ("CREATE TABLE {$
|
26 |
`ID` int(11) NOT NULL AUTO_INCREMENT,
|
27 |
`last_counter` date NOT NULL,
|
28 |
`referred` text NOT NULL,
|
@@ -40,7 +43,7 @@
|
|
40 |
KEY `location` (`location`)
|
41 |
) CHARSET=utf8");
|
42 |
|
43 |
-
$create_exclusion_table = ("CREATE TABLE {$
|
44 |
`ID` int(11) NOT NULL AUTO_INCREMENT,
|
45 |
`date` date NOT NULL,
|
46 |
`reason` varchar(255) DEFAULT NULL,
|
@@ -50,7 +53,7 @@
|
|
50 |
KEY `reason` (`reason`)
|
51 |
) CHARSET=utf8");
|
52 |
|
53 |
-
$create_pages_table = ("CREATE TABLE {$
|
54 |
`uri` varchar(255) NOT NULL,
|
55 |
`date` date NOT NULL,
|
56 |
`count` int(11) NOT NULL,
|
@@ -61,13 +64,22 @@
|
|
61 |
KEY `id` (`id`)
|
62 |
) CHARSET=utf8");
|
63 |
|
64 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
// Check the number of index's on the visitors table, if it's only 5 we need to check for duplicate entries and remove them
|
66 |
-
$result = $wpdb->query(
|
67 |
|
68 |
-
if( $result
|
69 |
// We have to loop through all the rows in the visitors table to check for duplicates that may have been created in error.
|
70 |
-
$result = $wpdb->get_results( "SELECT ID, last_counter, ip FROM {$
|
71 |
|
72 |
// Setup the inital values.
|
73 |
$lastrow = array( 'last_counter' => '', 'ip' => '' );
|
@@ -85,21 +97,13 @@
|
|
85 |
|
86 |
// Now do the acutal deletions.
|
87 |
foreach( $deleterows as $row ) {
|
88 |
-
$wpdb->delete( $
|
89 |
}
|
90 |
|
|
|
|
|
91 |
}
|
92 |
|
93 |
-
// This includes the dbDelta function from WordPress.
|
94 |
-
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
|
95 |
-
|
96 |
-
// Create/update the plugin tables.
|
97 |
-
dbDelta($create_useronline_table);
|
98 |
-
dbDelta($create_visit_table);
|
99 |
-
dbDelta($create_visitor_table);
|
100 |
-
dbDelta($create_exclusion_table);
|
101 |
-
dbDelta($create_pages_table);
|
102 |
-
|
103 |
// Store the new version information.
|
104 |
update_option('wp_statistics_plugin_version', WP_STATISTICS_VERSION);
|
105 |
update_option('wp_statistics_db_version', WP_STATISTICS_VERSION);
|
@@ -145,7 +149,7 @@
|
|
145 |
|
146 |
foreach( $var_options as $option ) {
|
147 |
// Handle the special variables options.
|
148 |
-
$result = $wpdb->get_results("SELECT * FROM {$
|
149 |
|
150 |
foreach( $result as $opt ) {
|
151 |
$new_name = substr( $opt->option_name, 4 );
|
1 |
<?php
|
2 |
if( is_admin() ) {
|
3 |
+
GLOBAL $wpdb;
|
4 |
+
|
5 |
+
$wp_prefix = $wpdb->prefix;
|
6 |
|
7 |
// The follow variables are used to define the table structure for new and upgrade installations.
|
8 |
+
$create_useronline_table = ("CREATE TABLE {$wp_prefix}statistics_useronline (
|
9 |
`ID` int(11) NOT NULL AUTO_INCREMENT,
|
10 |
`ip` varchar(20) NOT NULL,
|
11 |
`timestamp` int(10) NOT NULL,
|
17 |
PRIMARY KEY (`ID`)
|
18 |
) CHARSET=utf8");
|
19 |
|
20 |
+
$create_visit_table = ("CREATE TABLE {$wp_prefix}statistics_visit (
|
21 |
`ID` int(11) NOT NULL AUTO_INCREMENT,
|
22 |
`last_visit` datetime NOT NULL,
|
23 |
`last_counter` date NOT NULL,
|
25 |
PRIMARY KEY (`ID`)
|
26 |
) CHARSET=utf8");
|
27 |
|
28 |
+
$create_visitor_table = ("CREATE TABLE {$wp_prefix}statistics_visitor (
|
29 |
`ID` int(11) NOT NULL AUTO_INCREMENT,
|
30 |
`last_counter` date NOT NULL,
|
31 |
`referred` text NOT NULL,
|
43 |
KEY `location` (`location`)
|
44 |
) CHARSET=utf8");
|
45 |
|
46 |
+
$create_exclusion_table = ("CREATE TABLE {$wp_prefix}statistics_exclusions (
|
47 |
`ID` int(11) NOT NULL AUTO_INCREMENT,
|
48 |
`date` date NOT NULL,
|
49 |
`reason` varchar(255) DEFAULT NULL,
|
53 |
KEY `reason` (`reason`)
|
54 |
) CHARSET=utf8");
|
55 |
|
56 |
+
$create_pages_table = ("CREATE TABLE {$wp_prefix}statistics_pages (
|
57 |
`uri` varchar(255) NOT NULL,
|
58 |
`date` date NOT NULL,
|
59 |
`count` int(11) NOT NULL,
|
64 |
KEY `id` (`id`)
|
65 |
) CHARSET=utf8");
|
66 |
|
67 |
+
// This includes the dbDelta function from WordPress.
|
68 |
+
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
|
69 |
+
|
70 |
+
// Create/update the plugin tables.
|
71 |
+
dbDelta($create_useronline_table);
|
72 |
+
dbDelta($create_visit_table);
|
73 |
+
dbDelta($create_visitor_table);
|
74 |
+
dbDelta($create_exclusion_table);
|
75 |
+
dbDelta($create_pages_table);
|
76 |
+
|
77 |
// Check the number of index's on the visitors table, if it's only 5 we need to check for duplicate entries and remove them
|
78 |
+
$result = $wpdb->query("SHOW INDEX FROM {$wp_prefix}statistics_visitor WHERE Key_name = 'date_ip'");
|
79 |
|
80 |
+
if( $result != 2 ) {
|
81 |
// We have to loop through all the rows in the visitors table to check for duplicates that may have been created in error.
|
82 |
+
$result = $wpdb->get_results( "SELECT ID, last_counter, ip FROM {$wp_prefix}statistics_visitor ORDER BY last_counter, ip" );
|
83 |
|
84 |
// Setup the inital values.
|
85 |
$lastrow = array( 'last_counter' => '', 'ip' => '' );
|
97 |
|
98 |
// Now do the acutal deletions.
|
99 |
foreach( $deleterows as $row ) {
|
100 |
+
$wpdb->delete( $wp_prefix . 'statistics_visitor', array( 'ID' => $row ) );
|
101 |
}
|
102 |
|
103 |
+
// The table should be ready to be updated now with the new index, so let's do it.
|
104 |
+
dbDelta($create_visitor_table);
|
105 |
}
|
106 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
// Store the new version information.
|
108 |
update_option('wp_statistics_plugin_version', WP_STATISTICS_VERSION);
|
109 |
update_option('wp_statistics_db_version', WP_STATISTICS_VERSION);
|
149 |
|
150 |
foreach( $var_options as $option ) {
|
151 |
// Handle the special variables options.
|
152 |
+
$result = $wpdb->get_results("SELECT * FROM {$wp_prefix}options WHERE option_name LIKE '{$option}'");
|
153 |
|
154 |
foreach( $result as $opt ) {
|
155 |
$new_name = substr( $opt->option_name, 4 );
|