If only it were a database setting... but it's not frown

It's in the config array in config.inc.php which is set by dotoggleopen.php (admin)

I think the only way around this would be to write a script to read and set config.inc.php

Mind you saying that, the code you need is in dotoggleopen.php - just not sure how to get around $admin->doAuth()