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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
<?php $sub_menu = '100920'; include_once('./_common.php');
if ($is_admin != 'super') alert('최고관리자만 접근 가능합니다.', G5_URL);
$g5['title'] = '삭제된 상품 이미지 일괄삭제'; include_once('./admin.head.php');
$sql = "select it_id from {$g5['g5_shop_item_table']}"; $res = sql_query($sql); while($info=sql_fetch_array($res)){ $it_list[] = $info['it_id']; } ?>
<div class="local_desc02 local_desc"> <p> 완료 메세지가 나오기 전에 프로그램의 실행을 중지하지 마십시오. </p> </div>
<?php $directory = array(); $dl = array('item');
foreach($dl as $val) { if($handle = opendir(G5_DATA_PATH.'/'.$val)) { while(false !== ($entry = readdir($handle))) { if($entry == '.' || $entry == '..') continue;
$path = G5_DATA_PATH.'/'.$val.'/'.$entry;
if(is_dir($path)) $directory[] = $path; } } }
flush();
if (empty($directory)) { echo '<p>썸네일디렉토리를 열지못했습니다.</p>'; }
foreach($directory as $dir) { $dir_array = explode("/",$dir); $last_dir = $dir_array[count($dir_array)-1]; $flag = 0; for($i=0;$i<count($it_list);$i++){ if($it_list[$i]==$last_dir){ $flag = 1; } } if($flag==0){ $files = glob($dir.'/*'); if (is_array($files)) { foreach($files as $thumbnail) { $cnt++; @unlink($thumbnail);
echo '<li>'.$thumbnail.'</li>'.PHP_EOL;
flush();
if ($cnt%10==0) echo PHP_EOL; } } rmdir($dir); } }
/*$cnt=0; echo '<ul>'.PHP_EOL;
foreach($directory as $dir) { $files = glob($dir.'/thumb-*'); if (is_array($files)) { foreach($files as $thumbnail) { $cnt++; @unlink($thumbnail);
echo '<li>'.$thumbnail.'</li>'.PHP_EOL;
flush();
if ($cnt%10==0) echo PHP_EOL; } } }*/
echo '<li>완료됨</li></ul>'.PHP_EOL; echo '<div class="local_desc01 local_desc"><p><strong>삭제된 상품 이미지 일괄삭제 '.$cnt.'건의 삭제 완료됐습니다.</strong><br>프로그램의 실행을 끝마치셔도 좋습니다.</p></div>'.PHP_EOL; ?>
<?php include_once('./admin.tail.php'); ?>
|