ProcessWire icon indicating copy to clipboard operation
ProcessWire copied to clipboard

3.0.5: Database causing site to mess up

Open cb2004 opened this issue 9 years ago • 5 comments

Not sure where to start with this one. I was testing out PHP 7 and 3.0.5. All was great for the last couple of weeks. I was using AdminThemeReno, suddenly I assiged a field to a template, then it reverted back to the default theme. Tried going into my profile and nothing loaded apart from the header and the footer. After a while I was getting a error 500:

2016-01-22 18:33:56 guest SITE Error: Exception: You do not have permission to execute this module - ProcessPageView (in /home/sites/SITE/public_html/wire/core/Modules.php line 1157) #0 /home/sites/SITE/public_html/wire/core/Modules.php(1071): ProcessWire\Modules->getModule('ProcessPageView') #1 /home/sites/SITE/public_html/index.php(51): ProcessWire\Modules->get('ProcessPageView') #2 {main}

Very odd. So I fired up a clean install of 3.0.5 and pointed to the old database. It all loaded up but again no Reno Theme. I now try to go to Users and get this error:

Fatal error: Call to a member function has() on null in /home/sites/SITE/public_html/wire/core/Users.php on line 70

This is all on a dev site thankfully.

Any ideas?

cb2004 avatar Jan 22 '16 18:01 cb2004

Strange, I've not heard of this one before, but will keep an eye out. It sounds like potentially a corrupt database that might need a MySQL REPAIR command run on it, though hard to tell. I'm not able to duplicate, but I'm not running PHP 7 yet either. I will look into upgrading, just in case it's related to that. Are you able to duplicate the issue using the same steps on a fresh install?

ryancramerdesign avatar Jan 31 '16 12:01 ryancramerdesign

It was also happened to me on a development environment but affected an urgent project. And I was on 3.0.86, though updating to 3.0.88 didn't change anything. Before, I noticed a language change on my superuser and sometime later Repeater and RepeaterMatrix fields started giving "same name" error while creating new ones, like I created them before and trying to create a new one with the same name. Then I noticed PageBookmarks giving an error about a function (which I don't remember its name) in the admin home, between top nav and page tree. Everything is working ok, apart from those errors of course. Then I tried to log out, this error happened; tried to login, restart Apache, MySQL, load from my latest commit, which was many hours ago by the way, same error happened over and over. Files don't affect the result and if the possibly corrupted database loaded for any setup, error happens again. I've got working and non-working sql files but they have 36 to 751 different rows in them. I can share them privately if you like.

Fatal error: Exception: You do not have permission to execute this module - ProcessPageView (in /Users/USER/Sites/SITE/wire/core/Modules.php line 1277) #0 /Users/USER/Sites/SITE/wire/core/Modules.php(1145): ProcessWire\Modules->getModule('ProcessPageView') #1 /Users/USER/Sites/SITE/index.php(53): ProcessWire\Modules->get('ProcessPageView') #2 {main} in /Users/USER/Sites/SITE/index.php on line 64

adoxus avatar Jan 06 '18 15:01 adoxus

Just for reference, here are two old reports of what seems to be the same issue:

https://processwire.com/talk/topic/14897-error-500-exception-you-do-not-have-permission-to-execute-this-module-processpageview/

https://processwire.com/talk/topic/15100-module-user-you-do-not-have-permission-to-execute-this-module/

adrianbj avatar Jan 06 '18 15:01 adrianbj

Thanks @adrianbj for the forum threads. First one by iNoize said,

Its an multipage installation with one core and many languages. EN Version is ok but the DE version always error 500 also if i try to login to the backend.

Mine was a two language setup also. I used Turkish for the default language, and English for the second one. My user profile was set to English, and almost at the same time my admin language turned into Turkish. I noticed that change so much later, after those errors.

adoxus avatar Jan 07 '18 10:01 adoxus

I ran into this issue yesterday running version 3.0.165.

As a back story, I have 3 mirrors of the same site. 1 prod and 2 dev. I was making some simple field/template changes and had no issues on production and one of the dev sites. The next day I attempted to access one of the dev sites and I got below error.

Error: Exception: You do not have permission to execute this module - ProcessPageView (in wire/core/Modules.php line 1330)

Since there was no difference between the 3 sites, I really wanted to figure this out without importing a database from one of the 2 working sites. So I started debugging in the core code and found that in wire/core/Modules if I were to bypass the permission check:

if(!empty($info['permission'])) {
	if(!$user->hasPermission($info['permission'])) return false;
}

the site would render and not throw the exception, but all pages would 404 except for the login page. When I checked the role of the guest user since I was not logged in, I noticed it did not have a role assigned to it and therefor did not have any permissions assigned to it. I tried to use the api to assign the guest role back to the guest user, but with no luck. See screen shots below of those attempts.

I also tried digging through the database to see if I could manually add the role, but admittedly got a bit lost in the structure and and ran out of time to try and figure out how roles/permissions and users were mapped. Unfortunately after about 4 hours of debugging I waived the white flag and submitted to a database backup.

Per Ryan's suggestion above, I did run a scan on the database to ensure it was not corrupt and it came back clean.

Bypassing the permission check and trying to add the role ('guest') to the guest user:

$user->addRole('guest');
var_dump($user->save() . ' saved');

Screenshot 2024-02-14 at 8 56 13 AM

Bypassing the permission check and trying to login as a super user:

Screenshot 2024-02-14 at 9 59 02 AM

Lastly, I did keep a reference to this database and will try to dig into the issue again when I have the time.

RJaydeveloper avatar Feb 14 '24 15:02 RJaydeveloper