From 73a5044ef2d8a078e5a6f72bf58a5cce8fefa7d9 Mon Sep 17 00:00:00 2001 From: mappu Date: Sat, 10 May 2014 10:57:03 +1200 Subject: [PATCH] move cleaning into bat file --- rebuild.cmd | 9 +++++++++ rebuild.php | 37 ------------------------------------- 2 files changed, 9 insertions(+), 37 deletions(-) diff --git a/rebuild.cmd b/rebuild.cmd index 03c72f3..d1640cd 100644 --- a/rebuild.cmd +++ b/rebuild.cmd @@ -1,3 +1,12 @@ @echo off + +:: Clean target directory +rmdir /s /q wwwroot +mkdir wwwroot +mkdir wwwroot\srv +copy static\* wwwroot\srv + +:: Build pages C:\bin\php54\php.exe rebuild.php + pause \ No newline at end of file diff --git a/rebuild.php b/rebuild.php index 4bbddce..b980b8c 100644 --- a/rebuild.php +++ b/rebuild.php @@ -69,25 +69,6 @@ function mkspritesheet(array $handles, $dest_file, $width, $height) { } } -/** - * Remove a directory tree and all its contents. - * - * @author http://www.php.net/manual/en/function.rmdir.php#110489 - * @param string $dir - * @return boolean - */ -function rmdir_recursive($dir) { - $files = array_diff(scandir($dir), array('.','..')); - foreach ($files as $file) { - if (is_dir("$dir/$file")) { - rmdir_recursive("$dir/$file"); - } else { - unlink("$dir/$file"); - } - } - return rmdir($dir); -} - function fbytes($size, $suffixes='B|KiB|MiB|GiB|TiB') { $sxlist = explode('|', $suffixes); if ($size < 1024) { @@ -283,24 +264,6 @@ function template($title, $content) { function buildall() { - // Clean up webroot - - if (file_exists(BASEDIR.'wwwroot')) { - rmdir_recursive(BASEDIR.'wwwroot'); - } - - echo "Creating directories...\n"; - - mkdir(BASEDIR.'wwwroot'); - mkdir(BASEDIR.'wwwroot/srv'); - - // Copy in static files - - foreach(scandir(BASEDIR.'static') as $static) { - if ($static[0] == '.' || is_dir($static) /* fixme */) continue; - copy(BASEDIR.'static/'.$static, BASEDIR.'wwwroot/'.$static); - } - // List projects $ls = scandir(BASEDIR.'data');