Jump to content

PageViewStatistic for ProcessWire


tcnet
 Share

Recommended Posts

If you realy clicked "Upgrade" then ___upgrade($fromVersion, $toVersion) have been fired and you would not have problems.

Exists a directory named .ProcessPageViewStat in the module directory? Please note the dot before the module name.

If not rename the module to .ProcessPageViewStat then go to the module page, rename it back to ProcessPageViewStat and then click Refresh.

Link to comment
Share on other sites

11 minutes ago, tcnet said:

If you realy clicked "Upgrade" then ___upgrade($fromVersion, $toVersion) have been fired and you would not have problems.

Exists a directory named .ProcessPageViewStat in the module directory? Please note the dot before the module name.

If not rename the module to .ProcessPageViewStat then go to the module page, rename it back to ProcessPageViewStat and then click Refresh.

I tried all of the above but still get error. Im posting gif so you can see I get error when trying to upgrade from Upgrade module.

spacer.png

Link to comment
Share on other sites

4 minutes ago, Roych said:

I tried all of the above but still get error. Im posting gif so you can see I get error when trying to upgrade from Upgrade module.

spacer.png

Seems that ___upgrade($fromVersion, $toVersion) don't get called. You can use the old version. Just rename .ProcessPageViewStat to ProcessPageViewStat

Link to comment
Share on other sites

2 minutes ago, tcnet said:

Seems that ___upgrade($fromVersion, $toVersion) don't get called. You can use the old version. Just rename .ProcessPageViewStat to ProcessPageViewStat

I always have both folders (.ProcessPageViewStat and ProcessPageViewStat) inside modules. I removed module from database completely and tried to install it from scratch but still get the same error.

Link to comment
Share on other sites

Just now, tcnet said:

"removed module from database"

How did you do that? Just deleted the tables? You will get the same error! You have to uninstall it if you want to install it from the scratch!

I deleted the folder and then under the modules in admin it asked me if I want to remove this module from the database.

Link to comment
Share on other sites

Ok, I see the problem. Please delete ProcessPageViewStat and rename .ProcessPageViewStat to ProcessPageViewStat. Then execute the upgrade again. If you get the error again then delete ProcessPageViewStat and rename .ProcessPageViewStat to ProcessPageViewStat and uninstall the module from then module page and install it again.

Link to comment
Share on other sites

4 minutes ago, tcnet said:

When you deleted the .ProcessPageViewStat already, you have to delete process_pageviewstat_main in the database before you install it again.

Or you have to add a new int column to process_pageviewstat_main named usr. This is what the upgrade function does.

Link to comment
Share on other sites

35 minutes ago, Roych said:

I deleted the folder and then under the modules in admin it asked me if I want to remove this module from the database.

Did solved the problem? You can also replace the module file in the attachment of this message. It encloses the database execution in line 376 with a try-catch. So you are able to click the refresh button without error message. The refresh button should call the upgrade funtion or something is wrong in your PW.

ProcessPageViewStat.module

Link to comment
Share on other sites

1 hour ago, tcnet said:

Did solved the problem? You can also replace the module file in the attachment of this message. It encloses the database execution in line 376 with a try-catch. So you are able to click the refresh button without error message. The refresh button should call the upgrade funtion or something is wrong in your PW.

I tried replacing the file, but still not working. I can't access the admin area at all after instaling the module so I can't click on refresh.

After renaming the folder I get missing file notification. After renaming back I get error.

It happens on all my sites, so unlikely that there is the problem on all of them or ... 

I removed all of the folders and cleaned the database from admin as before and installed the new version, now I have only one ProcessPageViewStat folder but the error is still there. Kinda lost here.

Link to comment
Share on other sites

25 minutes ago, Roych said:

I tried replacing the file, but still not working.

Did you replaced the file or not? What's the error message after you replaced the file?

How you cleaned the database? Did you deleted the table process_pageviewstat_main in the database or not?

Did you followed my instruction:
Please delete ProcessPageViewStat and rename .ProcessPageViewStat to ProcessPageViewStat. Then execute the upgrade again. If you get the error again then delete ProcessPageViewStat and rename .ProcessPageViewStat to ProcessPageViewStat and uninstall the module from then module page and install it again.

Link to comment
Share on other sites

22 minutes ago, tcnet said:

Did you replaced the file or not? What's the error message after you replaced the file?

How you cleaned the database? Did you deleted the table process_pageviewstat_main in the database or not?

Did you followed my instruction:
Please delete ProcessPageViewStat and rename .ProcessPageViewStat to ProcessPageViewStat. Then execute the upgrade again. If you get the error again then delete ProcessPageViewStat and rename .ProcessPageViewStat to ProcessPageViewStat and uninstall the module from then module page and install it again.

Yes I replaced the file

I deleted the process_pageviewstat_main through adminer

