Outils en ligne de commande

Depuis GLPI 9.2.2, des outils en ligne de commande sont fournis et disponibles dans le dossier script de l’archive. Sur les versions précédentes, ces outils étaient présents dans le dossier tools qui n’est pas officiel et donc non fourni dans l’archive de release.

Since GLPI 9.4.0, command line tools are being centralized in a console application (bin/console). Calling php bin/console from GLPI directory displays the list of available commands.

Note

Si APCu est installé sur votre système, il se peut qu’il provoque des échecs en ligne de commande puisque sa configuration par défaut le désactive pour la ligne de commande. Pour changer cela, définissez apc.enable_cli à on dans votre fichier de configuration APCu;

Console options

For every console command, following options are available:

  • --config-dir=CONFIG-DIR path of configuration directory to use, relative to current working directory (required only if a custom path is used)
  • -h, --help displays command help
  • --lang=LANG output language code (default value is existing GLPI « language » configuration or « en_GB »)
  • -n, --no-interaction disable command interactive questions
  • --no-plugins disable GLPI plugins during command execution
  • -q, --quiet disable command output
  • -v|vv|vvv, --verbose=VERBOSE verbosity level: 1 for normal output, 2 for more verbose output and 3 for debug

Installation

The php bin/console db:install has been made to install GLPI database in CLI mode.

Les options possibles pour cette commande sont :

  • -H, --db-host host name (localhost per default)
  • -P, --db-port database port (default MySQL port if option is not defined)
  • -d, --db-name database name
  • -u, --db-user database user name
  • -p, --db-password database user’s pasword
  • -L, --default-language default language of GLPI (en_GB per default)
  • -f, --force do not check if GLPI is already installed and drop what would exists

If mandatory options are not specified in the command call, the console will ask for them.

See also console options.

Mise à jour

The php bin/console db:update has been made to update GLPI database in CLI mode from a previously installed version.

There is no required arguments, just run the command so it updates your database automatically.

Avertissement

Ne pas oublier d’effectuer une sauvegarde de la base de données avant totue tentative de mise à jour !

Les options possibles pour cette commande sont :

  • -u, --allow-unstable allow update to an unstable version (use it with cautions)
  • -f, --force force execution of update from v-1 version of GLPI even if schema did not changed

See also console options.

Database tools

Database schema check

The php bin/console db:check command can be used to check if your database schema differs from expected one.

If you have any diff, output will looks like :

$ php bin/console glpi:database:check
Table schema differs for table "glpi_rulecriterias".
--- Original
+++ New
@@ @@
 create table `glpi_rulecriterias` (
   `id` int(11) not null auto_increment
   `rules_id` int(11) not null default '0'
   `criteria` varchar(255) default null
   `condition` int(11) not null default '0'
-  `pattern` text default null
+  `pattern` text
   primary key (`id`)

Tasks tools

Task unlock

The php bin/console task:unlock command can be used to unlock stucked cron tasks.

Avertissement

Keep in mind that no task should be stucked except in case of a bug or a system failure (database failure during cron execution for example).

Les options possibles pour cette commande sont :

  • -a, --all unlock all tasks
  • -c, --cycle[=CYCLE] execution time (in cycles) from which the task is considered as stuck (delay = task frequency * cycle)
  • -d, --delay[=DELAY] execution time (in seconds) from which the task is considered as stuck (default: 1800)
  • -t, --task[=TASK] itemtype::name of task to unlock (e.g: MailCollector::mailgate)

See also console options.

Migration tools

From MyISAM to InnoDB

Nouveau dans la version 9.3.0.

Since version 9.3.0, GLPI uses the InnoDB engine instead of previously used MyISAM engine.

The php bin/console glpi:migration:myisam_to_innodb command can be used to migrate exiting tables to InnoDB engine.

Missing timestamps builder

Nouveau dans la version 9.1.0.

Prior to GLPI 9.1.0, fields corresponding to creation and modification dates were not existing.

The php bin/console glpi:migration:build_missing_timestamps command can be used to rebuild missing values using available logs.

Creative Commons License