当前位置: 首页>>代码示例>>PHP>>正文


PHP rm_rf函数代码示例

本文整理汇总了PHP中rm_rf函数的典型用法代码示例。如果您正苦于以下问题:PHP rm_rf函数的具体用法?PHP rm_rf怎么用?PHP rm_rf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了rm_rf函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: GetODSContent

function GetODSContent($path, $fdoc)
{
    $dirt = $path . $fdoc . '_temp';
    //unzip
    if (is_dir($dirt)) {
        rm_rf($dirt);
    } else {
    }
    mkdir($dirt);
    $zip = new ZipArchive();
    $zip->open($path . $fdoc);
    $zip->extractTo($dirt);
    $zip->close();
    //get content
    $fc = file($dirt . '/content.xml');
    $fc_str = implode('', $fc);
    $fc_str_r1 = str_replace(':', '__', $fc_str);
    $fc_str_r2 = str_replace('table-', 'table', $fc_str_r1);
    $content = simplexml_load_string($fc_str_r2);
    $body = $content->office__body;
    $sheet = $body->office__spreadsheet;
    $doc = array();
    foreach ($sheet->table__table as $table) {
        $tablename = $table['table__name'];
        $doc["{$tablename}"] = array();
        $nrow = 0;
        foreach ($table->table__tablerow as $row) {
            $doc["{$tablename}"][$nrow] = array();
            $ncell = 0;
            foreach ($row->table__tablecell as $cell) {
                $text = $cell->text__p;
                $text = trim($text);
                $text = str_replace('&', '&', $text);
                $text = str_replace('__', ':', $text);
                $doc["{$tablename}"][$nrow][$ncell] = $text;
                $ncell = $ncell + 1;
                $rep = $cell['table__number-columns-repeated'];
                if ($rep > 0 && $rep < 5) {
                    for ($ir = 0; $ir < $rep - 1; $ir++) {
                        $doc["{$tablename}"][$nrow][$ncell] = $text;
                        $ncell = $ncell + 1;
                    }
                } else {
                }
            }
            $nrow = $nrow + 1;
        }
    }
    rm_rf($dirt);
    return $doc;
}
开发者ID:kgbase,项目名称:KGBase,代码行数:51,代码来源:functions.php

示例2: wait_previous_call_terminate

function wait_previous_call_terminate($tmp_dir)
{
    $timeout = 0;
    while (is_dir($tmp_dir)) {
        echo "waiting for previous call to end\n";
        if ($timeout-- == 0) {
            // remove dead(?) dir
            rm_rf($tmp_dir);
            break;
        }
        sleep(1);
    }
    return mkdir($tmp_dir);
}
开发者ID:prigaux,项目名称:bandeau-ENT,代码行数:14,代码来源:gen-config-menu-from-uportal.php

示例3: delete

 function delete()
 {
     if ($this->input->post('bo_table')) {
         $bo_tables = array($this->input->post('bo_table'));
     } else {
         if ($this->input->post('chk')) {
             $bo_tables = $this->input->post('chk');
         } else {
             alert('잘못된 접근입니다.');
         }
     }
     // 게시판 폴더 삭제
     $this->load->dbforge();
     $this->load->helper('admin');
     $ca_types = array();
     foreach ($bo_tables as $bo_table) {
         $this->dbforge->drop_table('ki_extra_' . $bo_table);
         rm_rf(DATA_PATH . '/file/' . $bo_table);
         $ca_types[] = 'bo_' . $bo_table;
     }
     $this->Board_model->delete($bo_tables, $ca_types);
     goto_url(URL);
 }
开发者ID:ubiopen,项目名称:KI_Board,代码行数:23,代码来源:board.php

示例4: temp_dir

