Adding some fixes and improvements to Controller::Installer::buildParternExtras() method

This commit is contained in:
Erik Amaru Ortiz
2013-04-16 06:35:57 -04:00
parent f20f6ff08f
commit 727909ff60

View File

@@ -838,20 +838,19 @@ class Installer extends Controller
// getting configuration from env.ini
$sysConf = System::getSystemConfiguration( $envFile );
try {
// update the main index file
$indexFileUpdated = System::updateIndexFile( array ('lang' => 'en','skin' => $updatedConf['default_skin']
) );
} catch (Exception $e) {
$info->result = false;
$info->message = G::LoadTranslation('ID_PROCESSMAKER_WRITE_CONFIG_INDEX', SYS_LANG, Array(PATH_HTML . "index.html."));
$info->message .= G::LoadTranslation('ID_PROCESSMAKER_UI_NOT_INSTALL');
$this->installLog( G::LoadTranslation('ID_INSTALL_BUT_ERROR', SYS_LANG, Array('index.html')));
return $info;
}
if (defined('PARTNER_FLAG') || isset($_REQUEST['PARTNER_FLAG'])) {
$this->buildParternExtras($db_username, $db_password, $_REQUEST['workspace'], SYS_LANG);
} else {
try {
// update the main index file
$indexFileUpdated = System::updateIndexFile(array('lang' => 'en','skin' => $updatedConf['default_skin']));
} catch (Exception $e) {
$info->result = false;
$info->message = G::LoadTranslation('ID_PROCESSMAKER_WRITE_CONFIG_INDEX', SYS_LANG, Array(PATH_HTML . "index.html."));
$info->message .= G::LoadTranslation('ID_PROCESSMAKER_UI_NOT_INSTALL');
$this->installLog( G::LoadTranslation('ID_INSTALL_BUT_ERROR', SYS_LANG, Array('index.html')));
return $info;
}
}
$this->installLog( G::LoadTranslation('ID_INDEX_FILE_UPDATED', SYS_LANG, Array($indexFileUpdated, $sysConf['default_lang'],$sysConf['default_skin'])));
@@ -1328,20 +1327,18 @@ class Installer extends Controller
// create session
$cookiefile = '/tmp/curl-session';
$cookiefile = sys_get_temp_dir() . PATH_SEP . 'curl-session';
$fp = fopen($cookiefile, "w");
fclose($fp);
chmod($cookiefile, 0777);
$user = urlencode($username);
$pass = urlencode($password);
$lang = urlencode($lang);
$ch = curl_init();
//die("$serv/sys{$workspace}/{$lang}/classic/login/authentication");
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "$serv/sys{$workspace}/{$lang}/classic/login/authentication");
curl_setopt($ch, CURLOPT_HEADER, 0);
@@ -1351,7 +1348,7 @@ class Installer extends Controller
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, "form[USR_USERNAME]=$user&form[USR_PASSWORD]=$pass&form[USER_LANG]=$lang");
//curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_TIMEOUT, 90);
$output = curl_exec($ch);
curl_close($ch);
@@ -1374,7 +1371,7 @@ class Installer extends Controller
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_TIMEOUT, 90);
// grab URL and pass it to the browser
@@ -1391,27 +1388,53 @@ class Installer extends Controller
$plugins = glob(PATH_CORE."plugins/*.tar");
if (count($plugins) > 0) {
$pluginName = $plugins[0];
var_dump($pluginName);
var_dump("$serv/sys{$workspace}/{$lang}/classic/setup/pluginsImportFile");
// File you want to upload/post
$postData['form[PLUGIN_FILENAME]'] = "@{$pluginName}";
//http://pmos/sysworkflow/en/classic/setup/skin_Ajax
curl_setopt($ch, CURLOPT_URL, "$serv/sys{$workspace}/{$lang}/classic/setup/pluginsImportFile");
//curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_VERBOSE, 0);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiefile);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookiefile);
//curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
curl_setopt($ch, CURLOPT_POST, true);
//curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
//curl_setopt($ch, CURLOPT_TIMEOUT, 90);
curl_setopt($ch, CURLOPT_TIMEOUT, 90);
// grab URL and pass it to the browser
echo $output = curl_exec($ch);
curl_close($ch);
}
$ch = curl_init();
$skins = glob(PATH_CORE."data/partner/*.tar");
if (count($skins) > 0) {
$skin = $skins[0];
$postData['overwrite_files'] = "on";
$postData['workspace'] = "global";
$postData['option'] = "standardupload";
$postData['action'] = "importSkin";
// File you want to upload/post
$postData['uploadedFile'] = "@".$skin;
curl_setopt($ch, CURLOPT_URL, "$serv/sys{$workspace}/{$lang}/classic/setup/skin_Ajax");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_VERBOSE, 0);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiefile);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookiefile);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
curl_setopt($ch, CURLOPT_TIMEOUT, 90);
// grab URL and pass it to the browser
echo $output = curl_exec($ch);
curl_close($ch);
}
}
}