/usr/bin/nag-create-missing-add-histories-sql is in php-horde-nag 4.2.7-1ubuntu1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 | #!/usr/bin/php
<?php
/**
* Copyright 2005-2016 Horde LLC (http://www.horde.org/)
*
* See the enclosed file COPYING for license information (GPL). If you
* did not receive this file, see http://www.horde.org/licenses/gpl.
*
* @author Chuck Hagenbuch <chuck@horde.org>
*/
if (file_exists(__DIR__ . '/../../nag/lib/Application.php')) {
$baseDir = __DIR__ . '/../';
} else {
require_once 'PEAR/Config.php';
$baseDir = PEAR_Config::singleton()
->get('horde_dir', null, 'pear.horde.org') . '/nag/';
}
require_once $baseDir . 'lib/Application.php';
Horde_Registry::appInit('nag', array('cli' => true));
$history = $GLOBALS['injector']->getInstance('Horde_History');
// Run through every tasklist.
$tasklists = $nag_shares->listAllShares();
foreach ($tasklists as $tasklist => $share) {
$cli->writeln("Creating default histories for $tasklist ...");
// List all tasks.
$storage = $GLOBALS['injector']->getInstance('Nag_Factory_Driver')->create($tasklist);
$storage->retrieve();
$tasks = $storage->listTasks();
foreach ($tasks as $taskId => $task) {
$log = $history->getHistory('nag:' . $tasklist . ':' . $task['uid']);
$created = false;
foreach ($log as $entry) {
if ($entry['action'] == 'add') {
$created = true;
break;
}
}
if (!$created) {
$history->log('nag:' . $tasklist . ':' . $task['uid'], array('action' => 'add'), true);
}
}
}
$cli->writeln("** Default histories successfully created ***");
|