/usr/bin/content-object-add is in php-horde-content 2.0.5-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 | #!/usr/bin/php
<?php
/**
* Copyright 2011-2015 Horde LLC (http://www.horde.org/)
*
* @license http://www.horde.org/licenses/bsd BSD
* @package Content
*/
if (file_exists(__DIR__ . '/../../content/lib/Application.php')) {
$baseDir = __DIR__ . '/../';
} else {
require_once 'PEAR/Config.php';
$baseDir = PEAR_Config::singleton()
->get('horde_dir', null, 'pear.horde.org') . '/content/';
}
require_once $baseDir . 'lib/Application.php';
Horde_Registry::appInit('content', array('cli' => true));
$options = array(
new Horde_Argv_Option('-i', '--id', array('type' => 'int')),
new Horde_Argv_Option('-t', '--type-id', array('type' => 'int')),
);
$parser = new Horde_Argv_Parser(array('optionList' => $options));
list($opts, $positional) = $parser->parseArgs();
if (!$opts->id || !$opts->type_id) {
throw new InvalidArgumentException('id and type-id are both required');
}
require CONTENT_BASE . '/lib/Objects/Object.php';
require CONTENT_BASE . '/lib/Objects/ObjectMapper.php';
$m = new Content_ObjectMapper($injector->getInstance('Horde_Db_Adapter'));
$i = $m->create(array('object_name' => $opts->id,
'type_id' => $opts->type_id,
));
echo 'Created new object with id ' . $i->object_id . ' for ' . $i->type_id . ':' . $i->object_name . ".\n";
exit(0);
|