function temp_dir($default = false)
{
    global $ptmp, $prefix;
    if ($default) {
        if (!@is_dir($default)) {
            if (!mkdir_p($default)) {
                return false;
            }
        }
        /* try it really, is_writable is buggy with openbasedir */
        $fh = @fopen(realpath($default) . "/test", "wb");
        if ($fh) {
            $ptmp = $default;
            return true;
        } else {
            $ptmp = "failed";
            return false;
        }
    }
    $_temp = false;
    if (WINDOWS) {
        if (my_env('TEMP')) {
            $_temp = my_env('TEMP');
        } elseif (my_env('TMP')) {
            $_temp = my_env('TMP');
        } elseif (my_env('windir')) {
            $_temp = my_env('windir') . '\\temp';
        } elseif (my_env('SystemRoot')) {
            $_temp = my_env('SystemRoot') . '\\temp';
        }
        // handle ugly ENV var like \Temp instead of c:\Temp
        $dirs = explode("\\", realpath($_temp));
        if (strpos($_temp, ":") != 1) {
            unset($_temp);
            $_dirs = array();
            foreach ($dirs as $val) {
                if ((bool) $val) {
                    $_dirs[] = str_replace("/", "", $val);
                }
            }
            unset($dirs);
            $dirs = $_dirs;
            array_unshift($dirs, "c:");
            $_temp = $dirs[0];
            for ($i = 1; $i < count($dirs); $i++) {
                $_temp .= "//" . $dirs[$i];
            }
        }
        $ptmp = $_temp;
    } else {
        $_temp = my_env('TMPDIR');
        if (!$_temp) {
            if (is_writable('/tmp')) {
                $_temp = '/tmp';
            }
        }
    }
    // If for some reason the user has no rights to access to
    // the standard tempdir, we assume that he has the right
    // to access his prefix and choose $prefix/tmp as tempdir
    if (!$_temp) {
        print "System's Tempdir failed, trying to use \$prefix/tmp ...";
        $res = mkdir_p($prefix . '/tmp');
        if (!$res) {
            bail('mkdir ' . $prefix . '/tmp' . ' ... failed');
        }
        $ptmp = $prefix . '/tmp';
        $_temp = tempnam($prefix . '/tmp', 'gope');
        rm_rf($_temp);
        mkdir_p($_temp, 0700);
        $ok = @chdir($ptmp);
        if (!$ok) {
            // This should not happen, really ;)
            bail('chdir ' . $ptmp . ' ... failed');
        }
        print "ok\n";
        // Adjust TEMPDIR envvars
        if (!isset($_ENV)) {
            $_ENV = array();
        }
        $_ENV['TMPDIR'] = $_ENV['TEMP'] = $prefix . '/tmp';
    } else {
        $_temp = tempnam($_temp . '/tmp', 'gope');
    }
    $temp_dir = $ptmp = $_temp;
    return true;
}
开发者ID:swat30,项目名称:safeballot,代码行数:87,代码来源:go-pear.php

示例5: rm_rf

function rm_rf($file)
{
    if (file_exists($file)) {
        if (is_dir($file)) {
            $handle = opendir($file);
            while ($filename = readdir($handle)) {
                if ($filename != '.' && $filename != '..') {
                    rm_rf($file . '/' . $filename);
                }
            }
            closedir($handle);
            @chmod($file, G5_DIR_PERMISSION);
            @rmdir($file);
        } else {
            @chmod($file, G5_FILE_PERMISSION);
            @unlink($file);
        }
    }
}
开发者ID:dingdong2310,项目名称:g5_theme,代码行数:19,代码来源:admin.lib.php

示例6: sql_query

<?php

// board_delete.php , boardgroup_delete.php 에서 include 하는 파일
if (!defined('_GNUBOARD_')) {
    exit;
}
if (!defined('_BOARD_DELETE_')) {
    exit;
}
// 개별 페이지 접근 불가
// $tmp_bo_table 에는 $bo_table 값을 넘겨주어야 함
if (!$tmp_bo_table) {
    return;
}
// 게시판 1개는 삭제 불가 (게시판 복사를 위해서)
//$row = sql_fetch(" select count(*) as cnt from $g5['board_table'] ");
//if ($row['cnt'] <= 1) { return; }
// 게시판 설정 삭제
sql_query(" delete from {$g5['board_table']} where bo_table = '{$tmp_bo_table}' ");
// 최신글 삭제
sql_query(" delete from {$g5['board_new_table']} where bo_table = '{$tmp_bo_table}' ");
// 스크랩 삭제
sql_query(" delete from {$g5['scrap_table']} where bo_table = '{$tmp_bo_table}' ");
// 파일 삭제
sql_query(" delete from {$g5['board_file_table']} where bo_table = '{$tmp_bo_table}' ");
// 게시판 테이블 DROP
sql_query(" drop table {$g5['write_prefix']}{$tmp_bo_table} ", FALSE);
delete_cache_latest($tmp_bo_table);
// 게시판 폴더 전체 삭제
rm_rf(G5_DATA_PATH . '/file/' . $tmp_bo_table);
开发者ID:davis00,项目名称:test,代码行数:30,代码来源:board_delete.inc.php

