Files
luos/workflow/engine/methods/login/licenseUpdate.php

56 lines
2.3 KiB
PHP
Raw Normal View History

<?php
$aInfoLoadFile = array();
$aInfoLoadFile['name'] = $_FILES['form']['name']['licenseFile'];
$aInfoLoadFile['tmp_name'] = $_FILES['form']['tmp_name']['licenseFile'];
$aux = pathinfo($aInfoLoadFile['name']);
//validating the extention before to upload it
if ($aux['extension'] != 'dat') {
G::SendTemporalMessage('ID_WARNING_ENTERPRISE_LICENSE_MSG_DAT', 'warning');
} else {
$dir = PATH_DATA_SITE;
G::uploadFile($aInfoLoadFile["tmp_name"], $dir, $aInfoLoadFile["name"]);
//reading the file that was uploaded
$licenseManager =& pmLicenseManager::getSingleton();
$response = $licenseManager->installLicense($dir . $aInfoLoadFile["name"], false, false);
if ($response) {
$licenseManager = new pmLicenseManager();
preg_match("/^license_(.*).dat$/", $licenseManager->file, $matches);
$realId = urlencode($matches[1]);
2015-05-10 16:32:01 -04:00
$workspace = (isset($licenseManager->workspace)) ? $licenseManager->workspace : 'pmLicenseSrv';
2015-05-10 16:32:01 -04:00
$addonLocation = "http://{$licenseManager->server}/sys".$workspace."/en/green/services/addonsStore?action=getInfo&licId=$realId";
///////
$cnn = Propel::getConnection("workflow");
$oCriteriaSelect = new Criteria("workflow");
$oCriteriaSelect->add(AddonsStorePeer::STORE_ID, $licenseManager->id);
$oCriteriaUpdate = new Criteria("workflow");
$oCriteriaUpdate->add(AddonsStorePeer::STORE_ID, $licenseManager->id);
$oCriteriaUpdate->add(AddonsStorePeer::STORE_LOCATION, $addonLocation);
BasePeer::doUpdate($oCriteriaSelect, $oCriteriaUpdate, $cnn);
2017-07-26 16:15:32 -04:00
//are all the plugins that are enabled in the workspace
2017-08-01 12:16:06 -04:00
$pluginRegistry = ProcessMaker\Plugins\PluginRegistry::loadSingleton();
/** @var \ProcessMaker\Plugins\Interfaces\PluginDetail $plugin */
foreach ($pluginRegistry->getPlugins() as $plugin) {
2017-08-04 09:32:25 -04:00
if ($plugin->enabled && !in_array($plugin->sNamespace, $licenseManager->features)) {
$pluginRegistry->disablePlugin($plugin->sNamespace);
$pluginRegistry->savePlugin($plugin->sNamespace);
2017-07-26 16:15:32 -04:00
}
}
G::SendTemporalMessage('ID_NLIC', 'info');
} else {
G::SendTemporalMessage('ID_WARNING_ENTERPRISE_LICENSE_MSG', 'warning');
}
}
G::header('Location: ../login/login');
die();