Skip to content

Commit

Permalink
Merge branch 'release/9.4.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
trasher committed Feb 25, 2019
2 parents 2dd5196 + cf442bc commit 89bb71f
Show file tree
Hide file tree
Showing 2 changed files with 104 additions and 23 deletions.
123 changes: 102 additions & 21 deletions source/command-line.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,51 +3,132 @@ Command line tools

Since GLPI 9.2.2, command line tools are provided as supported scripts and are available from the ``scripts`` directory of the archive. On previous versions, those scripts were present in the ``tools`` directory that is not official and therefore not in the release archive.

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

.. note::

If APCu is installed on your system, it may fail from command line since default configuration disables it from command-line. To change that, set ``apc.enable_cli`` to ``on`` in your APCu configuration file.

.. _cdline_options:

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

.. _cdline_install:

Install
-------

A PHP command line installation script is provided in the GLPI archive (``scripts/cliinstall.php``).

You have to specify at least a database name and an user:
The ``bin/console db:install`` has been made to install GLPI database in CLI mode.

.. code-block:: bash
Possible options for this command are:

# php scripts/cliinstall.php --db=dbglpi --user=userglpi
* ``-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

It is possible to specifiy some variables calling the script:
If mandatory options are not specified in the command call, the console will ask for them.

* ``--host`` host name (`localhost` per default),
* ``--db`` database name,
* ``--user`` database user name,
* ``--pass`` database user's pasword,
* ``--lang`` language code to use (`fr_FR` as example). Will be set to `en_GB` per default,
* ``--tests`` create tests configuration file,
* ``--force`` do not check if GLPI is already installed and drop what would exists,
* ``--help`` displays command help.
See also :ref:`console options <cdline_options>`.

.. _cdline_update:

Update
------

An update script is provided as well (``scripts/cliupdate.php``).
The ``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 script so it updates your database automatically.
There is no required arguments, just run the command so it updates your database automatically.

.. warning::

Do not forget to backup your database before any update try!

Possible options for this command are:

* ``--lang`` language code to use (`fr_FR` as example). Will be set to `en_GB` per default,
* ``--help`` displays command help.
* ``--config-dir`` set configuration file path to use,
* ``--force`` force update, usefull when GLPI version does not change (mainly when working on it ;)),
* ``--dev`` required to use a development version. Use it with caution...
* ``-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 :ref:`console options <cdline_options>`.

Database tools
--------------

Database schema check
^^^^^^^^^^^^^^^^^^^^^
The ``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 :

.. code-block:: none
$ 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 ``bin/console task:unlock`` command can be used to unlock stucked cron tasks.

.. warning::

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).

Possible options for this command are:

* ``-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 :ref:`console options <cdline_options>`.

Migration tools
---------------

From MyISAM to InnoDB
^^^^^^^^^^^^^^^^^^^^^

.. versionadded:: 9.3.0

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

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

Missing timestamps builder
^^^^^^^^^^^^^^^^^^^^^^^^^^

.. versionadded:: 9.1.0

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

The ``bin/console glpi:migration:build_missing_timestamps`` command can be used to rebuild missing values using available logs.
4 changes: 2 additions & 2 deletions source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@
# built documents.
#
# The short X.Y version.
version = u'9.3'
version = u'9.4'
# The full version, including alpha/beta/rc tags.
release = u'9.3'
release = u'9.4'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down

0 comments on commit 89bb71f

Please sign in to comment.