Commit a1c901d2 authored by Guillaume Heurtier's avatar Guillaume Heurtier
Browse files

FEAT #17483 TIME 0:25 create jar files from default if they do not exists + rename to default

parent d0bbd0cd
......@@ -14,3 +14,10 @@ modules/convert/batch/scripts/launch_fulltext_letterbox.sh
modules/convert/batch/scripts/launch_convert_letterbox.sh
modules/convert/batch/config/config_only_indexes.xml
modules/convert/batch/tmp/
modules/content_management/dist/maarchCM.jar
modules/content_management/dist/lib/commons-logging-1.2.jar
modules/content_management/dist/lib/httpclient-4.5.2.jar
modules/content_management/dist/lib/httpclient-cache-4.5.2.jar
modules/content_management/dist/lib/httpclient-win-4.5.2.jar
modules/content_management/dist/lib/httpcore-4.4.4.jar
modules/content_management/dist/lib/plugin.jar
......@@ -487,6 +487,12 @@ abstract class content_management_tools_Abstract
$j2se_attribute->value = '1.6+';
$j2se_balise->appendChild($j2se_attribute);
$result = \ContentManagement\controllers\JnlpController::checkJarFile(['path' => 'modules/content_management/dist/maarchCM.jar']);
if (!empty($result['errors'])) {
echo $result['errors'];
return;
}
$jar_balise=$docXML->createElement("jar");
$jar_attribute = $docXML->createAttribute('href');
$jar_attribute->value = $jar_path.'/modules/content_management/dist/maarchCM.jar';
......@@ -496,31 +502,67 @@ abstract class content_management_tools_Abstract
$jar_balise->appendChild($jar_attribute);
//begin ext libs
$result = \ContentManagement\controllers\JnlpController::checkJarFile(['path' => 'modules/content_management/dist/lib/httpclient-4.5.2.jar']);
if (!empty($result['errors'])) {
echo $result['errors'];
return;
}
$jar_balise_1=$docXML->createElement("jar");
$jar_attribute = $docXML->createAttribute('href');
$jar_attribute->value = $jar_path.'/modules/content_management/dist/lib/httpclient-4.5.2.jar';
$jar_balise_1->appendChild($jar_attribute);
$result = \ContentManagement\controllers\JnlpController::checkJarFile(['path' => 'modules/content_management/dist/lib/httpclient-cache-4.5.2.jar']);
if (!empty($result['errors'])) {
echo $result['errors'];
return;
}
$jar_balise_2=$docXML->createElement("jar");
$jar_attribute = $docXML->createAttribute('href');
$jar_attribute->value = $jar_path.'/modules/content_management/dist/lib/httpclient-cache-4.5.2.jar';
$jar_balise_2->appendChild($jar_attribute);
$result = \ContentManagement\controllers\JnlpController::checkJarFile(['path' => 'modules/content_management/dist/lib/httpclient-win-4.5.2.jar']);
if (!empty($result['errors'])) {
echo $result['errors'];
return;
}
$jar_balise_3=$docXML->createElement("jar");
$jar_attribute = $docXML->createAttribute('href');
$jar_attribute->value = $jar_path.'/modules/content_management/dist/lib/httpclient-win-4.5.2.jar';
$jar_balise_3->appendChild($jar_attribute);
$result = \ContentManagement\controllers\JnlpController::checkJarFile(['path' => 'modules/content_management/dist/lib/httpcore-4.4.4.jar']);
if (!empty($result['errors'])) {
echo $result['errors'];
return;
}
$jar_balise_4=$docXML->createElement("jar");
$jar_attribute = $docXML->createAttribute('href');
$jar_attribute->value = $jar_path.'/modules/content_management/dist/lib/httpcore-4.4.4.jar';
$jar_balise_4->appendChild($jar_attribute);
$result = \ContentManagement\controllers\JnlpController::checkJarFile(['path' => 'modules/content_management/dist/lib/plugin.jar']);
if (!empty($result['errors'])) {
echo $result['errors'];
return;
}
$jar_balise_5=$docXML->createElement("jar");
$jar_attribute = $docXML->createAttribute('href');
$jar_attribute->value = $jar_path.'/modules/content_management/dist/lib/plugin.jar';
$jar_balise_5->appendChild($jar_attribute);
$result = \ContentManagement\controllers\JnlpController::checkJarFile(['path' => 'modules/content_management/dist/lib/commons-logging-1.2.jar']);
if (!empty($result['errors'])) {
echo $result['errors'];
return;
}
$jar_balise_6=$docXML->createElement("jar");
$jar_attribute = $docXML->createAttribute('href');
$jar_attribute->value = $jar_path.'/modules/content_management/dist/lib/commons-logging-1.2.jar';
......
......@@ -81,6 +81,11 @@ class JnlpController
$newAttribute->value = '1.6+';
$tagJ2se->appendChild($newAttribute);
$result = JnlpController::checkJarFile(['path' => 'modules/content_management/dist/maarchCM.jar']);
if (!empty($result['errors'])) {
return $response->withStatus(500)->withJson(['errors' => $result['errors']]);
}
$tagJar1 = $jnlpDocument->createElement('jar');
$newAttribute = $jnlpDocument->createAttribute('href');
$newAttribute->value = $coreUrl . '/modules/content_management/dist/maarchCM.jar';
......@@ -89,31 +94,61 @@ class JnlpController
$newAttribute->value = 'true';
$tagJar1->appendChild($newAttribute);
$result = JnlpController::checkJarFile(['path' => 'modules/content_management/dist/lib/httpclient-4.5.2.jar']);
if (!empty($result['errors'])) {
return $response->withStatus(500)->withJson(['errors' => $result['errors']]);
}
$tagJar2 = $jnlpDocument->createElement('jar');
$newAttribute = $jnlpDocument->createAttribute('href');
$newAttribute->value = $jarPath . '/modules/content_management/dist/lib/httpclient-4.5.2.jar';
$tagJar2->appendChild($newAttribute);
$result = JnlpController::checkJarFile(['path' => 'modules/content_management/dist/lib/httpclient-cache-4.5.2.jar']);
if (!empty($result['errors'])) {
return $response->withStatus(500)->withJson(['errors' => $result['errors']]);
}
$tagJar3 = $jnlpDocument->createElement('jar');
$newAttribute = $jnlpDocument->createAttribute('href');
$newAttribute->value = $jarPath . '/modules/content_management/dist/lib/httpclient-cache-4.5.2.jar';
$tagJar3->appendChild($newAttribute);
$result = JnlpController::checkJarFile(['path' => 'modules/content_management/dist/lib/httpclient-win-4.5.2.jar']);
if (!empty($result['errors'])) {
return $response->withStatus(500)->withJson(['errors' => $result['errors']]);
}
$tagJar4 = $jnlpDocument->createElement('jar');
$newAttribute = $jnlpDocument->createAttribute('href');
$newAttribute->value = $jarPath . '/modules/content_management/dist/lib/httpclient-win-4.5.2.jar';
$tagJar4->appendChild($newAttribute);
$result = JnlpController::checkJarFile(['path' => 'modules/content_management/dist/lib/httpcore-4.4.4.jar']);
if (!empty($result['errors'])) {
return $response->withStatus(500)->withJson(['errors' => $result['errors']]);
}
$tagJar5 = $jnlpDocument->createElement('jar');
$newAttribute = $jnlpDocument->createAttribute('href');
$newAttribute->value = $jarPath . '/modules/content_management/dist/lib/httpcore-4.4.4.jar';
$tagJar5->appendChild($newAttribute);
$result = JnlpController::checkJarFile(['path' => 'modules/content_management/dist/lib/plugin.jar']);
if (!empty($result['errors'])) {
return $response->withStatus(500)->withJson(['errors' => $result['errors']]);
}
$tagJar6 = $jnlpDocument->createElement('jar');
$newAttribute = $jnlpDocument->createAttribute('href');
$newAttribute->value = $jarPath . '/modules/content_management/dist/lib/plugin.jar';
$tagJar6->appendChild($newAttribute);
$result = JnlpController::checkJarFile(['path' => 'modules/content_management/dist/lib/commons-logging-1.2.jar']);
if (!empty($result['errors'])) {
return $response->withStatus(500)->withJson(['errors' => $result['errors']]);
}
$tagJar7 = $jnlpDocument->createElement('jar');
$newAttribute = $jnlpDocument->createAttribute('href');
$newAttribute->value = $jarPath . '/modules/content_management/dist/lib/commons-logging-1.2.jar';
......@@ -344,4 +379,23 @@ class JnlpController
return $response->saveXML();
}
public static function checkJarFile(array $args)
{
ValidatorModel::notEmpty($args, ['path']);
ValidatorModel::stringType($args, ['path']);
if (!is_file($args['path'])) {
if (!is_file($args['path'] . '.default')) {
return ['errors' => 'File ' . $args . '.default not found'];
}
$content = file_get_contents($args['path'] . '.default');
$result = file_put_contents($args['path'], $content);
if ($result === false) {
return ['errors' => 'Failed to create ' . $args['path'] . ' from default'];
}
}
return true;
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment