move cleaning into bat file
This commit is contained in:
parent
6d8c943976
commit
73a5044ef2
@ -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
|
37
rebuild.php
37
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');
|
||||
|
Reference in New Issue
Block a user