I am writing PHP directly inside a Phing build.xml file using adhoc-task.
The following does work but throws up console errors:
<adhoc-task name="foo"><![CDATA[
define('WP_INSTALLING', true);
require_once '${build.dir.wp}/wp-load.php';
require_once '${build.dir.wp}/wp-admin/includes/upgrade.php';
require_once '${build.dir.wp}/wp-includes/wp-db.php';
$result = wp_install( 'title', 'admin', '[email protected]');
]]></adhoc-task>
The error: The adhoc class you defined must be an instance of phing.Task BUILD FAILED.The adhoc class you defined must be an instance of phing.Task
But it still works...
If I wrap the PHP in a class it doesn't work at all:
<adhoc-task name="foo"><![CDATA[
class FooTest extends Task {
//php code ....
}
]]></adhoc-task>
The error: You must define at least one class for AdhocTaskdefTask.
What is the proper way to include PHP inside the build file (without having access to the php/phing/tasks folder)?