move cleaning into bat file

This commit is contained in:
mappu 2014-05-10 10:57:03 +12:00
parent 6d8c943976
commit 73a5044ef2
2 changed files with 9 additions and 37 deletions

View File

@ -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

View File

@ -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');