forked from laruence/yaf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.inc
44 lines (38 loc) · 1004 Bytes
/
build.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
define('DIR_ROOT', dirname(__FILE__));
define("APPLICATION_PATH", DIR_ROOT . '/application');
function shutdown($root = APPLICATION_PATH) {
$dp = opendir($root);
while (($dir = readdir($dp))) {
if (in_array($dir, array('.', '..'))) {
continue;
}
$path = $root . DIRECTORY_SEPARATOR . $dir;
if (is_dir($path)) {
shutdown($path);
} else if (is_file($path)) {
unlink($path);
}
}
rmdir($root);
}
function startup($root = APPLICATION_PATH) {
$dirs = array();
$dirs[] = 'controllers';
$dirs[] = 'actions';
$dirs[] = 'plugins';
$dirs[] = 'models';
$dirs[] = 'views';
$dirs[] = 'views/index';
$dirs[] = 'tpls';
$dirs[] = 'library';
$dirs[] = 'library/Test';
foreach($dirs as $dir){
$dir = $root . DIRECTORY_SEPARATOR . $dir;
if (!file_exists($dir)) {
mkdir($dir, 0755, true);
chmod($dir, 0755);
}
}
}
?>