Administrator script with connections blocked
|Submitted by: ||Raphaël Doursenaud (rdoursenaud)|| ||Submitted on: ||07/05/2012 10:17
|Last Modified On: ||09/03/2013 15:18|| ||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: ||Works for me|| ||Assigned to: ||Aucun
|Status: ||Open|| |
- Raphaël Doursenaud 12/03/2013 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.
- Laurent Destailleur 09/03/2013 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 10/05/2012 11:59
- Yes it is a custom script in /script directory built using the supplied skeleton.
Didn't try a supplied script though.