Ejemplo n.º 1
0
exec("pgrep docker",$pid);
if (count($pid)==1) exit(0);

require_once("/usr/local/emhttp/plugins/dynamix.docker.manager/include/DockerClient.php");

$docker = new DockerTemplates();

foreach ($argv as $arg) {
  switch ($arg) {
  case '-v'   : $docker->verbose = true; break;
  case 'check': $check = true; break;}
}

if (!isset($check)) {
  echo " Updating templates... ";
  $docker->downloadTemplates();
  echo " Updating info... ";
  $docker->getAllInfo(true);
  echo " Done.";
} else {
  require_once("/usr/local/emhttp/webGui/include/Wrappers.php");
  $client = new DockerClient();
  $update = new DockerUpdate();
  $notify = "/usr/local/emhttp/webGui/scripts/notify";
  $unraid = parse_plugin_cfg("dynamix",true);
  $server = strtoupper($var['NAME']);
  $output = $unraid['notify']['docker_notify'];

  $list = $client->getDockerContainers();
  $info = $docker->getAllInfo();
  foreach ($list as $ct) {
Ejemplo n.º 2
0
  $container = urldecode(($_POST['container']));
  unset($_POST['container']);

  $allAutoStart = @file($autostart_file, FILE_IGNORE_NEW_LINES);
  if ($allAutoStart===FALSE) $allAutoStart = array();
  $key = array_search($container, $allAutoStart);
  if ($key===FALSE) {
    array_push($allAutoStart, $container);
    if ($json) echo json_encode(array( 'autostart' => true ));
  }
  else {
    unset($allAutoStart[$key]);
    if ($json) echo json_encode(array( 'autostart' => false ));
  }
  file_put_contents($autostart_file, implode(PHP_EOL, $allAutoStart).(count($allAutoStart)? PHP_EOL : ""));
}

if ($_POST['#action'] == "templates" ){
  readfile("/usr/local/emhttp/update.htm");
  $repos = $_POST['template_repos'];
  file_put_contents($template_repos, $repos);
  $DockerTemplates = new DockerTemplates();
  $DockerTemplates->downloadTemplates();
}

if ( isset($_GET['is_dir'] )) {
  echo json_encode( array( 'is_dir' => is_dir( $_GET['is_dir'] )));
}
?>