*
 * This is also where scripts tell the database that it's starting
 * or stopping.
 *
 * @copyright Clear Line Web Design, 2007-03-28
 */
/*
 * Define the necessary classes.
 */
require_once PROJECT_ROOT . '/haddock/database/classes/' . 'Database_MySQLUserFactory.inc.php';
require_once PROJECT_ROOT . '/project-specific/classes/' . 'ServerAdminScripts_LocalControlCentre.inc.php';
/*
 * Start doing stuff.
 */
echo "# Task Status\n";
$control_centre = new ServerAdminScripts_LocalControlCentre();
if (isset($_GET['start'])) {
    /*
     * To start a task.
     */
    echo "# Starting\n";
    if (!isset($_GET['task'])) {
        throw new Exception('No task set!');
    }
    if (!isset($_GET['system'])) {
        throw new Exception('No system set!');
    }
    if (!isset($_GET['host'])) {
        throw new Exception('No host set!');
    }
    echo 'Task: ' . $_GET['task'] . "\n";
 * Content of the page that list the task that are currently running
 * in the server admin scripts project.
 *
 * @copyright Clear Line Web Design, 2007-04-30
 */
/*
 * Define the necessary classes.
 */
require_once PROJECT_ROOT . '/project-specific/classes/' . 'ServerAdminScripts_LocalControlCentre.inc.php';
require_once PROJECT_ROOT . '/haddock/html-tags/classes/standard/' . 'HTMLTags_Div.inc.php';
require_once PROJECT_ROOT . '/haddock/html-tags/classes/standard/' . 'HTMLTags_Heading.inc.php';
require_once PROJECT_ROOT . '/haddock/html-tags/classes/standard/' . 'HTMLTags_Table.inc.php';
require_once PROJECT_ROOT . '/haddock/html-tags/classes/standard/' . 'HTMLTags_TR.inc.php';
require_once PROJECT_ROOT . '/haddock/html-tags/classes/standard/' . 'HTMLTags_TH.inc.php';
require_once PROJECT_ROOT . '/haddock/html-tags/classes/standard/' . 'HTMLTags_TD.inc.php';
$control_centre = new ServerAdminScripts_LocalControlCentre();
$content_div = new HTMLTags_Div();
$content_div->set_attribute_str('id', 'content');
$content_div->append_tag_to_content(new HTMLTags_Heading(2, 'Current Tasks'));
$tasks_table = new HTMLTags_Table();
$tasks_tr = new HTMLTags_TR();
$tasks_tr->append_tag_to_content(new HTMLTags_TH('Task Event ID'));
$tasks_tr->append_tag_to_content(new HTMLTags_TH('Host'));
$tasks_tr->append_tag_to_content(new HTMLTags_TH('System'));
$tasks_tr->append_tag_to_content(new HTMLTags_TH('Task'));
$tasks_tr->append_tag_to_content(new HTMLTags_TH('Start'));
$tasks_table->append_tag_to_content($tasks_tr);
$current_task_events = $control_centre->get_current_task_events();
foreach ($current_task_events as $current_task_event) {
    $tasks_tr = new HTMLTags_TR();
    $tasks_tr->append_tag_to_content(new HTMLTags_TD($current_task_event->get('ps_task_events.id')));
 *
 * @copyright Clear Line Web Design, 2007-03-28
 */
/*
 * Define the necessary classes.
 */
require_once PROJECT_ROOT . '/haddock/database/classes/' . 'Database_MySQLUserFactory.inc.php';
require_once PROJECT_ROOT . '/haddock/haddock-project-organisation/classes/' . 'HaddockProjectOrganisation_ProjectDirectoryFinder.inc.php';
require_once PROJECT_ROOT . '/project-specific/classes/' . 'ServerAdminScripts_LocalControlCentre.inc.php';
/*
 * Start doing stuff.
 */
echo "# dumper status\n";
$project_directory_factory = HaddockProjectOrganisation_ProjectDirectoryFinder::get_instance();
$project_directory = $project_directory_factory->get_project_directory_for_this_project();
$control_centre = new ServerAdminScripts_LocalControlCentre();
/*
 * To start a dump.
 */
if (isset($_GET['start'])) {
    echo "# Starting ...\n";
    $task_event_id = $control_centre->start('dumping', 'mysql', $project_directory->get_current_host_name());
    echo "Task Event ID: {$task_event_id}\n";
}
/*
 * To finish a dump.
 */
if (isset($_GET['finish'])) {
    echo "# Finishing\n";
    $finish_datetime = $control_centre->finish($task_id);
}