Files
urbackup/README.md
T
2026-08-07 14:27:33 +02:00

151 lines
6.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# UrBackup plugin for GLPI 11
[![GLPI](https://img.shields.io/badge/GLPI-11.0.6%2B-blue?logo=glpi)](https://glpi-project.org)
[![PHP](https://img.shields.io/badge/PHP-8.3%2B-777BB4?logo=php)](https://php.net)
[![License](https://img.shields.io/badge/License-GPL--2.0--or--later-green)](LICENSE)
Integrate [UrBackup](https://www.urbackup.org/) backup server management directly into GLPI. Monitor clients, manage backups, and link assets to UrBackup servers from within GLPI's asset management interface.
## Features
- **Server management** Register UrBackup servers by location; test API connectivity.
- **Asset linking** Link Computers (and other GLPI 11 asset types) to UrBackup clients.
- **Backup actions** Start file/image incremental and full backups directly from the asset form.
- **Client lifecycle** Create, rename, and delete UrBackup clients from GLPI.
- **Internet mode** Toggle internet mode and configure default backup directories per asset.
- **Capacity system** Native GLPI 11 integration via `UrBackupCapacity`; enable per Asset Definition.
- **Location-aware** Auto-match assets to servers based on location hierarchy.
- **Massive actions** Link/unlink assets to servers in bulk.
## Requirements
| Component | Version |
|-----------|---------|
| **GLPI** | >= 11.0.6, < 12.0.0 |
| **PHP** | >= 8.3.0 (8.4 supported) |
| **Database** | MySQL 5.7+ / MariaDB 10.5+ |
## Installation
1. **Download** the plugin and extract it to `GLPI_ROOT/plugins/urbackup/`
2. **Install** via GLPI web interface or CLI:
```bash
php bin/console glpi:plugin:install urbackup
php bin/console glpi:plugin:activate urbackup
```
3. **Configure rights** Go to *Administration > Profiles*, select a profile, and set *UrBackup* rights (READ / UPDATE / CREATE / DELETE / PURGE).
4. **Add servers** Navigate to *Admin > UrBackup servers* and register your UrBackup instances.
5. **Enable capacity** Go to *Config > Asset definitions*, open an asset type, and enable *UrBackup* in the Capacities tab.
## Usage
### Linking assets to a server
- Open an asset (Computer, etc.) and go to the **UrBackup** tab.
- Select a server from the dropdown and click **Connect**.
- The asset appears in the server's *Linked clients* tab and backup actions become available.
### Starting a backup
1. Open a linked asset and go to its UrBackup tab.
2. Click **Start file backup** (incremental) or **Start image backup**.
3. Monitor progress in the UrBackup server web interface.
### Managing servers
- **Add**: *Admin > UrBackup servers > Add*
- **Edit**: Click a server name or the edit icon.
- **Test API**: The plugin auto-tests the API when saving; status is shown in the list.
## Permissions
| Right | Description |
|-------------|-------------|
| `READ` | View servers and asset backup status |
| `UPDATE` | Edit servers, start backups, toggle internet mode |
| `CREATE` | Add new servers, create clients |
| `DELETE` | Disconnect assets from servers |
| `PURGE` | Delete clients from UrBackup server |
## Development
```bash
# Lint
php -l src/*.php front/*.php
# Type checking (requires PHPStan)
vendor/bin/phpstan analyse --level 8 src/
# Database migration testing
# Install/uninstall/reinstall via CLI:
php bin/console glpi:plugin:install urbackup
php bin/console glpi:plugin:uninstall urbackup
```
## Project Structure
```
plugin_urbackup/
├── front/ # Entry points (form handlers, AJAX endpoints)
├── install/ # DB schema (mysql/) and install/uninstall scripts
├── public/ # Static assets (CSS, JS)
├── src/ # PHP classes (PSR-4: Plugin\Urbackup\)
│ ├── AssetTab.php
│ ├── Capacity/ # GLPI 11 capacity integration
│ ├── Config.php
│ ├── LocationHelper.php
│ ├── Profile.php
│ ├── Server.php
│ ├── ServerAsset.php
│ └── UrbackupApiClient.php
├── templates/ # Twig templates
├── setup.php # Plugin metadata, hooks, class registration
├── hook.php # Install/upgrade/uninstall + massive actions
└── README.md
```
## Changelog
### 0.7.3
- Servers can now be linked to their hardware host asset (Computer or custom Asset Definition with the UrBackup capacity): new `host_itemtype`/`host_items_id` columns on `glpi_plugin_urbackup_servers`, editable from the server form (itemtype dropdown + AJAX item dropdown)
- The asset tab now shows a "This asset hosts the UrBackup server" block with links to the hosted servers (always visible, even when the asset is also a linked client)
- Server save validates the host link (unknown/disabled itemtype or missing item resets the link)
- Added it_IT/de_DE/en_GB translations (2 new strings) and recompiled locales
### 0.7.2
- UrBackup on Computer is now configurable: new `enable_computer` setting on the plugin configuration page (previously always enabled, hardcoded)
- Configuration page lists the custom Asset Definitions with the "Urbackup" capacity enabled
- Tab registration, massive actions, links and unlinked/missing client lists now respect the Computer setting
- Asset tab: redesigned the "UrBackup status" section with status cards (server, API status, version, client), renamed the "State" tab to "Client State", fixed the Internet mode badge being rendered as escaped text
- Added it_IT/de_DE/en_GB translations (7 new strings, 1 orphan removed) and recompiled locales
### 0.7.1
- `api_password` now encrypted with `GLPIKey` on save (plaintext values migrated on update by `plugin_urbackup_install_encrypt_api_passwords()`)
- API connection test on server save runs only when connection parameters changed
- OPcache invalidation loop limited to development environments
- Fixed N+1 queries in the unlinked clients tab (batch loading)
- Completed it_IT/de_DE/en_GB translations (115 new strings) and recompiled locales
### 0.7.0
- Dropped legacy `glpi_plugin_urbackup_profiles` and `glpi_plugin_urbackup_assettypes` tables
- Added composite index `(locations_id, is_active)` on servers table
- Added `date_creation`/`date_mod` columns to serverassets table
- Removed deprecated files and dead Symfony controller code
- CSRF hardening on all POST handlers
- Bumped minimum PHP to 8.3
### 0.6.0
- GLPI 11 compatibility with Asset Definition capacity system
- Migrated from Symfony to native GLPI form handling
- Added location-aware server matching
### 0.5.0
- Initial GLPI 10 compatibility
- Profile-based rights management
## License
GNU General Public License v2.0 or later. See [LICENSE](LICENSE).