Esempio n. 1
0
# Script arguments are:
# 0: script name
# 1: hash
# 2: target datadir
# 3: flag, "1" means "add torrent's path"
# 4: flag, "1" means "move datafiles"
# 5: flag, "1" means "fast resume"
# 6: username
if (count($argv) > 6) {
    $_SERVER['REMOTE_USER'] = $argv[6];
}
require_once '../../php/xmlrpc.php';
require_once './util_setdir.php';
require_once './util_rt.php';
eval(getPluginConf('datadir'));
$DataDir_Sem = rtSemGet(fileinode(__FILE__));
rtSemLock($DataDir_Sem);
function Debug($str)
{
    global $datadir_debug_enabled;
    if ($datadir_debug_enabled) {
        rtDbg("SetDir", $str);
    }
}
Debug("");
Debug("--- begin ---");
$is_ok = true;
if (count($argv) < 6) {
    Debug("called without arguments (at least 5 params wanted)");
    $is_ok = false;
} else {
Esempio n. 2
0
    }
}
require_once "./util_rt.php";
require_once "./autotools.php";
eval(getPluginConf('autotools'));
// If we are not in background, run this script in background
array_shift($argv);
if (!rtIsDaemon($argv)) {
    rtDaemon(getPHP(), basename(__FILE__), $argv);
    // script was exited at the line above
}
// arguments array was shifted and  "--daemon" param was added, so:
// 0: --daemon
// 1: hash
// 2: username
$AutoLabel_Sem = rtSemGet(fileinode(__FILE__));
rtSemLock($AutoLabel_Sem);
function Debug($str)
{
    global $autodebug_enabled;
    if ($autodebug_enabled) {
        rtDbg("AutoLabel", $str);
    }
}
Debug("");
Debug("--- begin ---");
$is_ok = true;
if (count($argv) < 2) {
    Debug("called without arguments (hash wanted)");
    $is_ok = false;
} else {