diff --git a/lib/bootstrap.php b/lib/bootstrap.php index 87351b0..93b2537 100755 --- a/lib/bootstrap.php +++ b/lib/bootstrap.php @@ -46,6 +46,9 @@ function main($args) { if (array_key_exists('redirect', $config)) { buildredirects( $config['redirect'] ); } + if (array_key_exists('golang-subpackages', $config)) { + buildgosubpackages( $config['golang-subpackages'] ); + } } else { buildprojects($pos, array_decimate(listprojects(), $total, $pos)); } diff --git a/lib/template.php b/lib/template.php index b588b89..d12f756 100644 --- a/lib/template.php +++ b/lib/template.php @@ -194,3 +194,19 @@ function buildredirects($redirects) { file_put_contents(BASEDIR.'wwwroot/'.$oldname.'/index.html', $page); } } + +function buildgosubpackages($packages) { + foreach($packages as $path => $goGetStr) { + + $page = ( + ''. + "\n". + redirecthtml(BASEURL) + ); + + // new directory format only + mkdir_all(BASEDIR.'wwwroot/'.$path); + file_put_contents(BASEDIR.'wwwroot/'.$path.'/index.html', $page); + + } +} diff --git a/lib/util.php b/lib/util.php index 5f274c0..2964a02 100644 --- a/lib/util.php +++ b/lib/util.php @@ -109,6 +109,11 @@ function hesc($sz) { return @htmlentities($sz, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'); } +function mkdir_all($path) { + $epath = escapeshellarg($path); + `mkdir -p ${epath}`; +} + function text2html($sz) { $identity = function($sz) {