You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2020-10-13 12:39:11

glpi.al
Member
Registered: 2012-10-16
Posts: 78

Webapplication plugin migration to GLPI 9.5.2 core

Hi,
migrating the webapplication plugin to the core doesn't mantain the "Associated Items" in the new "Item" tab.
Best Regards.

Offline

#2 2020-10-20 19:23:36

mboot59
Member
From: Zagreb, Croatia
Registered: 2017-10-20
Posts: 13

Re: Webapplication plugin migration to GLPI 9.5.2 core

yes i was about to complain about the same


glpi 946, plugins webApplications , fusionInventory, domains, appliances, additional fields. (experimented with many other plugins over the years)
authentication with ActiveDirectory. Long term user of glpi from the 8.x versions. centos7/centos8; mariadb

Offline

#3 2020-11-04 15:48:17

J2C99
Member
Registered: 2020-08-11
Posts: 105

Re: Webapplication plugin migration to GLPI 9.5.2 core

Yes, I confirm too

The column  helpdisk_item_type  from glpi_profiles is empty ,  it doesn't contains "PluginWebapplicationsWebapplication" or equivalence (normaly it must be Webapplication after the migration).
I'm looking for the table  with  the list of all  'Associated Items'.

Offline

#4 2020-12-04 19:39:21

mboot59
Member
From: Zagreb, Croatia
Registered: 2017-10-20
Posts: 13

Re: Webapplication plugin migration to GLPI 9.5.2 core

Before the update to 9.5  make a backup of the tables: with

<code>
<?php

// create backup of all glpi_plugin_webapplication tables

ini_set("memory_limit", "-1");
ini_set("max_execution_time", "0");

define("GLPI_ROOT", '/home/mboot/public_html/glpi');

include (GLPI_ROOT . '/inc/includes.php');

function backup_webapps() {
    global $DB;

    $migration = new Migration("");

    $sql = "
SHOW TABLES LIKE
    'glpi_plugin_webapplication%'
";
    foreach ($DB->request($sql) as $data) {
        foreach( $data as $key => $val ) {
            print_r($val);
            $migration -> copyTable($val, "backup_{$val}");
            echo "\n";
        }
    }
}

function main()
{
    backup_webapps();
    exit(0);
}

main();
<cdode>

after installing 9.5.3 and running the iinternal migration for werapps to appliances run additional::

<code>
<?php

// create backup of all glpi_plugin_webapplication tables

ini_set("memory_limit", "-1");
ini_set("max_execution_time", "0");

define("GLPI_ROOT", '/home/mboot/public_html/glpi-953');

include (GLPI_ROOT . '/inc/includes.php');

function verify_tables()
{
    global $DB;

    $tables = [
        "glpi_appliances",
        "backup_glpi_plugin_webapplications_webapplications",
        "backup_glpi_plugin_webapplications_webapplications_items",
    ];
    foreach($tables as $index => $table) {
        if( !$DB->tableExists($table) ) {
            echo "FATAL: we have no table {$table}\n";
            exit(101);
        }
    }
}

function iter_webapps_link_items() {
    global $DB;

    verify_tables();

    // what we actually need is the matching a_id, with wi.items_id and wi.itemtype
    // so we can insert the assoc_link between appliance and item(itemtype)

//     wi.plugin_webapplications_webapplications_id as app_id,

    $sql = <<<EOS
SELECT
    wi.items_id,
    wi.itemtype,
    a.id as a_id

FROM
    backup_glpi_plugin_webapplications_webapplications_items wi
LEFT JOIN
    backup_glpi_plugin_webapplications_webapplications wa
ON
    wi.plugin_webapplications_webapplications_id = wa.id
LEFT JOIN
    glpi_appliances a
ON
    wa.name = a.name

WHERE wa.is_deleted = 0
AND   wa.entities_id = a.entities_id
AND   wa.is_recursive = a.is_recursive
AND   wa.locations_id = a.locations_id
AND   wa.users_id_tech = a.users_id_tech
AND   wa.groups_id_tech = a.groups_id_tech

EOS;

    foreach ($DB->request($sql) as $data) {
        print_r($data);

        $items_id = $data['items_id'];
        $itemtype = $data['itemtype'];
        $appliance_id = $data['a_id'];

        $sql = <<<EOS
INSERT INTO
    glpi_appliances_items
(
    appliances_id,
    items_id,
    itemtype
) VALUES (
    '{$appliance_id}',
    '{$items_id}',
    '{$itemtype}'
)
EOS;
        echo "($items_id,$itemtype,$appliance_id)\n";

        $DB->request($sql);
    }
}

function main()
{
    iter_webapps_link_items();
    exit(0);
}

main();
</code>

this links all the migrated web-apps to the assets (items)

Last edited by mboot59 (2020-12-04 19:42:44)


glpi 946, plugins webApplications , fusionInventory, domains, appliances, additional fields. (experimented with many other plugins over the years)
authentication with ActiveDirectory. Long term user of glpi from the 8.x versions. centos7/centos8; mariadb

Offline

#5 2020-12-04 19:41:52

mboot59
Member
From: Zagreb, Croatia
Registered: 2017-10-20
Posts: 13

Re: Webapplication plugin migration to GLPI 9.5.2 core

note for the above, i have also certificates linked to webapps , that is currently not migratable as there is no certificate tab nor is certificate linkable in the dropdown


glpi 946, plugins webApplications , fusionInventory, domains, appliances, additional fields. (experimented with many other plugins over the years)
authentication with ActiveDirectory. Long term user of glpi from the 8.x versions. centos7/centos8; mariadb

Offline

Board footer

Powered by FluxBB