From fcf8f54747cbcbd2d065f42fa0cbfe1028dc4966 Mon Sep 17 00:00:00 2001 From: mariano Date: Wed, 24 Jun 2026 12:16:04 +0200 Subject: [PATCH] ver 0.7.0 --- CORREZIONI_NECESSARIE.md | 77 ---------------------------------------- install/install.php | 14 ++------ public/js/urbackup.js | 10 ++++-- setup.php | 2 +- src/AssetTab.php | 2 +- src/ServerAsset.php | 2 +- 6 files changed, 13 insertions(+), 94 deletions(-) delete mode 100644 CORREZIONI_NECESSARIE.md diff --git a/CORREZIONI_NECESSARIE.md b/CORREZIONI_NECESSARIE.md deleted file mode 100644 index 7d28b1f..0000000 --- a/CORREZIONI_NECESSARIE.md +++ /dev/null @@ -1,77 +0,0 @@ -# Correzioni Necessarie per Conformità GLPI 11 - -## 1. Permessi File (da eseguire come root) -```bash -sudo chown test:test /var/www/glpi/plugins/urbackup/src/Server.php -sudo chown test:test /var/www/glpi/plugins/urbackup/src/Profile.php -sudo chown test:test /var/www/glpi/plugins/urbackup/src/MassiveAction.php -sudo chown test:test /var/www/glpi/plugins/urbackup/src/AssetTab.php -sudo chown test:test /var/www/glpi/plugins/urbackup/hook.php -sudo chown test:test /var/www/glpi/plugins/urbackup/setup.php -sudo chown test:test /var/www/glpi/plugins/urbackup/front/server.php -sudo chown test:test /var/www/glpi/plugins/urbackup/front/profile.form.php___ -``` - -## 2. Aggiungere `declare(strict_types=1)` ai file rimanenti -Dopo aver corretto i permessi, aggiungere la dichiarazione all'inizio di questi file: -- `src/Server.php` (dopo `tableExists($table)) { - $migration->displayMessage(__('Dropping legacy glpi_plugin_urbackup_profiles table', 'urbackup')); - $DB->queryOrDie("DROP TABLE IF EXISTS `$table`"); - } + plugin_urbackup_migration_drop_table($migration, 'glpi_plugin_urbackup_profiles'); // glpi_plugin_urbackup_assettypes was replaced by GLPI 11 Capacity system in 0.6.0 - $table2 = 'glpi_plugin_urbackup_assettypes'; - if ($DB->tableExists($table2)) { - $migration->displayMessage(__('Dropping legacy glpi_plugin_urbackup_assettypes table', 'urbackup')); - $DB->queryOrDie("DROP TABLE IF EXISTS `$table2`"); - } - - $migration->displayMessage(__('Legacy tables dropped successfully', 'urbackup')); + plugin_urbackup_migration_drop_table($migration, 'glpi_plugin_urbackup_assettypes'); } /** diff --git a/public/js/urbackup.js b/public/js/urbackup.js index 3943980..8a312aa 100644 --- a/public/js/urbackup.js +++ b/public/js/urbackup.js @@ -8,7 +8,8 @@ if (!serverId || !resultBox) return; var xhr = new XMLHttpRequest(); - xhr.open('POST', '/plugins/urbackup/front/server_test.ajax.php', true); + var pluginUrl = (window.CFG_GLPI && CFG_GLPI.root_doc ? CFG_GLPI.root_doc : '') + '/plugins/urbackup'; + xhr.open('POST', pluginUrl + '/front/server_test.ajax.php', true); xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); xhr.setRequestHeader('X-Glpi-Csrf-Token', getAjaxCsrfToken()); xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); @@ -39,7 +40,12 @@ resultBox.innerHTML = ' API connection failed
Network error'; }; - xhr.send('id=' + encodeURIComponent(serverId)); + var csrfToken = getAjaxCsrfToken(); + var params = 'id=' + encodeURIComponent(serverId); + if (csrfToken) { + params += '&_glpi_csrf_token=' + encodeURIComponent(csrfToken); + } + xhr.send(params); } function initApiStatusCheck() { diff --git a/setup.php b/setup.php index 1bb5f5e..af48c91 100644 --- a/setup.php +++ b/setup.php @@ -25,7 +25,7 @@ use GlpiPlugin\Urbackup\ServerAsset; use GlpiPlugin\Urbackup\MassiveAction as PluginUrbackupMassiveAction; define('PLUGIN_URBACKUP_VERSION', '0.7.0'); -define('PLUGIN_URBACKUP_MIN_GLPI', '11.0.0'); +define('PLUGIN_URBACKUP_MIN_GLPI', '11.0.6'); define('PLUGIN_URBACKUP_MAX_GLPI', '11.99.99'); if (!defined('PLUGIN_URBACKUP_DIR')) { diff --git a/src/AssetTab.php b/src/AssetTab.php index c6bf0b7..cfc99e7 100644 --- a/src/AssetTab.php +++ b/src/AssetTab.php @@ -72,7 +72,7 @@ class AssetTab extends CommonDBTM return self::createTabEntry(__('UrBackup', 'urbackup'), 0, null, 'ti ti-cloud-up'); } -/** + /** * Display tab content for item. * * @param CommonGLPI $item Item diff --git a/src/ServerAsset.php b/src/ServerAsset.php index de697f7..1a2f053 100644 --- a/src/ServerAsset.php +++ b/src/ServerAsset.php @@ -219,7 +219,7 @@ class ServerAsset extends CommonDBTM return (string) $ip; } -/** + /** * Display tab content for item. * * @param CommonGLPI $item Server item