moving the cache file translation.es location in ./workflow/engine/content/translation to shared directory to solve the problem in balanced environments and write permissions
This commit is contained in:
@@ -3020,6 +3020,11 @@ class G
|
||||
}
|
||||
return $infoUser;
|
||||
}
|
||||
|
||||
function getModel($model){
|
||||
require_once "classes/model/$model.php";
|
||||
return new $model();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -42,6 +42,12 @@ class Translation extends BaseTranslation {
|
||||
public static $meta;
|
||||
public static $localeSeparator = '-';
|
||||
|
||||
private $envFilePath;
|
||||
|
||||
function __construct(){
|
||||
$this->envFilePath = PATH_DATA . "META-INF" . PATH_SEP . "translations.env";
|
||||
}
|
||||
|
||||
function getAllCriteria(){
|
||||
|
||||
//SELECT * from TRANSLATION WHERE TRN_LANG = 'en' order by TRN_CATEGORY, TRN_ID
|
||||
@@ -150,7 +156,7 @@ class Translation extends BaseTranslation {
|
||||
|
||||
function addTranslationEnvironment($locale, $headers, $numRecords)
|
||||
{
|
||||
$filePath = PATH_LANGUAGECONT . "translations.environments";
|
||||
$filePath = $this->envFilePath;
|
||||
$environments = Array();
|
||||
|
||||
if( file_exists($filePath) ) {
|
||||
@@ -179,7 +185,7 @@ class Translation extends BaseTranslation {
|
||||
|
||||
function removeTranslationEnvironment($locale)
|
||||
{
|
||||
$filePath = PATH_LANGUAGECONT . "translations.environments";
|
||||
$filePath = $this->envFilePath;
|
||||
if( strpos($locale, self::$localeSeparator) !== false ) {
|
||||
list($LAN_ID, $IC_UID) = explode('-', strtoupper($locale));
|
||||
} else {
|
||||
@@ -198,22 +204,26 @@ class Translation extends BaseTranslation {
|
||||
}
|
||||
|
||||
function getTranslationEnvironments(){
|
||||
$filePath = PATH_LANGUAGECONT . "translations.environments";
|
||||
$filePath = $this->envFilePath;
|
||||
$envs = Array();
|
||||
|
||||
if( ! file_exists($filePath) ) {
|
||||
//the transaltions table file doesn't exist, then build it
|
||||
|
||||
if( ! is_dir(dirname($this->envFilePath)) )
|
||||
G::mk_dir(dirname($this->envFilePath));
|
||||
|
||||
$translationsPath = PATH_CORE . "content" . PATH_SEP . 'translations' . PATH_SEP;
|
||||
$basePOFile = $translationsPath . 'english' . PATH_SEP . 'processmaker.en.po';
|
||||
|
||||
$params = self::getInfoFromPOFile($basePOFile);
|
||||
self::addTranslationEnvironment($params['LOCALE'], $params['HEADERS'], $params['COUNT']);
|
||||
$this->addTranslationEnvironment($params['LOCALE'], $params['HEADERS'], $params['COUNT']);
|
||||
|
||||
//getting more lanuguage translations
|
||||
$files = glob($translationsPath . "*.po");
|
||||
foreach( $files as $file ){
|
||||
$params = self::getInfoFromPOFile($file);
|
||||
self::addTranslationEnvironment($params['LOCALE'], $params['HEADERS'], $params['COUNT']);
|
||||
$this->addTranslationEnvironment($params['LOCALE'], $params['HEADERS'], $params['COUNT']);
|
||||
}
|
||||
}
|
||||
$envs = unserialize(file_get_contents($filePath));
|
||||
@@ -286,7 +296,7 @@ class Translation extends BaseTranslation {
|
||||
}
|
||||
|
||||
function getTranslationEnvironment($locale){
|
||||
$filePath = PATH_LANGUAGECONT . "translations.environments";
|
||||
$filePath = $this->envFilePath;
|
||||
$environments = Array();
|
||||
|
||||
if( ! file_exists($filePath) ) {
|
||||
@@ -308,7 +318,7 @@ class Translation extends BaseTranslation {
|
||||
}
|
||||
|
||||
function saveTranslationEnvironment($locale, $data){
|
||||
$filePath = PATH_LANGUAGECONT . "translations.environments";
|
||||
$filePath = $this->envFilePath;
|
||||
$environments = Array();
|
||||
|
||||
if( ! file_exists($filePath) ) {
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
define( 'PATH_FIXTURES', PATH_TEST . 'fixtures' . PATH_SEP );
|
||||
define( 'PATH_RTFDOCS' , PATH_CORE . 'rtf_templates' . PATH_SEP );
|
||||
define( 'PATH_DYNACONT', PATH_CORE . 'content' . PATH_SEP . 'dynaform' . PATH_SEP );
|
||||
define( 'PATH_LANGUAGECONT',PATH_CORE . 'content' . PATH_SEP . 'languages' . PATH_SEP );
|
||||
//define( 'PATH_LANGUAGECONT',PATH_CORE . 'content' . PATH_SEP . 'languages' . PATH_SEP );
|
||||
define( 'SYS_UPLOAD_PATH', PATH_HOME . "public_html/files/" );
|
||||
define( 'PATH_UPLOAD', PATH_HTML . 'files' . PATH_SEP);
|
||||
define( 'PATH_WORKFLOW_MYSQL_DATA', PATH_CORE . 'data' . PATH_SEP.'mysql'.PATH_SEP);
|
||||
@@ -77,6 +77,8 @@
|
||||
}
|
||||
|
||||
require_once ( FILE_PATHS_INSTALLED );
|
||||
|
||||
define( 'PATH_LANGUAGECONT', PATH_DATA . "META-INF" . PATH_SEP );
|
||||
|
||||
// TODO: This path defines where to save temporal data, similar to $_SESSION.
|
||||
define( 'PATH_TEMPORAL', PATH_C . 'dynEditor/');
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
if (! isset ( $_GET ['u'] )) {
|
||||
$aFields ['URL'] = '';
|
||||
}
|
||||
@@ -89,8 +91,9 @@
|
||||
$_SESSION ['FAILED_LOGINS'] = $sFailedLogins;
|
||||
|
||||
//translation
|
||||
require_once "classes/model/Translation.php";
|
||||
$translationsTable = Translation::getTranslationEnvironments();
|
||||
$Translations = G::getModel("Translation");
|
||||
$translationsTable = $Translations->getTranslationEnvironments();
|
||||
|
||||
$availableLangArray = array ();
|
||||
$availableLangArray [] = array ('LANG_ID' => 'char', 'LANG_NAME' => 'char' );
|
||||
foreach ( $translationsTable as $locale ) {
|
||||
|
||||
@@ -77,11 +77,9 @@ function getWorkspacesAvailable() {
|
||||
}
|
||||
$availableWorkspace = getWorkspacesAvailable ();
|
||||
|
||||
require_once "classes/model/Translation.php";
|
||||
|
||||
$translationsTable = Translation::getTranslationEnvironments();
|
||||
//g::pr($translationsTable); die;
|
||||
//$availableLang = getLangFiles ();
|
||||
//Translations
|
||||
$Translations = G::getModel("Translation");
|
||||
$translationsTable = $Translations->getTranslationEnvironments();
|
||||
|
||||
$availableLangArray = array ();
|
||||
$availableLangArray [] = array ('LANG_ID' => 'char', 'LANG_NAME' => 'char' );
|
||||
|
||||
@@ -113,21 +113,18 @@
|
||||
|
||||
case 'getLangList':
|
||||
|
||||
require_once 'classes/model/Translation.php';
|
||||
$Translations = G::getModel('Translation');
|
||||
$result = new stdClass();
|
||||
$result->rows = Array();
|
||||
|
||||
|
||||
$langs = Translation::getTranslationEnvironments();
|
||||
$langs = $Translations->getTranslationEnvironments();
|
||||
foreach($langs as $lang){
|
||||
$result->rows[] = Array('LAN_ID'=>$lang['LOCALE'], 'LAN_NAME'=>$lang['LANGUAGE']);
|
||||
}
|
||||
//print_r($langs);
|
||||
//$result->rows = $lang->getActiveLanguages();
|
||||
|
||||
|
||||
print(G::json_encode($result));
|
||||
break;
|
||||
|
||||
|
||||
case 'build':
|
||||
$sqlToExe = Array();
|
||||
G::LoadClass('configuration');
|
||||
|
||||
@@ -51,7 +51,7 @@ try {
|
||||
$translationRow = new Translation();
|
||||
$response = new stdClass();
|
||||
$translationsEnvList = $translationRow->getTranslationEnvironments();
|
||||
|
||||
//print_r($translationsEnvList); die;
|
||||
$i = 0;
|
||||
foreach( $translationsEnvList as $locale=>$translationRow) {
|
||||
|
||||
|
||||
@@ -388,6 +388,21 @@ $startingTime = array_sum(explode(' ',microtime()));
|
||||
session_start();
|
||||
ob_start();
|
||||
|
||||
//Rebuild the base Workflow translations if not exists
|
||||
if( ! is_file(PATH_LANGUAGECONT . 'translation.en') ){
|
||||
require_once ( "classes/model/Translation.php" );
|
||||
$fields = Translation::generateFileTranslation('en');
|
||||
}
|
||||
//TODO: Verify if the language set into url is defined in translations env.
|
||||
if( SYS_LANG != 'en' && ! is_file(PATH_LANGUAGECONT . 'translation.' . SYS_LANG) ){
|
||||
require_once ( "classes/model/Translation.php" );
|
||||
$fields = Translation::generateFileTranslation(SYS_LANG);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//********* Setup plugins *************
|
||||
$oPluginRegistry->setupPlugins(); //get and setup enabled plugins
|
||||
$avoidChangedWorkspaceValidation = false;
|
||||
|
||||
Reference in New Issue
Block a user