示例7: rm_rf

function rm_rf($file)
{
    if (is_dir($file)) {
        if (!($dh = opendir($file))) {
            return false;
        }
        while (($entry = readdir($dh)) !== false) {
            if ($entry == '.' || $entry == '..') {
                continue;
            }
            if (!rm_rf($file . DIRECTORY_SEPARATOR . $entry)) {
                closedir($dh);
                return false;
            }
        }
        closedir($dh);
        return rmdir($file);
    } else {
        return unlink($file);
    }
}
开发者ID:jaz303,项目名称:zing,代码行数:21,代码来源:common.php

示例8: GetColl_ODBC_Content

         $coll = GetColl_ODBC_Content($src_data['coll']['src'], $src_data['coll']['user'], $src_data['coll']['pass']);
         $src_coll = collODS2xml($coll);
     } else {
     }
     if ($src_data['coll']['type'] == 'ODS') {
         $coll = GetODSContent($src_path['coll'], $src_data['coll']['file']);
         $src_coll = geoODS2xml($coll);
     } else {
     }
     $result = ExtCollGeoByTax($result, $tax_names, $src_coll, $src_geo, $control);
 }
 $res_collections = MakeCollIndex($src_path['collections'], $result['coll']);
 //load the base
 $basedir = $upl_path . '/' . $set[$nset]['name'];
 if (is_dir($basedir)) {
     rm_rf($basedir);
 } else {
 }
 mkdir($basedir);
 $base_index = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" standalone="yes"?><base></base>');
 $base_index->addChild('title', $set[$nset]['title']);
 $base_index->addChild('description', $set[$nset]['description']);
 $base_index->addChild('collection', $set[$nset]['collection']);
 $base_index->addChild('geodata', $set[$nset]['geodata']);
 $base_index->addChild('taxonomy', $set[$nset]['taxonomy']);
 $base_index->asXML($basedir . '/index.xml');
 $tax_xml->asXML($basedir . '/' . $set[$nset]['taxonomy']);
 $result['geo']->asXML($basedir . '/' . $set[$nset]['geodata']);
 $result['coll']->asXML($basedir . '/' . $set[$nset]['collection']);
 $res_collections->asXML($basedir . '/collections.xml');
 copy($src_path['map'] . '/' . $set[$nset]['map'] . '/blank.jpg', $basedir . '/blank.jpg');
开发者ID:kgbase,项目名称:KGBase,代码行数:31,代码来源:index.php

示例9: rm_rf

function rm_rf($file)
{
    if (file_exists($file)) {
        @chmod($file, 0777);
        if (is_dir($file)) {
            $handle = opendir($file);
            while ($filename = readdir($handle)) {
                if ($filename != "." && $filename != "..") {
                    rm_rf("{$file}/{$filename}");
                }
            }
            closedir($handle);
            rmdir($file);
        } else {
            unlink($file);
        }
    }
}
开发者ID:ragi79,项目名称:g4dtd,代码行数:18,代码来源:admin.lib.php

示例10: rm_rf

function rm_rf($path)
{
    if (@is_dir($path)) {
        $dp = opendir($path);
        while ($ent = readdir($dp)) {
            if ($ent == '.' || $ent == '..') {
                continue;
            }
            $file = $path . DIRECTORY_SEPARATOR . $ent;
            if (@is_dir($file)) {
                rm_rf($file);
            } else {
                unlink($file);
            }
        }
        closedir($dp);
        return rmdir($path);
    } else {
        return @unlink($path);
    }
}
开发者ID:pankajit,项目名称:carumba,代码行数:21,代码来源:go-pear.php

