-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Moodle authentication breaks elfinder (or vice-versa) #222
Comments
I've just had this problem on a test xampp install and remember having similar problems previously... I've been testing some stuff on a localhost xampp installation on and off over the last few days and again this morning. This is recent develop code but not the very latest. I'm not sure what caused this but now when I try to edit an existing or new LO and browser for media I get the following error: Invalid backend response. Data is not JSON. This happens regardless of account, browser, project etc and I've completely shut down xampp, cleared session files and re-started but still the same problem. I remember having similar problems in a much earlier test version on the Techdis server where there was more than one install and liaising with Tom but never resolving it then and in this local xampp instance there's only a singe XOT install. It also inside a Moodle directory like the Techdis server was but has been working fine until this problem arose this morning and now even with auth_config set to guest or static effectively the install is broken because it's not possible to browse for media. In this case I can potentially just scrap and replace the install but I seem to recall when I tried that on the Techdis server previously it didn't resolve the problem and I'm worried about this happening on live installations. There are plenty using Moodle for authentication. This happens when the pop-up opens: And the FF console shows 2 repeat errors: |
Exploring this further I first tried using the purge all caches function via Moodle admin and same problem existed. |
Brad, connector.php is custom code (written by me). Could you try the following:
It will start the session in exactly the same way as it is started in other parts of Xerte. I've verified that this keeps working in normal circumstances. Could you please check if this solves your issue? Than I will commit the fix. |
This works! Thanks! |
I have Moodle authentication enabled, and doing anything that runs elfinder, like trying to upload an image to a page, results in a
Data is not JSON
error. This usually means the server can't write toUSER_FILES/
, but not this time.elfinder makes an AJAX call to
editor/elfinder/php/connector.php
, expecting back AJAX, butconnector.php
has the following code:If you are using Moodle authentication, XOT just piggybacks on Moodle's session, and in fact
auth_config.php
avoids runningsession_start()
to avoid "squashing" Moodle's session data. elfinder, unfortunately, doesn't know this and uses PHP's session or starts a new one, and$_SESSION
only contains elfinder's session values.This can be demonstrated by running
session_id()
on an XOT page and an elfinder page. The former will return the value of$_COOKIE['MoodleSession']
, while the latter will return the value of$_COOKIE['PHPSESSID]
.I'm not sure what the best solution to this is other than having Moodle authentication not try to use Moodle's session (is this even really needed if all we want is authentication?), or modifying the XOT version of elfinder to not start a new session. I've tried doing this with
session_name('MoodleSession')
in connector.php, and whilesession_id()
returns the ID of Moodle's session after that,$_SESSION
continues to only have elfinder's session data. This could just be me not fully understanding how PHP sessions work, though.The text was updated successfully, but these errors were encountered: