<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Chakkrit Tantithamthavorn&#039;s Official Personal Website &#187; permission</title>
	<atom:link href="http://www.klainfo.com/tag/permission/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.klainfo.com</link>
	<description></description>
	<lastBuildDate>Wed, 01 Feb 2012 13:12:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>[PHP] Delete Apache owned files and folders</title>
		<link>http://www.klainfo.com/2010/01/24/php-delete-apache-owned-files-and-folders/</link>
		<comments>http://www.klainfo.com/2010/01/24/php-delete-apache-owned-files-and-folders/#comments</comments>
		<pubDate>Sun, 24 Jan 2010 05:22:55 +0000</pubDate>
		<dc:creator>klainfo</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[permission]]></category>

		<guid isPermaLink="false">http://blog.klainfo.com/?p=586</guid>
		<description><![CDATA[เนื่องจากผมใช้ Doku wiki แล้ว Apache มันสร้าง cache ขึ้นมาเอง แล้วผมอยากจะลบมัน ปรากฏว่าผมลบไฟล์ไม่ได้ เนื่องจากผมไม่ใช่ Root แล้วเป็นไฟล์ที่ Apache สร้างขึ้นด้วย นั่งขุดคุ้ยหา script php มาลบให้มันละกัน ทำตามนี้โลด 1 2 3 4 5 6 7 8 9 10 11 12 13 14 &#60;?php function SureRemoveDir&#40;$dir&#41; &#123; if&#40;!$dh = @opendir&#40;$dir&#41;&#41; return; while &#40;&#40;$obj = readdir&#40;$dh&#41;&#41;&#41; &#123; if&#40;$obj==‘.’ &#124;&#124; $obj==‘..’&#41; continue; if &#40;!@unlink&#40;$dir.‘/’.$obj&#41;&#41; &#123; SureRemoveDir&#40;$dir.‘/’.$obj&#41;; [...]]]></description>
			<content:encoded><![CDATA[<p>เนื่องจากผมใช้ Doku wiki แล้ว Apache มันสร้าง cache ขึ้นมาเอง แล้วผมอยากจะลบมัน ปรากฏว่าผมลบไฟล์ไม่ได้ เนื่องจากผมไม่ใช่ Root แล้วเป็นไฟล์ที่ Apache สร้างขึ้นด้วย</p>
<p>นั่งขุดคุ้ยหา script php มาลบให้มันละกัน ทำตามนี้โลด</p>
<div class="wp_syntax">
<table>
<tr>
<td class="line_numbers">
<pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre>
</td>
<td class="code">
<pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000000; font-weight: bold;">function</span> SureRemoveDir<span style="color: #009900;">&#40;</span><span style="color: #000088;">$dir</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$dh</span> <span style="color: #339933;">=</span> <span style="color: #339933;">@</span><span style="color: #990000;">opendir</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$dir</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">return</span><span style="color: #339933;">;</span>
      <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$obj</span> <span style="color: #339933;">=</span> <span style="color: #990000;">readdir</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$dh</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$obj</span><span style="color: #339933;">==</span>‘<span style="color: #339933;">.</span>’ <span style="color: #339933;">||</span> <span style="color: #000088;">$obj</span><span style="color: #339933;">==</span>‘<span style="color: #339933;">..</span>’<span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">continue</span><span style="color: #339933;">;</span>
            <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!@</span><span style="color: #990000;">unlink</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$dir</span><span style="color: #339933;">.</span>‘<span style="color: #339933;">/</span>’<span style="color: #339933;">.</span><span style="color: #000088;">$obj</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
SureRemoveDir<span style="color: #009900;">&#40;</span><span style="color: #000088;">$dir</span><span style="color: #339933;">.</span>‘<span style="color: #339933;">/</span>’<span style="color: #339933;">.</span><span style="color: #000088;">$obj</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
                   <span style="color: #000088;">$file_deleted</span><span style="color: #339933;">++;</span>
            <span style="color: #009900;">&#125;</span>
      <span style="color: #009900;">&#125;</span>
      <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">@</span><span style="color: #990000;">rmdir</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$dir</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$dir_deleted</span><span style="color: #339933;">++;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre>
</td>
</tr>
</table>
</div>
<p>วิธีเรียกใช้ก็ง่ายๆ ตามนี้เลยครับ โดยใส่ชื่อ Directory ลงไปแทนคำว่า Test</p>
<p>เสร็จแล้ว เย่ๆ ^^</p>
]]></content:encoded>
			<wfw:commentRss>http://www.klainfo.com/2010/01/24/php-delete-apache-owned-files-and-folders/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Served from: www.klainfo.com @ 2012-02-08 07:34:29 -->