示例11: Archive_Tar

     }
 }
 if (!$error) {
     $tar = new Archive_Tar($pkg_name . '.tar.gz');
     $create = $tar->create(array($pkg_name));
     if (!$create) {
         $error = __("Could not re-tar");
     }
 }
 # Chmod files after everything has been done.
 if (!$error && !chmod_group($incoming_pkgdir)) {
     $error = __("Could not chmod directory %s.", $incoming_pkgdir);
 }
 # Whether it failed or not we can clean this out
 if (file_exists($tempdir)) {
     rm_rf($tempdir);
 }
 # Update the backend database
 if (!$error) {
     $dbh = db_connect();
     # This is an overwrite of an existing package, the database ID
     # needs to be preserved so that any votes are retained. However,
     # PackageDepends and PackageSources can be purged.
     $q = "SELECT * FROM Packages WHERE Name = '" . mysql_real_escape_string($new_pkgbuild['pkgname']) . "'";
     $result = db_query($q, $dbh);
     $pdata = mysql_fetch_assoc($result);
     if ($pdata) {
         # Flush out old data that will be replaced with new data
         $q = "DELETE FROM PackageDepends WHERE PackageID = " . $pdata["ID"];
         db_query($q, $dbh);
         $q = "DELETE FROM PackageSources WHERE PackageID = " . $pdata["ID"];
开发者ID:Zariel,项目名称:arch-aur,代码行数:31,代码来源:pkgsubmit.php

示例12: sql_query

<?php

// board_delete.php , boardgroup_delete.php 에서 include 하는 파일
if (!defined("_GNUBOARD_")) {
    exit;
}
if (!defined("_BOARD_DELETE_")) {
    exit;
}
// 개별 페이지 접근 불가
// $tmp_bo_table 에는 $bo_table 값을 넘겨주어야 함
if (!$tmp_bo_table) {
    return;
}
// 게시판 1개는 삭제 불가 (게시판 복사를 위해서)
//$row = sql_fetch(" select count(*) as cnt from $g4[board_table] ");
//if ($row[cnt] <= 1) { return; }
// 게시판 설정 삭제
sql_query(" delete from {$g4['board_table']} where bo_table = '{$tmp_bo_table}' ");
// 최신글 삭제
sql_query(" delete from {$g4['board_new_table']} where bo_table = '{$tmp_bo_table}' ");
// 스크랩 삭제
sql_query(" delete from {$g4['scrap_table']} where bo_table = '{$tmp_bo_table}' ");
// 파일 삭제
sql_query(" delete from {$g4['board_file_table']} where bo_table = '{$tmp_bo_table}' ");
// 게시판 테이블 DROP
sql_query(" drop table {$g4['write_prefix']}{$tmp_bo_table} ", FALSE);
// 게시판 폴더 전체 삭제
rm_rf("{$g4['path']}/data/file/{$tmp_bo_table}");
开发者ID:jin255ff,项目名称:company_website,代码行数:29,代码来源:board_delete.inc.php

示例13: rm_rf

function rm_rf($file)
{
    if (file_exists($file)) {
        @chmod($file, 0777);
        if (is_dir($file)) {
            $handle = opendir($file);
            while ($filename = readdir($handle)) {
                if ($filename != '.' && $filename != '..') {
                    rm_rf($file . '/' . $filename);
                }
            }
            closedir($handle);
            rmdir($file);
        } else {
            unlink($file);
        }
    }
}
开发者ID:ubiopen,项目名称:KI_Board,代码行数:18,代码来源:admin_helper.php

示例14: clean

function clean()
{
    $lock_fn = LIB_ROOT . 'install.lock';
    $lock_f = \fopen($lock_fn, 'w');
    @\chmod($lock_fn, 0666);
    if (!\flock($lock_f, LOCK_EX | LOCK_NB)) {
        echo 'Waiting for currently running installation to finish ...';
        \flock($lock_f, LOCK_EX);
        echo "\n";
    }
    foreach (get_libs() as $lib) {
        detect_props($lib);
        if (\array_key_exists('symlink', $lib)) {
            @\unlink(LIB_ROOT . $lib['symlink']);
        }
        rm_rf($lib['fn']);
        @\unlink($lib['fn'] . '.part');
        if ($lib['type'] == 'zip') {
            @\unlink($lib['fn'] . '.zip');
            @\unlink($lib['fn'] . '.zip.part');
        }
    }
    \flock($lock_f, LOCK_UN);
    \fclose($lock_f);
    \unlink($lock_fn);
}
开发者ID:nishad,项目名称:bmtmgr,代码行数:26,代码来源:install.php


注:本文中的rm_rf函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。