mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
Merge remote-tracking branch 'origin/support/2.7' into develop
This commit is contained in:
@@ -280,7 +280,7 @@ ij_javascript_while_brace_force = always
|
|||||||
ij_javascript_while_on_new_line = false
|
ij_javascript_while_on_new_line = false
|
||||||
ij_javascript_wrap_comments = false
|
ij_javascript_wrap_comments = false
|
||||||
|
|
||||||
[{*.ctp,*.hphp,*.inc,*.module,*.php,*.php4,*.php5,*.phtml}]
|
[{*.ctp, *.hphp, *.inc, *.module, *.php, *.php4, *.php5, *.phtml}]
|
||||||
indent_style = tab
|
indent_style = tab
|
||||||
ij_continuation_indent_size = 4
|
ij_continuation_indent_size = 4
|
||||||
ij_smart_tabs = true
|
ij_smart_tabs = true
|
||||||
@@ -289,8 +289,8 @@ ij_php_align_assignments = false
|
|||||||
ij_php_align_class_constants = false
|
ij_php_align_class_constants = false
|
||||||
ij_php_align_group_field_declarations = false
|
ij_php_align_group_field_declarations = false
|
||||||
ij_php_align_inline_comments = false
|
ij_php_align_inline_comments = false
|
||||||
ij_php_align_key_value_pairs = false
|
ij_php_align_key_value_pairs = true
|
||||||
ij_php_align_multiline_array_initializer_expression = false
|
ij_php_align_multiline_array_initializer_expression = true
|
||||||
ij_php_align_multiline_binary_operation = false
|
ij_php_align_multiline_binary_operation = false
|
||||||
ij_php_align_multiline_chained_methods = false
|
ij_php_align_multiline_chained_methods = false
|
||||||
ij_php_align_multiline_extends_list = false
|
ij_php_align_multiline_extends_list = false
|
||||||
|
|||||||
@@ -10,10 +10,6 @@
|
|||||||
* `curl -L -o /usr/bin/jq.exe https://github.com/stedolan/jq/releases/latest/download/jq-win64.exe`
|
* `curl -L -o /usr/bin/jq.exe https://github.com/stedolan/jq/releases/latest/download/jq-win64.exe`
|
||||||
* this is a Windows port : https://stedolan.github.io/jq/
|
* this is a Windows port : https://stedolan.github.io/jq/
|
||||||
*
|
*
|
||||||
* Known bug on Windows :
|
|
||||||
* Licenses added from Composer contains a path in the product node (N°3870)
|
|
||||||
* `<product scope="lib">C:\Dev\wamp64\www\itop-dev\.make\license/../..//lib/symfony/console</product>`
|
|
||||||
*
|
|
||||||
* Licenses sources :
|
* Licenses sources :
|
||||||
* * `composer licenses --format json` (see https://getcomposer.org/doc/03-cli.md#licenses)
|
* * `composer licenses --format json` (see https://getcomposer.org/doc/03-cli.md#licenses)
|
||||||
* * keep every existing nodes with `/licenses/license[11]/product/@scope` not in ['lib', 'datamodels']
|
* * keep every existing nodes with `/licenses/license[11]/product/@scope` not in ['lib', 'datamodels']
|
||||||
@@ -70,39 +66,83 @@ function get_license_nodes($file_path)
|
|||||||
$xp = new DOMXPath($dom);
|
$xp = new DOMXPath($dom);
|
||||||
|
|
||||||
$licenseList = $xp->query('/licenses/license');
|
$licenseList = $xp->query('/licenses/license');
|
||||||
$licenses = iterator_to_array($licenseList);
|
$licenses = iterator_to_array($licenseList);
|
||||||
|
|
||||||
usort($licenses, 'sort_by_product');
|
usort($licenses, 'sort_by_product');
|
||||||
|
|
||||||
return $licenses;
|
return $licenses;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @noinspection SuspiciousAssignmentsInspection */
|
||||||
|
function fix_product_name(DOMNode &$oProductNode)
|
||||||
|
{
|
||||||
|
$sProductNameOrig = $oProductNode->nodeValue;
|
||||||
|
|
||||||
|
// sample : `C:\Dev\wamp64\www\itop-27\.make\license/../..//lib/symfony/polyfill-ctype`
|
||||||
|
$sProductNameFixed = remove_dir_from_string($sProductNameOrig, 'lib/');
|
||||||
|
|
||||||
|
// sample : `C:\Dev\wamp64\www\itop-27\.make\license/../..//datamodels/2.x/authent-cas/vendor/apereo/phpcas`
|
||||||
|
$sProductNameFixed = remove_dir_from_string($sProductNameFixed, 'vendor/');
|
||||||
|
|
||||||
|
$oProductNode->nodeValue = $sProductNameFixed;
|
||||||
|
}
|
||||||
|
|
||||||
|
function remove_dir_from_string($sString, $sNeedle)
|
||||||
|
{
|
||||||
|
if (strpos($sString, $sNeedle) === false) {
|
||||||
|
return $sString;
|
||||||
|
}
|
||||||
|
|
||||||
|
$sStringTmp = strstr($sString, $sNeedle);
|
||||||
|
$sStringFixed = str_replace($sNeedle, '', $sStringTmp);
|
||||||
|
|
||||||
|
// DEBUG trace O:)
|
||||||
|
// echo "$sNeedle = $sString => $sStringFixed\n";
|
||||||
|
|
||||||
|
return $sStringFixed;
|
||||||
|
}
|
||||||
|
|
||||||
$old_licenses = get_license_nodes($xmlFilePath);
|
$old_licenses = get_license_nodes($xmlFilePath);
|
||||||
|
|
||||||
//generate file with updated licenses
|
//generate file with updated licenses
|
||||||
$generated_license_file_path = __DIR__."/provfile.xml";
|
$generated_license_file_path = __DIR__."/provfile.xml";
|
||||||
exec("bash " . __DIR__ . "/gen-community-license.sh $iTopFolder > ". $generated_license_file_path);
|
echo "- Generating licences...";
|
||||||
|
exec("bash ".__DIR__."/gen-community-license.sh $iTopFolder > ".$generated_license_file_path);
|
||||||
|
echo "OK!\n";
|
||||||
|
|
||||||
|
echo "- Get licenses nodes...";
|
||||||
$new_licenses = get_license_nodes($generated_license_file_path);
|
$new_licenses = get_license_nodes($generated_license_file_path);
|
||||||
exec("rm -f ". $generated_license_file_path);
|
unlink($generated_license_file_path);
|
||||||
|
|
||||||
foreach ($old_licenses as $b) {
|
foreach ($old_licenses as $b) {
|
||||||
$aProductNode = get_product_node($b);
|
$aProductNode = get_product_node($b);
|
||||||
|
|
||||||
if (get_scope($aProductNode) !== "lib" && get_scope($aProductNode) !== "datamodels" )
|
if (get_scope($aProductNode) !== "lib" && get_scope($aProductNode) !== "datamodels") {
|
||||||
{
|
|
||||||
$new_licenses[] = $b;
|
$new_licenses[] = $b;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
usort($new_licenses, 'sort_by_product');
|
usort($new_licenses, 'sort_by_product');
|
||||||
|
echo "OK!\n";
|
||||||
|
|
||||||
|
echo "- Overwritting Combodo license file...";
|
||||||
$new_dom = new DOMDocument("1.0");
|
$new_dom = new DOMDocument("1.0");
|
||||||
$new_dom->formatOutput = true;
|
$new_dom->formatOutput = true;
|
||||||
$root = $new_dom->createElement("licenses");
|
$root = $new_dom->createElement("licenses");
|
||||||
$new_dom->appendChild($root);
|
$new_dom->appendChild($root);
|
||||||
|
|
||||||
foreach ($new_licenses as $b) {
|
foreach ($new_licenses as $b) {
|
||||||
$node = $new_dom->importNode($b,true);
|
$node = $new_dom->importNode($b, true);
|
||||||
$root->appendChild($new_dom->importNode($b,true));
|
|
||||||
|
// N°3870 fix when running script in Windows
|
||||||
|
// fix should be in gen-community-license.sh but it is easier to do it here !
|
||||||
|
if (strncasecmp(PHP_OS, 'WIN', 3) === 0) {
|
||||||
|
$oProductNodeOrig = get_product_node($node);
|
||||||
|
fix_product_name($oProductNodeOrig);
|
||||||
|
}
|
||||||
|
|
||||||
|
$root->appendChild($node);
|
||||||
}
|
}
|
||||||
|
|
||||||
$new_dom->save($xmlFilePath);
|
$new_dom->save($xmlFilePath);
|
||||||
|
echo "OK!\n";
|
||||||
@@ -71,7 +71,7 @@ class MFCompiler
|
|||||||
* @var string
|
* @var string
|
||||||
* @since 2.7.5 3.0.0 N°4020
|
* @since 2.7.5 3.0.0 N°4020
|
||||||
*/
|
*/
|
||||||
public const REBUILD_HKEYS_NEVER= APPROOT.'data/.setup-rebuild-hkeys-never';
|
const REBUILD_HKEYS_NEVER = APPROOT.'data/.setup-rebuild-hkeys-never';
|
||||||
|
|
||||||
/** @var \ModelFactory */
|
/** @var \ModelFactory */
|
||||||
protected $oFactory;
|
protected $oFactory;
|
||||||
|
|||||||
@@ -1013,8 +1013,8 @@ class SetupUtils
|
|||||||
$oPage, $bIsItopInstall, $sDBServer, $sDBUser, $sDBPwd, $sDBName, $sDBPrefix, $bTlsEnabled, $sTlsCA,
|
$oPage, $bIsItopInstall, $sDBServer, $sDBUser, $sDBPwd, $sDBName, $sDBPrefix, $bTlsEnabled, $sTlsCA,
|
||||||
$sNewDBName = ''
|
$sNewDBName = ''
|
||||||
) {
|
) {
|
||||||
$sWikiVersion = utils::GetItopVersionWikiSyntax(); //eg : '2_7_0';
|
$sWikiVersion = utils::GetItopVersionWikiSyntax(); //eg : '2_7_0';
|
||||||
$sMysqlTlsWikiPageUrl = 'https://wiki.openitop.org/doku.php?id='.$sWikiVersion.':install:php_and_mysql_tls';
|
$sMysqlTlsWikiPageUrl = 'https://www.itophub.io/wiki/page?id='.$sWikiVersion.':install:php_and_mysql_tls';
|
||||||
|
|
||||||
$oPage->add('<tr><td colspan="2">');
|
$oPage->add('<tr><td colspan="2">');
|
||||||
$oPage->add('<fieldset><legend>Database Server Connection</legend>');
|
$oPage->add('<fieldset><legend>Database Server Connection</legend>');
|
||||||
@@ -1023,13 +1023,15 @@ class SetupUtils
|
|||||||
//-- DB connection params
|
//-- DB connection params
|
||||||
$oPage->add('<tbody>');
|
$oPage->add('<tbody>');
|
||||||
$oPage->add('<tr><td>Server Name:</td><td><input id="db_server" type="text" name="db_server" value="'.htmlentities($sDBServer, ENT_QUOTES, 'UTF-8').'" size="15"/></td><td>E.g. "localhost", "dbserver.mycompany.com" or "192.142.10.23"</td></tr>');
|
$oPage->add('<tr><td>Server Name:</td><td><input id="db_server" type="text" name="db_server" value="'.htmlentities($sDBServer, ENT_QUOTES, 'UTF-8').'" size="15"/></td><td>E.g. "localhost", "dbserver.mycompany.com" or "192.142.10.23"</td></tr>');
|
||||||
$oPage->add('<tr><td>Login:</td><td><input id="db_user" type="text" name="db_user" value="'.htmlentities($sDBUser, ENT_QUOTES, 'UTF-8').'" size="15"/></td><td rowspan="2" style="vertical-align:top">The account must have the following privileges on the database: SELECT, INSERT, UPDATE, DELETE, DROP, CREATE, ALTER, CREATE VIEW, SHOW VIEW, LOCK TABLE, SUPER, TRIGGER</td></tr>');
|
$oPage->add('<tr><td>Login:</td><td><input id="db_user" type="text" name="db_user" value="'
|
||||||
|
.htmlentities($sDBUser, ENT_QUOTES, 'UTF-8')
|
||||||
|
.'" size="15"/></td><td rowspan="2" style="vertical-align:top">The account must have the following privileges on the database: SELECT, INSERT, UPDATE, DELETE, DROP, CREATE, ALTER, CREATE VIEW, SHOW VIEW, LOCK TABLE, SUPER, TRIGGER</td></tr>');
|
||||||
$oPage->add('<tr><td>Password:</td><td><input id="db_pwd" autocomplete="off" type="password" name="db_pwd" value="'.htmlentities($sDBPwd, ENT_QUOTES, 'UTF-8').'" size="15"/></td></tr>');
|
$oPage->add('<tr><td>Password:</td><td><input id="db_pwd" autocomplete="off" type="password" name="db_pwd" value="'.htmlentities($sDBPwd, ENT_QUOTES, 'UTF-8').'" size="15"/></td></tr>');
|
||||||
$oPage->add('</tbody>');
|
$oPage->add('</tbody>');
|
||||||
|
|
||||||
//-- TLS params (N°1260)
|
//-- TLS params (N°1260)
|
||||||
$sTlsEnabledChecked = $bTlsEnabled ? ' checked' : '';
|
$sTlsEnabledChecked = $bTlsEnabled ? ' checked' : '';
|
||||||
$sTlsCaDisabled = $bTlsEnabled ? '' : ' disabled';
|
$sTlsCaDisabled = $bTlsEnabled ? '' : ' disabled';
|
||||||
$oPage->add('<tbody id="tls_options" class="collapsable-options">');
|
$oPage->add('<tbody id="tls_options" class="collapsable-options">');
|
||||||
$oPage->add('<tr><th colspan="3" style="text-align: left; background-color: transparent"><label style="margin: 6em; font-weight: normal; color: #696969"><img style="vertical-align:bottom" id="db_tls_img">Use TLS encrypted connection</label></th></tr>');
|
$oPage->add('<tr><th colspan="3" style="text-align: left; background-color: transparent"><label style="margin: 6em; font-weight: normal; color: #696969"><img style="vertical-align:bottom" id="db_tls_img">Use TLS encrypted connection</label></th></tr>');
|
||||||
$oPage->add('<tr style="display:none"><td colspan="3" class="message message-error">Before configuring MySQL with TLS encryption, read the documentation <a href="'.$sMysqlTlsWikiPageUrl.'" target="_blank">on Combodo\'s Wiki</a></td></tr>');
|
$oPage->add('<tr style="display:none"><td colspan="3" class="message message-error">Before configuring MySQL with TLS encryption, read the documentation <a href="'.$sMysqlTlsWikiPageUrl.'" target="_blank">on Combodo\'s Wiki</a></td></tr>');
|
||||||
@@ -1273,39 +1275,38 @@ EOF
|
|||||||
$aResult['checks'][] = new CheckResult(CheckResult::INFO, "Info - User privileges: ".($oDBSource->GetRawPrivileges()));
|
$aResult['checks'][] = new CheckResult(CheckResult::INFO, "Info - User privileges: ".($oDBSource->GetRawPrivileges()));
|
||||||
|
|
||||||
$bHasDbVersionRequired = self::CheckDbServerVersion($aResult, $oDBSource);
|
$bHasDbVersionRequired = self::CheckDbServerVersion($aResult, $oDBSource);
|
||||||
if (!$bHasDbVersionRequired)
|
if (!$bHasDbVersionRequired) {
|
||||||
{
|
|
||||||
return $aResult;
|
return $aResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check some server variables
|
// Check some server variables
|
||||||
$iMaxAllowedPacket = $oDBSource->GetServerVariable('max_allowed_packet');
|
$iMaxAllowedPacket = $oDBSource->GetServerVariable('max_allowed_packet');
|
||||||
$iMaxUploadSize = utils::ConvertToBytes(ini_get('upload_max_filesize'));
|
$sMaxAllowedPacketFriendly = utils::BytesToFriendlyFormat($iMaxAllowedPacket);
|
||||||
|
$iMaxUploadSize = utils::ConvertToBytes(ini_get('upload_max_filesize'));
|
||||||
|
$sMaxUploadSizeFriendly = utils::BytesToFriendlyFormat($iMaxUploadSize);
|
||||||
if ($iMaxAllowedPacket >= (500 + $iMaxUploadSize)) // Allow some space for the query + the file to upload
|
if ($iMaxAllowedPacket >= (500 + $iMaxUploadSize)) // Allow some space for the query + the file to upload
|
||||||
{
|
{
|
||||||
$aResult['checks'][] = new CheckResult(CheckResult::INFO, "MySQL server's max_allowed_packet ($iMaxAllowedPacket) is big enough compared to upload_max_filesize ($iMaxUploadSize).");
|
$aResult['checks'][] = new CheckResult(CheckResult::INFO, "MySQL server's max_allowed_packet ($sMaxAllowedPacketFriendly) is big enough compared to upload_max_filesize ($sMaxUploadSizeFriendly).");
|
||||||
}
|
} else if ($iMaxAllowedPacket < $iMaxUploadSize) {
|
||||||
else if($iMaxAllowedPacket < $iMaxUploadSize)
|
$sWikiVersion = utils::GetItopVersionWikiSyntax(); //eg : '2_7_0';
|
||||||
{
|
$sAttachmentsVarsWikiPageUrl = 'https://www.itophub.io/wiki/page?id='.$sWikiVersion
|
||||||
$aResult['checks'][] = new CheckResult(CheckResult::WARNING, "MySQL server's max_allowed_packet ($iMaxAllowedPacket) is not big enough. Please, consider setting it to at least ".(500 + $iMaxUploadSize).".");
|
.':install:php_and_mysql_configuration#attachments_upload';
|
||||||
|
|
||||||
|
$aResult['checks'][] = new CheckResult(CheckResult::WARNING,
|
||||||
|
"MySQL server's max_allowed_packet ($sMaxAllowedPacketFriendly) is not big enough compared to upload_max_filesize ($sMaxUploadSizeFriendly), whereas it should has a greater value. Consider increasing its value of at least 500KB. See the <a href=\"$sAttachmentsVarsWikiPageUrl\">documentation</a> for details.");
|
||||||
}
|
}
|
||||||
|
|
||||||
$iMaxConnections = $oDBSource->GetServerVariable('max_connections');
|
$iMaxConnections = $oDBSource->GetServerVariable('max_connections');
|
||||||
if ($iMaxConnections < 5)
|
if ($iMaxConnections < 5) {
|
||||||
{
|
|
||||||
$aResult['checks'][] = new CheckResult(CheckResult::WARNING, "MySQL server's max_connections ($iMaxConnections) is not enough. Please, consider setting it to at least 5.");
|
$aResult['checks'][] = new CheckResult(CheckResult::WARNING, "MySQL server's max_connections ($iMaxConnections) is not enough. Please, consider setting it to at least 5.");
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$aResult['checks'][] = new CheckResult(CheckResult::INFO, "MySQL server's max_connections is set to $iMaxConnections.");
|
$aResult['checks'][] = new CheckResult(CheckResult::INFO, "MySQL server's max_connections is set to $iMaxConnections.");
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
$aResult['databases'] = $oDBSource->ListDB();
|
$aResult['databases'] = $oDBSource->ListDB();
|
||||||
}
|
}
|
||||||
catch(Exception $e)
|
catch (Exception $e) {
|
||||||
{
|
|
||||||
$aResult['databases'] = null;
|
$aResult['databases'] = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -569,10 +569,10 @@ class UtilsTest extends \Combodo\iTop\Test\UnitTest\ItopTestCase
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'123 int value' => ['123', 123],
|
'123 int value' => ['123', 123],
|
||||||
'-1 no limit' => ['-1', -1],
|
'-1 no limit' => ['-1', -1],
|
||||||
'56k' => ['56k', 56 * 1024],
|
'56k' => ['56k', 56 * 1024],
|
||||||
'512M' => ['512M', 512 * 1024 * 1024],
|
'512M' => ['512M', 512 * 1024 * 1024],
|
||||||
'2G' => ['2G', 2 * 1024 * 1024 * 1024],
|
'2G' => ['2G', 2 * 1024 * 1024 * 1024],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user