blob: cecf5ec528ef63f9dae25be6bcaa041bd9c29149 [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
atoulmea5563692008-12-01 11:25:57 +000026$work_dir = "/tmp/babel-working/";
atoulme425b6c82008-11-24 14:00:27 +000027if (!($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");
atoulmea5563692008-12-01 11:25:57 +000041exec("mkdir -p $features_dir");
atoulme425b6c82008-11-24 14:00:27 +000042
atoulmecab9de92008-11-24 15:04:02 +000043foreach(ReleaseTrain::all() as $train) {
atoulmea5563692008-12-01 11:25:57 +000044 exec("mkdir -p $features_dir/$train->id");
atoulme425b6c82008-11-24 14:00:27 +000045 $output_dir_for_train = "$output_dir/$train->id/";
atoulmedfee65f2008-11-24 14:59:26 +000046 foreach(Language::all() as $lang) {
atoulme425b6c82008-11-24 14:00:27 +000047 $feature = new Feature($lang, $train, $tmp_dir, $output_dir_for_train);
48 $feature->generateAll();
atoulmea5563692008-12-01 11:25:57 +000049 $featureZip = $feature->zip("$features_dir/$train->id");
50 echo "Feature created here: $featureZip\n";
atoulme425b6c82008-11-24 14:00:27 +000051 }
52}