Example #1
0
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License version 2,
 * as published by the Free Software Foundation.
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 */
?>
<?
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");
Example #2
0
	public function getUpdateStatus($container, $image) {
		$DockerTemplates = new DockerTemplates();
		$RegistryUrl     = $DockerTemplates->getTemplateValue($image, "Registry");
		$userFile        = $DockerTemplates->getUserTemplate($container);
		$localVersion    = $this->getLocalVersion($userFile);
		$remoteVersion   = $this->getRemoteVersion($RegistryUrl, $image);
		// echo "\n $localVersion => $remoteVersion";
		return ($localVersion && $remoteVersion) ? (($remoteVersion == $localVersion) ? "true" : "false") : "undef" ;
	}
Example #3
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'] )));
}
?>
Example #4
0
 * Copyright 2015, Guilherme Jardim, Eric Schultz, Jon Panozzo.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License version 2,
 * as published by the Free Software Foundation.
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 */
?>
<?
ignore_user_abort(true);
require_once("/usr/local/emhttp/plugins/dynamix.docker.manager/include/DockerClient.php");
$DockerClient = new DockerClient();
$DockerUpdate = new DockerUpdate();
$DockerTemplates = new DockerTemplates();

function prepareDir($dir){
  if (strlen($dir)){
    if ( ! is_dir($dir) && ! is_file($dir)){
      mkdir($dir, 0777, true);
      chown($dir, 'nobody');
      chgrp($dir, 'users');
      sleep(1);
    }
  }
}

function ContainerExist($container){
  global $DockerClient;