ver 0.7.0
This commit is contained in:
@@ -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 `<?php`)
|
|
||||||
- `src/Profile.php` (dopo `<?php`)
|
|
||||||
- `src/MassiveAction.php` (dopo `<?php`)
|
|
||||||
- `src/AssetTab.php` (dopo `<?php`)
|
|
||||||
- `hook.php` (dopo `<?php`)
|
|
||||||
- `setup.php` (dopo `<?php`)
|
|
||||||
|
|
||||||
## 3. Nuovi File Creati (✅ Completato)
|
|
||||||
- `src/Controller/ServerController.php` - Controller Symfony
|
|
||||||
- `src/Controller/ConfigController.php` - Controller Symfony
|
|
||||||
- `src/Controller/AssetController.php` - Controller Symfony
|
|
||||||
- `templates/config/config.html.twig` - Template Twig
|
|
||||||
- `templates/server/server_form.html.twig` - Template Twig
|
|
||||||
- `templates/server/server_list.html.twig` - Template Twig
|
|
||||||
- `templates/asset/asset_tab.html.twig` - Template Twig
|
|
||||||
- `public/js/urbackup.js` - JavaScript spostato
|
|
||||||
|
|
||||||
## 4. File da Rimuovere (Front/Ajax deprecati)
|
|
||||||
Eseguire lo script creato:
|
|
||||||
```bash
|
|
||||||
bash /var/www/glpi/plugins/urbackup/remove_deprecated_files.sh
|
|
||||||
```
|
|
||||||
Ooppure manualmente:
|
|
||||||
```bash
|
|
||||||
rm -f /var/www/glpi/plugins/urbackup/front/config.form.php
|
|
||||||
rm -f /var/www/glpi/plugins/urbackup/front/server.php
|
|
||||||
rm -f /var/www/glpi/plugins/urbackup/front/server.form.php
|
|
||||||
rm -f /var/www/glpi/plugins/urbackup/front/asset.form.php
|
|
||||||
rm -f /var/www/glpi/plugins/urbackup/ajax/server_test.php
|
|
||||||
rm -f /var/www/glpi/plugins/urbackup/ajax/server_clients.php
|
|
||||||
rm -f /var/www/glpi/plugins/urbackup/ajax/asset_action.php
|
|
||||||
rm -rf /var/www/glpi/plugins/urbackup/front
|
|
||||||
rm -rf /var/www/glpi/plugins/urbackup/ajax
|
|
||||||
rm -rf /var/www/glpi/plugins/urbackup/js
|
|
||||||
```
|
|
||||||
|
|
||||||
## 5. Aggiornare setup.php
|
|
||||||
Cambiare la riga:
|
|
||||||
```php
|
|
||||||
$PLUGIN_HOOKS['config_page']['urbackup'] = 'front/config.form.php';
|
|
||||||
```
|
|
||||||
in:
|
|
||||||
```php
|
|
||||||
$PLUGIN_HOOKS['config_page']['urbackup'] = '/plugin/urbackup/config';
|
|
||||||
```
|
|
||||||
|
|
||||||
## 6. Verificare Conformità
|
|
||||||
Dopo le correzioni, eseguire:
|
|
||||||
```bash
|
|
||||||
cd /var/www/glpi/plugins/urbackup
|
|
||||||
vendor/bin/phpstan analyse
|
|
||||||
vendor/bin/ecs check --fix
|
|
||||||
```
|
|
||||||
|
|
||||||
## 7. Note Importanti
|
|
||||||
- GLPI 11 centralizza tutto su `/public/index.php`
|
|
||||||
- Non devono esistere file PHP accessibili direttamente nella root del plugin
|
|
||||||
- I Controller Symfony con Attributes gestiscono il routing
|
|
||||||
- Twig gestisce i template in `templates/`
|
|
||||||
- Tutti i file PHP devono avere `declare(strict_types=1);`
|
|
||||||
- JavaScript e CSS vanno in `public/`
|
|
||||||
+2
-12
@@ -323,20 +323,10 @@ function plugin_urbackup_install_drop_legacy_tables(Migration $migration): void
|
|||||||
global $DB;
|
global $DB;
|
||||||
|
|
||||||
// glpi_plugin_urbackup_profiles was replaced by Profile::registerRights() in 0.5.0
|
// glpi_plugin_urbackup_profiles was replaced by Profile::registerRights() in 0.5.0
|
||||||
$table = 'glpi_plugin_urbackup_profiles';
|
plugin_urbackup_migration_drop_table($migration, 'glpi_plugin_urbackup_profiles');
|
||||||
if ($DB->tableExists($table)) {
|
|
||||||
$migration->displayMessage(__('Dropping legacy glpi_plugin_urbackup_profiles table', 'urbackup'));
|
|
||||||
$DB->queryOrDie("DROP TABLE IF EXISTS `$table`");
|
|
||||||
}
|
|
||||||
|
|
||||||
// glpi_plugin_urbackup_assettypes was replaced by GLPI 11 Capacity system in 0.6.0
|
// glpi_plugin_urbackup_assettypes was replaced by GLPI 11 Capacity system in 0.6.0
|
||||||
$table2 = 'glpi_plugin_urbackup_assettypes';
|
plugin_urbackup_migration_drop_table($migration, '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'));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -8,7 +8,8 @@
|
|||||||
if (!serverId || !resultBox) return;
|
if (!serverId || !resultBox) return;
|
||||||
|
|
||||||
var xhr = new XMLHttpRequest();
|
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-Requested-With', 'XMLHttpRequest');
|
||||||
xhr.setRequestHeader('X-Glpi-Csrf-Token', getAjaxCsrfToken());
|
xhr.setRequestHeader('X-Glpi-Csrf-Token', getAjaxCsrfToken());
|
||||||
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
||||||
@@ -39,7 +40,12 @@
|
|||||||
resultBox.innerHTML = '<span class="text-danger fw-bold"><i class="ti ti-x"></i> API connection failed</span><br><small class="text-muted">Network error</small>';
|
resultBox.innerHTML = '<span class="text-danger fw-bold"><i class="ti ti-x"></i> API connection failed</span><br><small class="text-muted">Network error</small>';
|
||||||
};
|
};
|
||||||
|
|
||||||
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() {
|
function initApiStatusCheck() {
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ use GlpiPlugin\Urbackup\ServerAsset;
|
|||||||
use GlpiPlugin\Urbackup\MassiveAction as PluginUrbackupMassiveAction;
|
use GlpiPlugin\Urbackup\MassiveAction as PluginUrbackupMassiveAction;
|
||||||
|
|
||||||
define('PLUGIN_URBACKUP_VERSION', '0.7.0');
|
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');
|
define('PLUGIN_URBACKUP_MAX_GLPI', '11.99.99');
|
||||||
|
|
||||||
if (!defined('PLUGIN_URBACKUP_DIR')) {
|
if (!defined('PLUGIN_URBACKUP_DIR')) {
|
||||||
|
|||||||
+1
-1
@@ -72,7 +72,7 @@ class AssetTab extends CommonDBTM
|
|||||||
return self::createTabEntry(__('UrBackup', 'urbackup'), 0, null, 'ti ti-cloud-up');
|
return self::createTabEntry(__('UrBackup', 'urbackup'), 0, null, 'ti ti-cloud-up');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display tab content for item.
|
* Display tab content for item.
|
||||||
*
|
*
|
||||||
* @param CommonGLPI $item Item
|
* @param CommonGLPI $item Item
|
||||||
|
|||||||
+1
-1
@@ -219,7 +219,7 @@ class ServerAsset extends CommonDBTM
|
|||||||
return (string) $ip;
|
return (string) $ip;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display tab content for item.
|
* Display tab content for item.
|
||||||
*
|
*
|
||||||
* @param CommonGLPI $item Server item
|
* @param CommonGLPI $item Server item
|
||||||
|
|||||||
Reference in New Issue
Block a user