Administrator script with connections blocked
|Submitted by: ||Raphaël Doursenaud (rdoursenaud)|| ||Submitted on: ||2012-05-07 10:17
|Last Modified On: ||2013-03-12 16:58|| ||Dolibarr version: ||3.2.0
|PHP version: ||5.3.12|| ||Database type and version: ||5.5.23
|OS Type/Version: ||Linux 3.3.4|| ||Category: ||Core problem
|Severity: ||5 - Major||
|Summary: ||Administrator script with connections blocked
|Description: ||Trying to execute a script as administrator with new connections locked (maintenance mode) is refused.
I expected to still be able to execute it as administrator.
|Step to reproduce bug: ||Is it a script into /script directory.
|Resolution: ||Fixed|| ||Assigned to: ||Laurent Destailleur (eldy)
|Status: ||Closed|| |
- Laurent Destailleur 2013-03-12 16:58
- So i think define('EVEN_IF_ONLY_LOGIN_ALLOWED',1) answer your problem.
I updated skeleton template script to show it. So i close the request.
- Raphaël Doursenaud 2013-03-12 15:58
- My script is a data update script that is run as the super-administrator user.
I need to block connections before running it to avoid errors based on user activity.
As the web user interface of Dolibarr allows any operation to be made by the administrator in login locked mode, I expected it to be the same for my script.
I didn't know about the EVEN_IF_ONLY_LOGIN_ALLOWED though. Looks like a good hint for my script.
Oh, and thanks !
- Laurent Destailleur 2013-03-09 15:18
- Most scripts into directory /script are use with no user (so anonymous). So they are blocked.
We can add the line:
define('EVEN_IF_ONLY_LOGIN_ALLOWED',1) at begin of script to make the script working despite the lock. But i am not sure that's what we want, since option lock login is done to avoid any activity onto database (for database maintenance purpose for example).
Do you see a script that should be allowed to work when we are in maintenance mode ?
- Raphaël Doursenaud 2012-05-10 11:59
- Yes it is a custom script in /script directory built using the supplied skeleton.
Didn't try a supplied script though.