blob: 7721aee86a99353a77fef45651c66a9a97649371 [file] [log] [blame]
atoulme425b6c82008-11-24 14:00:27 +00001<?php
2/*******************************************************************************
3 * Copyright (c) 2007-2008 Eclipse Foundation and others.
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *
9 * Contributors:
10 * Antoine Toulme, Intalio Inc. bug 248845: Refactoring generate1.php into different files with a functional approach
11*******************************************************************************/
12
13/*
14 * Documentation: http://wiki.eclipse.org/Babel_/_Server_Tool_Specification#Outputs
15 */
16
17ob_start();
18ini_set("memory_limit", "64M");
19define("BABEL_BASE_DIR", "../../");
20require(BABEL_BASE_DIR . "html/common_functions.php");
21require(BABEL_BASE_DIR . "classes/system/dbconnection.class.php");
22require(BABEL_BASE_DIR . "classes/system/feature.class.php");
23$dbc = new DBConnection();
24$dbh = $dbc->connect();
25
26$work_dir = "/home/babel-working/";
27if (!($ini = @parse_ini_file(BABEL_BASE_DIR . "classes/base.conf"))) {
28 errorLog("Failed to find/read database conf file - aborting.");
29 exitTo("error.php?errNo=101300","error: 101300 - database conf can not be found");
30}
31
32$context = $ini['context'];
33
34$work_context_dir = $work_dir . $context . "_feature/";
35$tmp_dir = $work_context_dir . "tmp/";
36$output_dir = $work_context_dir . "output/";
37$features_dir = $work_context_dir . "features/";
38
39exec("rm -rf $work_context_dir*");
40exec("mkdir -p $output_dir");
41
atoulmedfee65f2008-11-24 14:59:26 +000042foreach($ReleaseTrain::all() as $train) {
atoulme425b6c82008-11-24 14:00:27 +000043 $output_dir_for_train = "$output_dir/$train->id/";
atoulmedfee65f2008-11-24 14:59:26 +000044 foreach(Language::all() as $lang) {
atoulme425b6c82008-11-24 14:00:27 +000045 $feature = new Feature($lang, $train, $tmp_dir, $output_dir_for_train);
46 $feature->generateAll();
47 $featureZip = $feature->zip($features_dir);
48 echo "Feature created here: $featureZip";
49 }
50}