diff --git a/html/ops/create_app_version.php b/html/ops/create_app_version.php new file mode 100644 index 0000000000..d25e02d4ad --- /dev/null +++ b/html/ops/create_app_version.php @@ -0,0 +1,121 @@ +. + +// web-based app version creation. + +require_once("../inc/util_ops.inc"); + +function show_form() { + admin_page_head("Create app version"); + echo " +
" + ; + + form_input_text("App name", "app_name"); + form_input_text("Version number", "version_num"); + form_input_text("Platform name", "platform_name"); + form_input_text("Plan class", "plan_class"); + form_input_hidden("action", "create"); + echo " + +

+ +

+ "; + admin_page_tail(); +} + +function create_version() { + $app_name = post_str("app_name"); + $version_num = post_str("version_num"); + $platform_name = post_str("platform_name"); + $plan_class = post_str("plan_class"); + + $app_name = BoincDb::escape_string($app_name); + $app = BoincApp::lookup("name='$app_name'"); + if (!$app) { + admin_error_page("No such app"); + } + $platform_name = BoincDb::escape_string($platform_name); + $platform = BoincPlatform::lookup("name='$platform_name'"); + if (!$platform) { + admin_error_page("No such platform"); + } + + // make directories as needed + // + $apps_dir = "../../apps"; + $app_dir = "$apps_dir/$app_name"; + if (!is_dir($app_dir)) { + mkdir($app_dir); + } + $version_dir = "$app_dir/$version_num"; + if (!is_dir($version_dir)) { + mkdir($version_dir); + } + $platform_dir = "$version_dir/$platform_name"; + if ($plan_class) { + $platform_dir .= "__$plan_class"; + } + if (is_dir($platform_dir)) { + admin_error_page("App version dir already exists"); + } + mkdir($platform_dir); + + // copy files to app version dir + // + $count = count($_FILES['new_file']['tmp_name']); + for ($i=0; $i<$count; $i++) { + $tmp_name = $_FILES['new_file']['tmp_name'][$i]; + if (!is_uploaded_file($tmp_name)) { + admin_error_page("$tmp_name is not uploaded file"); + } + $name = $_FILES['new_file']['name'][$i]; + if (strstr($name, "/")) { + admin_error_page("no / allowed"); + } + $ret = rename($tmp_name, "$platform_dir/$name"); + if (!$ret) { + admin_error_page("can't rename $tmp_name to $platform_dir/$name"); + } + } + + admin_page_head("Updating app versions"); + echo "
\n";
+    $cmd = "cd ../..; bin/update_versions --no_conf";
+    system($cmd);
+    echo "
\n"; + admin_page_tail(); +} + +// creating app versions must be secure +// +auth_ops_privilege(); // user must be S_ADMIN or S_DEV +if (!parse_bool(get_config(), "enable_web_app_version_creation")) { + admin_error_page("Disabled"); +} + + +$action = post_str("action", true); +if ($action == 'create') { + create_version(); +} else { + show_form(); +} + +?> diff --git a/html/user/autodock_submit.php b/html/user/autodock_submit.php index 8ecbe1b70d..91c5f4dc5b 100644 --- a/html/user/autodock_submit.php +++ b/html/user/autodock_submit.php @@ -287,7 +287,7 @@ function show_info() { page_tail(); } -if (!parse_bool($config, "autodock_submit_enabled")) { +if (!parse_bool($config, "enable_autodock_submit")) { error_page("Autodock not enabled"); } diff --git a/tools/update_versions b/tools/update_versions index 5f3dbb812f..62163f6e8e 100755 --- a/tools/update_versions +++ b/tools/update_versions @@ -22,6 +22,8 @@ // script to create app versions, // and stage their files in the download dir. // See https://boinc.berkeley.edu/trac/wiki/AppVersionNew +// +// --no_conf: don't pause for user confirmation error_reporting(E_ALL); @@ -237,7 +239,7 @@ function confirm_sig_gen($name) { // process a file // function process_file($a, $v, $p, $name, $fds) { - global $key_dir; + global $key_dir, $no_conf; $fd = lookup_file($fds, $name); if (!$fd) { $fd = new StdClass; @@ -259,7 +261,9 @@ function process_file($a, $v, $p, $name, $fds) { } else { $keypath = "$key_dir/code_sign_private"; if (is_file($keypath)) { - confirm_sig_gen($name); + if (!$no_conf) { + confirm_sig_gen($name); + } $handle = popen("bin/sign_executable $path $keypath", "r"); $fd->signature = fread($handle, 8192); pclose($handle); @@ -419,6 +423,7 @@ function convert_simplexml($x) { } function process_version($a, $v, $p) { + global $no_conf; echo "Found app version directory for: $a $v $p\n"; $app = lookup_app($a); parse_platform_name($p, $platform, $plan_class); @@ -467,12 +472,14 @@ function process_version($a, $v, $p) { // if API version isn't specified in version.xml, // try to find it embedded in the executable // - if (!strlen($vers->api_version)) { + if (!property_exists($vers, 'api_version') || !strlen($vers->api_version)) { $vers->api_version = get_api_version($a, $v, $p, $fds); } - if (!confirm($fds, $vers)) { - return; + if (!$no_conf) { + if (!confirm($fds, $vers)) { + return; + } } $xml = ""; @@ -550,6 +557,7 @@ function scan_apps() { } } +$no_conf = count($argv)>1 && $argv[1]='--no_conf'; scan_apps(); touch("reread_db"); // if feeder is running, tell it to reread DB