<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[FrontAccounting forum — Extension tmp folder no flush?]]></title>
	<link rel="self" href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=3642&amp;type=atom" />
	<updated>2012-12-18T10:30:02Z</updated>
	<generator>PunBB</generator>
	<id>https://frontaccounting.com/punbb/viewtopic.php?id=3642</id>
		<entry>
			<title type="html"><![CDATA[Re: Extension tmp folder no flush?]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=14684#p14684" />
			<content type="html"><![CDATA[<p>You&#039;re right Janusz, but it is used in many places acceptably.</p><p>The said function is called in:<br /></p><div class="quotebox"><blockquote><p>includes\current_user.inc <br />&nbsp; &nbsp; Line 613: function flush_dir($path, $wipe = false) <br />&nbsp; &nbsp; Line 621: &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;flush_dir($path.&#039;/&#039;.$fname, $wipe);<br />&nbsp; includes\packages.inc <br />&nbsp; &nbsp; <strong>Line 29: //&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; flush_dir($basedir, true); </strong><br />&nbsp; &nbsp; Line 102: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; flush_dir($targetdir, true);<br />&nbsp; &nbsp; Line 428: &nbsp; &nbsp; &nbsp; &nbsp; flush_dir(PKG_CACHE_PATH.&#039;/&#039;.$name, true);<br />&nbsp; includes\lang\language.php &nbsp; &nbsp; Line 59: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; flush_dir(company_path().&#039;/js_cache&#039;);<br />&nbsp; admin\db\company_db.inc &nbsp; &nbsp; Line 92: &nbsp; &nbsp; flush_dir(company_path().&#039;/js_cache&#039;); // clear cache<br />&nbsp; admin\inst_theme.php &nbsp; &nbsp; Line 55: &nbsp; &nbsp; &nbsp; &nbsp; flush_dir($dirname, true);<br />&nbsp; admin\inst_lang.php &nbsp; &nbsp; Line 256: &nbsp; &nbsp; &nbsp; &nbsp; flush_dir($dirname, true);<br />&nbsp; admin\display_prefs.php&nbsp; &nbsp; Line 51: &nbsp; &nbsp; &nbsp; &nbsp; flush_dir(company_path().&#039;/js_cache&#039;);&nbsp; &nbsp; <br />&nbsp; admin\create_coy.php &nbsp; &nbsp; Line 226: &nbsp; &nbsp; @flush_dir($tmpname, true);</p></blockquote></div><p>The function can be altered to reflect the <strong>hg</strong> repo files since CVS is no longer used:<br /></p><div class="codebox"><pre><code>function flush_dir($path, $wipe = false) 
{
    $dir = opendir($path);
    if(!$dir)
        return;
    while(false !== ($fname = readdir($dir))) {
        if($fname==&#039;.&#039; || $fname==&#039;..&#039; || $fname==&#039;CVS&#039; || (!$wipe &amp;&amp; $fname==&#039;index.php&#039;)) continue;
          if(is_dir($path.&#039;/&#039;.$fname)) {
            flush_dir($path.&#039;/&#039;.$fname, $wipe);
            if ($wipe) @rmdir($path.&#039;/&#039;.$fname);
        } else
            @unlink($path.&#039;/&#039;.$fname);
    }
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2012-12-18T10:30:02Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=14684#p14684</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Extension tmp folder no flush?]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=14683#p14683" />
			<content type="html"><![CDATA[<p>I&#039;m not sure what are you talking about ? The flush_file is potentially damaging function, which delete entirely the selected folder and all its subfolders recursively. This is not part of any library, just the FA function declared in current_user.inc file<br />Janusz</p>]]></content>
			<author>
				<name><![CDATA[itronics]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=89</uri>
			</author>
			<updated>2012-12-18T09:04:18Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=14683#p14683</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Extension tmp folder no flush?]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=14674#p14674" />
			<content type="html"><![CDATA[<p>It is actually on the &quot;not-safe side&quot; unless we try to delete a non existant folder which is covered by the &quot;if&quot; check. </p><p>The said library file has been used in numerous open source projects and not even in one of them is it commented out.</p><p>Some projects it is in use are:<br />LifeType<br />OntoWiki<br />ZenPhoto<br />Automne-CMS<br />b2evolution</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2012-12-18T07:52:27Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=14674#p14674</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Extension tmp folder no flush?]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=14669#p14669" />
			<content type="html"><![CDATA[<p>Can&#039;t remember, seems here was some problem in the past, so just for security reasons it was commented out (just to be on safe side).<br />Janusz</p>]]></content>
			<author>
				<name><![CDATA[itronics]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=89</uri>
			</author>
			<updated>2012-12-18T07:16:54Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=14669#p14669</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Extension tmp folder no flush?]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=14629#p14629" />
			<content type="html"><![CDATA[<p>In the file <strong>includes/packages.inc</strong>, why was line 29 commented out?<br /></p><div class="codebox"><pre><code>class package extends gzip_file {
    function package($filename, $basedir=null)
    {
        global $path_to_root;

        if (!$basedir) {
            $basedir = PKG_CACHE_PATH.&#039;/&#039;.substr(basename($filename), 0, -4);
            if (file_exists($basedir)) {
//                flush_dir($basedir, true); 
            } else
            mkdir($basedir);
        }</code></pre></div>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2012-12-14T09:19:01Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=14629#p14629</id>
		</entry>
</feed>
