I actually needed to make a few changes for that to work.
Firstly, simply uncommenting the lines changes the behaviour when the script is run from the web site. Secondly, there's no way of choosing whether to run the consistency checks or optimise the database.
This code fragment in consist.php implements that.
if (php_sapi_name() == "cli") {
fud_use('adm_cli.inc', 1);
cli_execute(1);
if (($argc > 1) && ($argv[1] == "sqlopt")) {
cli_execute(0, array('opt'=>1));
}
}
In include/adm_cli.inc, I had to change
to
and move it to after the code which sets _GET and _POST.
None of this works if there are no themes. Pretty much all of the scripts require at least the default theme to exist.
To allow the themes to rebuilt, I needed this in admthemes.php
require('./GLOBALS.php');
if (php_sapi_name() == "cli") {
fud_use('adm_cli.inc', true);
cli_execute(1, array('rebuild_all'=>1));
}
and a separate script to rebuild the default theme:
<?php
require('./GLOBALS.php');
define('__dbtype__', 'mysql');
fud_use('adm_cli.inc', true);
cli_execute(1);
fud_use('compiler.inc', true);
compile_all();
?>
Running this script first then allows the other scripts to be run to create the temporary files, and to build the rest of the themes.
It would be really nice if this sort of functionality could be achieved without having to make changes to files, in the future. This would make upgrades less risky.
What are the chances of making some of this stuff script-friendly in a future release?
[Updated on: Sat, 03 May 2008 23:31]
Report message to a moderator