cannod / moodle-drupalservices

Moodle plugin to connect to Drupal services
36 stars 25 forks source link

moodle-drupalservices-2.x-2.x-dev /auth/drupalservices/ install starts but stalls until server timeout #39

Open goose2000 opened 9 years ago

goose2000 commented 9 years ago

Preface: clean install on a localhost, using M2.6. setup has /moodle/ as subdirectory of the drupal root

This could be a server problem, will try again, look for clues. Trouble is I put the /auth/drupalservices/ in place and goto the notifications page, moodle reports it is going to install the plugin. I proceed and goes for a long time, times out.

I understand this version will try to configure automatically:

"The 2.x-2.x version of Drupal Services will automatically try to reach your Drupal site and configure the plugin for it. If the Drupal site can't be automatically detected, you'll be prompted for a single field:"

But I wonder if it is hung up looking for the service? I had moodle debugging on put went straight to server error.


HTTP Error 500.0 - Internal Server Error C:\php-5.4.27\php-cgi.exe - The FastCGI process exceeded configured request timeout Detailed Error Information Module FastCgiModule Notification ExecuteRequestHandler Handler php-5.4.27 Error Code 0x80070102 Requested URL http://localhost:80/bhrplms/admin/index.php?confirmplugincheck=1&cache=0 Physical Path C:\inetpub\wwwroot\drupal-moodle\bhrplms\admin\index.php


Update (different issue looks like, but documenting it anyways) : After the 500 error, I just hit reload and get this PHP error:

Parse error: syntax error, unexpected '=', expecting ')' in C:\inetpub\wwwroot\drupal-moodle\bhrplms\auth\drupalservices\auth.php on line 178 (which is):

if (!empty($drupalfield = $this->config->{"fieldmap$field"})) {

I think this empty() here may be trying to evaluate something my PHP5.4 won't do (expressions) :

"Note: Prior to PHP 5.5, empty() only supports variables; anything else will result in a parse error. In other words, the following will not work: empty(trim($name)). Instead, use trim($name) == false.

Version Description 5.5.0
empty() now supports expressions, rather than only variables. 5.4.0
Checking non-numeric offsets of strings returns TRUE.

netw3rker commented 9 years ago

I did just increase the curl timeout to 14sec from 4 to account for the possibility that Drupal might be in a cache/features rebuild mode. Its doubtful that that caused this problem though.

The one capability I'm not able to test is the /moodle directory. it's possible that the cookie detection script is somehow causing this too. lets try two things:

for you, add this line to your config.php file:

$CFG->forced_plugin_settings['auth_drupalservices']['host_uri']='http://localhost:80/moodle'; $CFG->forced_plugin_settings['auth_drupalservices']['cookiedomain']='localhost';

(you can also try taking out the 2nd line)

I'll commit some debug code to help try and track down the problem too.

goose2000 commented 9 years ago

I have tried to repeat this timeout error and I can't. I think this was a server issue / fluke. But it may have flushed out a real bug for PHP 5.4 ? (see top, updated) I am going to close this and open a new issue for that.

netw3rker commented 9 years ago

The use of empty($obj->method()) came up in the plugin code review as being php5.5 specific. to make this < php5.5 compatible I need to adapt that to be: $variable=$object->method(); if(empty($variable)) ....

I'm sure that has a lot to do with yours and this janky guy's problem here.

netw3rker commented 9 years ago

I think you did track down a couple of bugs inadvertently :) When I went digging in to test my debugging outputs, I found a bunch of minor 'missing key' notices that I hadn't seen before. fixing those probably actually fixed a few things for you too.

If you can, give the latest & greatest a try & let me know how it goes.

netw3rker commented 9 years ago

Oh yeah, if you wanna try to replicate the process from the very beginning, delete all of the auth_drupalservices plugin config variables (except for the name=version one) from the mdl_config_plugins table in the database, then from moodle, purge all caches. That will force the autodetect system to start over.

goose2000 commented 9 years ago

Okay, will grab the new 2.x-2.x-dev and try. I have saved multiple mysql dumps to go backwards / start over.

goose2000 commented 9 years ago

Ah, this went much better. I could see all the debug info and the auto config attempts. I don't think it could find the Drupal session cookie, but that's a smaller issue and have fixed that before:

https://www.youtube.com/watch?v=m2JsWPrIoN4

Update: removed the embarrassing background blabbering.

netw3rker commented 9 years ago

thats sort of an edge case I'd like to explore a bit. Your session cookie for your localhost example should be a cookie domain of "localhost" or just blank right?

ps: checking out the video now

netw3rker commented 9 years ago

well, was checking it out. it says it has been removed.

updated: it's there now, but no audio at all.. ;)

netw3rker commented 9 years ago

I just watched the video. It looks like it can't reach the services at all (if it could, you'd get more fields on the settings page). I'll put a notice in that will at least point that out to users.

can you test that you can reach http://localhost/moodlesso/user as admin?

netw3rker commented 9 years ago

Alright, I just tested this with the service disabled on the Drupal side, and found some fresh bugs that should have been trapped. Give it a shot with the new latest and greatest.

goose2000 commented 9 years ago

Cool, I will get a chance run through it this afternoon - thanks

netw3rker commented 9 years ago

hey @goose2000 , any luck? :)

netw3rker commented 9 years ago

Hey @goose2000 , how's it looking? Got a few more updates in, so update to the latest 2.x-2.x-dev code & lets see if that solves this problem.