XarayaTranslationMemory  1.6
import.php
Go to the documentation of this file.
1 #!/usr/bin/php
2 <?php
3 /***************************************************************************
4  * Copyright (C) 2005-2020 by Ferenc Veres *
5  * lion@netngine.hu *
6  * *
7  * This program is free software; you can redistribute it and/or modify *
8  * it under the terms of the GNU General Public License as published by *
9  * the Free Software Foundation; either version 3 of the License, or *
10  * (at your option) any later version. *
11  * *
12  * This program is distributed in the hope that it will be useful, *
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15  * GNU General Public License for more details. *
16  * *
17  * You should have received a copy of the GNU General Public License *
18  * along with this program. If not, see <http://www.gnu.org/licenses/>. *
19  ***************************************************************************/
20 if(empty($argc))
21 {
22  exit;
23 }
24 include_once('config.inc.php');
25 include_once('import/TranslationImport.php');
26 include_once('lib/Common.php');
27 
28 $DB = NewADOConnection(GetConfigVar('db_software'));
29 $DB->Connect(GetConfigVar('db_host'), GetConfigVar('db_username') , GetConfigVar('db_password'), GetConfigVar('db_database'));
30 $DB->Execute("SET NAMES utf8");
31 CacheIndexes();
32 
33 // To import a translaiton
35 
36 // Check args count and print help if too few
37 if($argc != 3 || empty(TranslationProject::$LocaleIDCache[$argv[1]]))
38 {
39  echo "Usage: import.php localename projecttype\n";
40  echo "Known locales:\n";
41  foreach(TranslationProject::$LocaleIDCache as $name => $id)
42  {
43  echo " $name\n";
44  }
45  echo "Known project types:\n";
46  foreach($factory->GetProjectTypes() as $name)
47  {
48  echo " $name\n";
49  }
50  exit;
51 }
52 
53 $proc = $factory->NewImporter($argv[2]);
54 $proc->Import($argv[1]);
55 
56 ?>
$DB
Definition: import.php:28
CacheIndexes()
Definition: Common.php:94
if($argc !=3||empty(TranslationProject::$LocaleIDCache[$argv[1]])) $proc
Definition: import.php:53
GetConfigVar($varName)
Definition: Common.php:84
$factory
Definition: import.php:34