#!C:\Program Files (x86)\Plesk\Additional\PleskPHP74\\php.exe
<?php
/**
 * Copyright 2011-2017 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('-u', '--user-id', array('type' => 'int')),
    new Horde_Argv_Option('-i', '--object-id', array('type' => 'int')),
);
$parser = new Horde_Argv_Parser(array('optionList' => $options));
list($opts, $tags) = $parser->parseArgs();
if (!$opts->user_id || !$opts->object_id) {
    throw new InvalidArgumentException('user-id and object-id are both required');
}
if (!count($tags)) {
    throw new InvalidArgumentException('List at least one tag to remove.');
}

/* @TODO Switch to using the TagController */
$injector->getInstance('Content_Tagger')
    ->untag($opts->user_id, $opts->object_id, $tags);
exit(0);
