Bonjour,
je ne ne sais pas où mettre cette question , mais je l'ai mis ici

j'ai développer un script d'inscription du ldap à une plate forme LMS,
le problème c'est que je suis obligé manuellement lancer un script qui s'appelle
sync.php, je le lance avec la commande
la voici
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
 
<?php
 
/**
 * CLI sync for cohort enrolments, use for debugging or immediate sync
 * of all courses.
 *
 * Notes:
 *   - it is required to use the web server account when executing PHP CLI scripts
 *   - you need to change the "www-data" to match the apache user account
 *   - use "su" if "sudo" not available
 *
 * @package    enrol_cohort
 * @copyright  2011 Petr Skoda {@link http://skodak.org}
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
 
define('CLI_SCRIPT', true);
 
require(__DIR__.'/../../../config.php');
require_once("$CFG->libdir/clilib.php");
require_once("$CFG->dirroot/enrol/cohort/locallib.php");
 
// Now get cli options.
list($options, $unrecognized) = cli_get_params(array('verbose'=>false, 'help'=>false), array('v'=>'verbose', 'h'=>'help'));
 
if ($unrecognized) {
    $unrecognized = implode("\n  ", $unrecognized);
    cli_error(get_string('cliunknowoption', 'admin', $unrecognized));
}
 
if ($options['help']) {
    $help =
        "Execute cohort course enrol sync.

Options:
-v, --verbose         Print verbose progess information
-h, --help            Print out this help

Example:
\$ sudo -u www-data /usr/bin/php enrol/cohort/cli/sync.php
";
 
    echo $help;
    die;
}
 
if (empty($options['verbose'])) {
    $trace = new null_progress_trace();
} else {
    $trace = new text_progress_trace();
}
 
$result = enrol_cohort_sync($trace, null);
$trace->finished();
 
exit($result);
comment je peux faire pour que le php que le lancé par le navigateur puisse
lancer ce php cli ?

je pourrais à la fin de mon script faire un include mais avec cette lligne,
je n'ai pas la variable $options et $unrecognized.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
 
list($options, $unrecognized) = cli_get_params(array('verbose'=>false, 'help'=>false), array('v'=>'verbose', 'h'=>'help'));


merci de votre réponse.