function create_app_dir() { global $app_name, $app_id, $platform, $wrapper_filename; global $wrapper_md5; $i = 0; $latest_i = -1; $have_latest_wrapper = false; while (1) { $app_dir = app_version_dir($app_name, $i, $platform); if (!file_exists($app_dir)) { break; } $latest_i = $i; $i++; } if ($latest_i >= 0) { $i = $latest_i; $app_dir = app_version_dir($app_name, $i, $platform); $file = "{$app_dir}/" . $app_name . "_1." . $i; $latest_md5 = md5_file($file); if ($latest_md5 == $wrapper_md5) { $have_latest_wrapper = true; echo "App version is current.\n"; } else { echo "{$latest_md5} != {$wrapper_md5}\n"; } } if ($have_latest_wrapper) { echo "Current wrapper already installed.\n"; // make sure they ran update_versions // $av = BoincAppVersion::lookup("appid={$app_id} and version_num={$i}"); if (!$av) { echo "- type 'bin/update_versions', and answer 'y' to all questions.\n"; } } else { echo "Installing current wrapper.\n"; $i = $latest_i + 1; $app_dir = app_version_dir($app_name, $i, $platform); if (make_app_version_dir($app_name, $i, $platform)) { error("Couldn't create dir: {$app_dir}"); } $file = "{$app_dir}/{$app_name}" . "_1." . $i; if (!copy($wrapper_filename, $file)) { error("Couldn't copy {$wrapper_filename} to {$file}"); } chmod($file, 0750); echo "- type 'bin/update_versions', and answer 'y' to all questions.\n"; } }
function av_string($av_id) { if ($av_id > 0) { $av = BoincAppVersion::lookup($av_id); $plat = BoincPlatform::lookup_id($av->platformid); $x = "<a href=credit.php?av_id={$av_id}>{$plat->name} {$av->plan_class}</a>"; } else { $x = "Anonymous platform"; } return $x; }