Yes I followed your instructions as described but nothing works

 

Now I uninstalled the module and deleted everything from modules folder. Then I started a new install but Again I get an error.

Link to comment
Share on other sites

1 hour ago, Roych said:

Yes I replaced the file

I deleted the process_pageviewstat_main through adminer

Yes I followed your instructions as described but nothing works

 

Now I uninstalled the module and deleted everything from modules folder. Then I started a new install but Again I get an error.

If you exchanged the module file then the exception will occurring in a different line ynd you will not get the same error message. If you deleted table process_pageviewstat_main and installed version 1.1.1 then process_pageviewstat_main will recreated with column usr. But in this case you will not get the same error message. I guess you loading your pages from the browser cache.

Link to comment
Share on other sites

  • 1 month later...
  • 4 weeks later...

You implemented code from another author under another Namespace (Version 1.32 of parseUserAgentString.php). Current Version is 1.36 Any updates planned?
https://github.com/trparky/User-Agent-Parser/blob/main/parseUserAgentString.php

As common practice in the ProcessWire community, it would be great if you could enable issues in the associated GitHub repo.
Furthermore it would be nice if the module author felt responsible for parts of the code that he has copied from other sources.
https://github.com/techcnet/ProcessPageViewStat/pull/1

Link to comment
Share on other sites

  • 1 month later...

@tcnet As @kixe stated the "parseUserAgentString.php" is outdated and contains some bugs.

One of our clients recently saw PHP notices coming from this file for Apple users using Safari browser. Apparently the Major & minor version were set but not the build, as such $t[2] was undefined.
We fixed it by an extra isset().

Original:

$browserVersion = $t[0] . "." . $t[1] . $t[2];

Fix:

$browserVersion = $t[0] . "." . $t[1] .(isset($t[2]) ? $t[2] : '');

 

Link to comment
Share on other sites

53 minutes ago, Arne said:

@tcnet As @kixe stated the "parseUserAgentString.php" is outdated and contains some bugs.

One of our clients recently saw PHP notices coming from this file for Apple users using Safari browser. Apparently the Major & minor version were set but not the build, as such $t[2] was undefined.
We fixed it by an extra isset().

Original:

$browserVersion = $t[0] . "." . $t[1] . $t[2];

Fix:

$browserVersion = $t[0] . "." . $t[1] .(isset($t[2]) ? $t[2] : '');

 

You will see "PHP notices" if you run your ProcessWire in debug mode. Please read the description for the debug mode. The debug mode is not intended for productive usage. Please turn off debug mode and you will see that everything works fine.

Link to comment
Share on other sites

1 hour ago, Arne said:

Fix:

$browserVersion = $t[0] . "." . $t[1] .(isset($t[2]) ? $t[2] : '');

Alternative, if PHP 7.4+ you can use the null coalescing assignment operator:

$browserVersion = $t[0] . "." . $t[1] . $t[2] ??= '';

 

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

Hello!

I installed the module and it works fine for me.

But my local dev environment I get a ton of error messages - when not logged in -

Warning: unpack(): Type V: not enough input, need 4, have 0 in /Users/sthumann/Sites/kibis/site/modules/ProcessPageViewStat/func/IP2Location.php on line 1013

This message repeats itself a hundred times, then at the end there are these two lines:

Notice: Trying to access array offset on value of type bool in /Users/sthumann/Sites/kibis/site/modules/ProcessPageViewStat/ProcessPageViewStat.module on line 407

Notice: Trying to access array offset on value of type bool in /Users/sthumann/Sites/kibis/site/modules/ProcessPageViewStat/ProcessPageViewStat.module on line 408

In the modules settings I disabled all options. These error messages only appear when:

- not logged in (on local dev environment)
- when my local host has not an IP address assigned to it. I am using MAMP Pro on Mac...

On the live site these messages never appear.

I guess the that the IP2Location throws those errors when there is "no ip address" to find. 

So my question is if there is a way to detect if the page runs on a local test system to disable the tracking functions in those cases?

Link to comment
Share on other sites

35 minutes ago, Stefanowitsch said:

But my local dev environment I get a ton of error messages - when not logged in -

There are not a single ERROR MESSAGE in your post! These are Warnings and Notices which you get when you run ProcessWire in debug mode.

36 minutes ago, Stefanowitsch said:

On the live site these messages never appear.

And why they not appear? Because your ProcessWire DON'T run in debug mode.

Link to comment
Share on other sites

42 minutes ago, Stefanowitsch said:

I guess the that the IP2Location throws those errors when there is "no ip address" to find. 

Why "no ip address"? Where you know this?

Link to comment
Share on other sites

I made a change in line 389. It seems that getenv('REMOTE_ADDR') doesn't work with local IP addresses. Please upgrade to version 1.1.6.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...