atoulme | 425b6c8 | 2008-11-24 14:00:27 +0000 | [diff] [blame] | 1 | <?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 | |
| 17 | ob_start(); |
| 18 | ini_set("memory_limit", "64M"); |
| 19 | define("BABEL_BASE_DIR", "../../"); |
| 20 | require(BABEL_BASE_DIR . "html/common_functions.php"); |
| 21 | require(BABEL_BASE_DIR . "classes/system/dbconnection.class.php"); |
| 22 | require(BABEL_BASE_DIR . "classes/system/feature.class.php"); |
| 23 | $dbc = new DBConnection(); |
| 24 | $dbh = $dbc->connect(); |
| 25 | |
| 26 | $work_dir = "/home/babel-working/"; |
| 27 | if (!($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 | |
| 39 | exec("rm -rf $work_context_dir*"); |
| 40 | exec("mkdir -p $output_dir"); |
| 41 | |
atoulme | dfee65f | 2008-11-24 14:59:26 +0000 | [diff] [blame^] | 42 | foreach($ReleaseTrain::all() as $train) { |
atoulme | 425b6c8 | 2008-11-24 14:00:27 +0000 | [diff] [blame] | 43 | $output_dir_for_train = "$output_dir/$train->id/"; |
atoulme | dfee65f | 2008-11-24 14:59:26 +0000 | [diff] [blame^] | 44 | foreach(Language::all() as $lang) { |
atoulme | 425b6c8 | 2008-11-24 14:00:27 +0000 | [diff] [blame] | 45 | $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 | } |