Feat(Core): handle multiple configuration#169
Conversation
This comment was marked as duplicate.
This comment was marked as duplicate.
|
I have too many devices in database ... I think I have to stop it ... At the moment I'm looking the log, it is collecting devices, I have advised that It seems slower that before, You can see how to collect several devices by second, however now: Each device take more than 2 or 3 seconds ... I'm not sure why ... |
|
I have stop it ... only 319 devices on 15 minutes ... I can't run it for all devices in database, there are thousands, I need collection name filter... |
|
I fixed the issue with the duplicate fields in the form. Regarding the collection timing, I’d prefer to handle that in a dedicated PR. For now, let’s finalize this one first, then implement the collection mechanism. After that, we’ll evaluate whether the collection times are acceptable and optimize them if needed. Best regards |
Totally agree! |
| Session::checkRight('config', UPDATE); | ||
|
|
||
| Html::header( | ||
| PluginSccmConfig::getTypeName(Session::getPluralNumber()), | ||
| '', | ||
| 'config', | ||
| 'PluginSccmMenu', | ||
| ); | ||
|
|
||
| $config = new PluginSccmConfig(); | ||
| if ($config->canView()) { | ||
| Search::show(PluginSccmConfig::class); | ||
| } else { | ||
| throw new AccessDeniedHttpException(); | ||
| } |
There was a problem hiding this comment.
Maybe:
| Session::checkRight('config', UPDATE); | |
| Html::header( | |
| PluginSccmConfig::getTypeName(Session::getPluralNumber()), | |
| '', | |
| 'config', | |
| 'PluginSccmMenu', | |
| ); | |
| $config = new PluginSccmConfig(); | |
| if ($config->canView()) { | |
| Search::show(PluginSccmConfig::class); | |
| } else { | |
| throw new AccessDeniedHttpException(); | |
| } | |
| Session::checkRight(PluginSccmConfig::$rightname, UPDATE); | |
| Session::checkRight(PluginSccmConfig::$rightname, READ); | |
| Html::header( | |
| PluginSccmConfig::getTypeName(Session::getPluralNumber()), | |
| '', | |
| 'config', | |
| 'PluginSccmMenu', | |
| ); | |
| Search::show(PluginSccmConfig::class); |
or create checkRightsAnd() in core
|
|
||
| $sccm_db = new PluginSccmSccmdb(); | ||
| if ($sccm_db->connect()) { | ||
| if ($sccm_db->connect($_POST['id'])) { |
There was a problem hiding this comment.
| if ($sccm_db->connect($_POST['id'])) { | |
| if ($sccm_db->connect((int) $_POST['id'])) { |
| mkdir($xml_root . '1', 0755, true); | ||
| } | ||
|
|
||
| foreach (glob($xml_root . '*.ocs') ?: [] as $file) { |
There was a problem hiding this comment.
safe\glob() never returns false
| foreach (glob($xml_root . '*.ocs') ?: [] as $file) { | |
| foreach (glob($xml_root . '*.ocs') as $file) { |
| mkdir(GLPI_PLUGIN_DOC_DIR . '/sccm/xml'); | ||
| } | ||
|
|
||
| // Migrate existing flat XML files to per-config subdirectory (config id=1) |
There was a problem hiding this comment.
The XML file migration occurs before the Migration object is created and before the PluginSccmConfig::install() method is called. If the database migration fails, the files will already have been moved and it will no longer be possible to undo the changes. Perhaps the order should be reversed: DB first, then files?
| $this->initForm($ID, $options); | ||
|
|
||
| $password = (new GLPIKey())->decrypt($this->fields['sccmdb_password'] ?? ''); | ||
| $url = ($this->fields['inventory_server_url'] ?: "Ex : " . $CFG_GLPI['url_base']) . '/front/inventory.php'; |
There was a problem hiding this comment.
| $url = ($this->fields['inventory_server_url'] ?: "Ex : " . $CFG_GLPI['url_base']) . '/front/inventory.php'; | |
| $url = ($this->fields['inventory_server_url'] ?: __('Example:') . ' ' . $CFG_GLPI['url_base']) . '/front/inventory.php'; |
| return true; | ||
| } | ||
|
|
||
| public static function isIdAutoIncrement() |
There was a problem hiding this comment.
| public static function isIdAutoIncrement() | |
| public static function isIdAutoIncrement(): bool |
| $fields = $DB->listFields('glpi_plugin_sccm_configs'); | ||
| if (isset($fields['id'])) { | ||
| $fieldData = $fields['id']; | ||
| $extra = is_object($fieldData) ? ($fieldData->Extra ?? $fieldData->extra ?? '') : ($fieldData['Extra'] ?? $fieldData['extra'] ?? ''); |
There was a problem hiding this comment.
Maybe:
| $extra = is_object($fieldData) ? ($fieldData->Extra ?? $fieldData->extra ?? '') : ($fieldData['Extra'] ?? $fieldData['extra'] ?? ''); | |
| $extra = $fields['id']['Extra'] ?? ''; |
| {{ fields.checkboxField( | ||
| 'use_auth_ntlm', | ||
| item.fields['use_auth_ntlm'], | ||
| __('Use NLTM authentication', 'sccm') |
There was a problem hiding this comment.
| __('Use NLTM authentication', 'sccm') | |
| __('Use NTLM authentication', 'sccm') |
| {{ fields.textField( | ||
| 'auth_info', | ||
| item.fields['auth_info'], | ||
| __('Value for spécific authentication', 'sccm') |
There was a problem hiding this comment.
| __('Value for spécific authentication', 'sccm') | |
| __('Value for specific authentication', 'sccm') |
| {% if not item.isNewItem() %} | ||
| {{ fields.nullField() }} | ||
| {% set btn_test %} | ||
| <form method="post" action="{{ path('/plugins/sccm/front/config.form.php') }}"> |
There was a problem hiding this comment.
Are we not already in a form?!

Checklist before requesting a review
Please delete options that are not relevant.
Description
Add the ability to handle multiple SCCM configurations.
Suggested replacement for #120
Screenshots (if appropriate):