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


PHP delTree函数代码示例

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


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

示例1: deletePost

 public static function deletePost($post_id)
 {
     //delete img
     //first get the post
     $post = self::getPost($post_id);
     //post->getImg
     $img = $post->getImagesPost();
     //foreach img delete img in the DB
     if ($img != NULL) {
         foreach ($img as $image) {
             DAL::deleteImg($image->getImg_id());
         }
         //then in the files (somthing like rmdir /images/posts/$postid -R) !!!this section might rise errors...
         $dir = 'images/posts/' . $post->getPost_id();
         $files = array_diff(scandir($dir), array('.', '..'));
         foreach ($files as $file) {
             is_dir("{$dir}/{$file}") ? delTree("{$dir}/{$file}") : unlink("{$dir}/{$file}");
         }
         rmdir($dir);
     }
     //then get votes
     $votes = $post->getVote_post();
     //foreach vote, unset it
     if ($votes != NULL) {
         foreach ($votes as $vote) {
             DAL::unsetVote_post($vote->getPost_id(), $vote->getUser()->getUsername());
         }
     }
     DAL::deletePost($post_id);
 }
开发者ID:Groger63,项目名称:something-memorable,代码行数:30,代码来源:postModel.php

示例2: delTree

	private function delTree($dir) {
		$files = array_diff(scandir($dir), array('.','..'));
		foreach ($files as $file) {
			(is_dir("$dir/$file")) ? delTree("$dir/$file") : unlink("$dir/$file");
		}
		return rmdir($dir);
	}
开发者ID:noikiy,项目名称:letstravel,代码行数:7,代码来源:DelcacheController.php

示例3: CheckLog

/**
* Check the given log file for all tests that match
* 
* @param mixed $logFile
* @param mixed $match
*/
function CheckLog($logFile, $match)
{
    global $count;
    echo "\r({$count}): Checking {$logFile}";
    $file = file_get_contents($logFile);
    if (stripos($file, $match) !== false) {
        $lines = explode("\n", $file);
        $file = '';
        foreach ($lines as $line) {
            if (stripos($line, $match) !== false) {
                $parseLine = str_replace("\t", "\t ", $line);
                $parts = explode("\t", $parseLine);
                $testId = trim($parts[4]);
                $testPath = './' . GetTestPath($testId);
                if (strlen($testPath)) {
                    delTree($testPath);
                    usleep(100000);
                    // give the system a chance to breathe
                    $count++;
                    echo "\r({$count}): Checking {$logFile}";
                }
            } else {
                $file .= $line . "\n";
            }
        }
        // rewrite the trimmed file
        file_put_contents($logFile, $file);
    } else {
        unset($file);
    }
}
开发者ID:NeilBryant,项目名称:webpagetest,代码行数:37,代码来源:prune.php

示例4: delTree

function delTree($dir)
{
    $files = array_diff(scandir($dir), array('.', '..'));
    foreach ($files as $file) {
        is_dir("{$dir}/{$file}") ? delTree("{$dir}/{$file}") : unlink("{$dir}/{$file}");
    }
    return rmdir($dir);
}
开发者ID:adelaparra,项目名称:el-encuentro,代码行数:8,代码来源:delete_evento.php

示例5: data_remove

function data_remove($file)
{
    if (file_exists("data/{$file}.php")) {
        unlink("data/{$file}.php");
    } elseif (is_dir("data/{$file}")) {
        delTree("data/{$file}");
    }
}
开发者ID:davidaq,项目名称:coopdev,代码行数:8,代码来源:index.php

示例6: ProcessAVIVideo

/**
* Convert an AVI video capture into the video frames the WPT is expecting
* 
* @param mixed $testPath
* @param mixed $run
* @param mixed $cached
*/
function ProcessAVIVideo(&$test, $testPath, $run, $cached)
{
    $cachedText = '';
    if ($cached) {
        $cachedText = '_Cached';
    }
    $videoFile = "{$testPath}/{$run}{$cachedText}_video.avi";
    $crop = '';
    if (!is_file($videoFile)) {
        $videoFile = "{$testPath}/{$run}{$cachedText}_video.mp4";
    }
    if (!is_file($videoFile)) {
        $crop = ',crop=in_w:in_h-80:0:80';
        $videoFile = "{$testPath}/{$run}{$cachedText}_appurify.mp4";
    }
    // trim the video to align with the capture if we have timestamps for both
    $renderStart = null;
    if (array_key_exists('appurify_tests', $test) && is_array($test['appurify_tests']) && array_key_exists($run, $test['appurify_tests']) && is_array($test['appurify_tests'][$run])) {
        require_once 'page_data.inc';
        $page_data = loadPageRunData($testPath, $run, $cached);
        if (isset($page_data) && is_array($page_data) && array_key_exists('render', $page_data)) {
            $renderStart = $page_data['render'];
        }
    }
    if (is_file($videoFile)) {
        $videoDir = "{$testPath}/video_{$run}" . strtolower($cachedText);
        if (!is_file("{$videoDir}/video.json")) {
            if (is_dir($videoDir)) {
                delTree($videoDir, false);
            }
            if (!is_dir($videoDir)) {
                mkdir($videoDir, 0777, true);
            }
            $videoFile = realpath($videoFile);
            $videoDir = realpath($videoDir);
            if (strlen($videoFile) && strlen($videoDir)) {
                if (Video2PNG($videoFile, $videoDir, $crop)) {
                    $startOffset = DevToolsGetVideoOffset($testPath, $run, $cached, $endTime);
                    FindAVIViewport($videoDir, $startOffset, $viewport);
                    EliminateDuplicateAVIFiles($videoDir, $viewport);
                    $lastImage = ProcessVideoFrames($videoDir, $renderStart, $viewport);
                    $screenShot = "{$testPath}/{$run}{$cachedText}_screen.jpg";
                    if (isset($lastImage) && is_file($lastImage)) {
                        //unlink($videoFile);
                        if (!is_file($screenShot)) {
                            copy($lastImage, $screenShot);
                        }
                    }
                }
            }
            $videoInfo = array();
            if (isset($viewport)) {
                $videoInfo['viewport'] = $viewport;
            }
            file_put_contents("{$videoDir}/video.json", json_encode($videoInfo));
        }
    }
}
开发者ID:JHand93,项目名称:WebPerformanceTestSuite,代码行数:65,代码来源:avi2frames.inc.php

示例7: delTree

function delTree($dir)
{
    global $ds;
    $files = array_diff(scandir($dir), array('.', '..'));
    foreach ($files as $file) {
        is_dir($dir . $ds . $file) ? delTree($dir . $ds . $file) : unlink($dir . $ds . $file);
    }
    return rmdir($dir);
}
开发者ID:Brakebein,项目名称:DokuVis,代码行数:9,代码来源:deleteProjectFolders.php

示例8: delTree

function delTree($dir)
{
    foreach (glob($dir) as $file) {
        if (is_dir($file)) {
            delTree("{$file}/*");
            rmdir($file);
        } else {
            unlink($file);
        }
    }
}
开发者ID:cinno,项目名称:sptoolkit,代码行数:11,代码来源:delete_package.php

示例9: ProcessAVIVideo

/**
* Convert an AVI video capture into the video frames the WPT is expecting
* 
* @param mixed $testPath
* @param mixed $run
* @param mixed $cached
*/
function ProcessAVIVideo(&$test, $testPath, $run, $cached)
{
    global $max_load;
    $cachedText = '';
    if ($cached) {
        $cachedText = '_Cached';
    }
    $videoFile = "{$testPath}/{$run}{$cachedText}_video.mp4";
    $crop = '';
    if (!is_file($videoFile)) {
        $videoFile = "{$testPath}/{$run}{$cachedText}_video.avi";
    }
    if (is_file($videoFile)) {
        $videoDir = "{$testPath}/video_{$run}" . strtolower($cachedText);
        if (!is_file("{$videoDir}/video.json")) {
            if (isset($max_load) && $max_load > 0) {
                WaitForSystemLoad($max_load, 3600);
            }
            if (is_dir($videoDir)) {
                delTree($videoDir, false);
            }
            if (!is_dir($videoDir)) {
                mkdir($videoDir, 0777, true);
            }
            $videoFile = realpath($videoFile);
            $videoDir = realpath($videoDir);
            if (strlen($videoFile) && strlen($videoDir)) {
                if (PythonVisualMetrics($videoFile, $videoDir, $testPath, $run, $cached)) {
                    unlink($videoFile);
                } else {
                    $crop = FindVideoCrop($videoFile, $videoDir);
                    if (Video2PNG($videoFile, $videoDir, $crop)) {
                        $startOffset = DevToolsGetVideoOffset($testPath, $run, $cached, $endTime);
                        FindAVIViewport($videoDir, $startOffset, $viewport);
                        EliminateDuplicateAVIFiles($videoDir, $viewport);
                        $lastImage = ProcessVideoFrames($videoDir, $viewport);
                        $screenShot = "{$testPath}/{$run}{$cachedText}_screen.jpg";
                        if (isset($lastImage) && is_file($lastImage)) {
                            unlink($videoFile);
                            if (!is_file($screenShot)) {
                                copy($lastImage, $screenShot);
                            }
                        }
                    }
                }
            }
            $videoInfo = array();
            if (isset($viewport)) {
                $videoInfo['viewport'] = $viewport;
            }
            file_put_contents("{$videoDir}/video.json", json_encode($videoInfo));
        }
    }
}
开发者ID:NeilBryant,项目名称:webpagetest,代码行数:61,代码来源:avi2frames.inc.php

示例10: delTree

function delTree($dir = '')
{
    if (strlen($dir) < 2) {
        return false;
    }
    $files = array_diff(scandir($dir), array('.', '..'));
    foreach ($files as $file) {
        is_dir("{$dir}/{$file}") ? delTree("{$dir}/{$file}") : unlink("{$dir}/{$file}");
    }
    return rmdir($dir);
}
开发者ID:jaredballou,项目名称:squad-tools,代码行数:11,代码来源:functions.php

示例11: delTree

 function delTree($dir)
 {
     foreach (glob($dir . '*') as $file) {
         $fileext = explode('/', $file);
         if (!strstr(end($fileext), '.')) {
             delTree($file . '/');
         } else {
             unlink($file);
         }
     }
     rmdir($dir);
 }
开发者ID:tylorwalls,项目名称:HemphillDotComASPNET,代码行数:12,代码来源:delete.php

示例12: delTree

function delTree($dir, $withdirectory = "true")
{
    $files = array_diff(scandir($dir), array('.', '..'));
    foreach ($files as $file) {
        is_dir("{$dir}/{$file}") ? delTree("{$dir}/{$file}") : unlink("{$dir}/{$file}");
    }
    if ($withdirectory) {
        return rmdir($dir);
    } else {
        return true;
    }
}
开发者ID:nsbasicus,项目名称:wallabag,代码行数:12,代码来源:install_functions.php

示例13: delTree

 private static function delTree($dir)
 {
     if (is_dir($dir)) {
         $files = array_diff(scandir($dir), array('.', '..'));
         foreach ($files as $file) {
             is_dir("{$dir}/{$file}") ? delTree("{$dir}/{$file}") : unlink("{$dir}/{$file}");
         }
         return rmdir($dir);
     } else {
         return true;
     }
 }
开发者ID:Shinowa86,项目名称:sepa-mod-fuelphp,代码行数:12,代码来源:Xmlgenerator.php

示例14: delTree

function delTree($dir)
{
    $files = glob($dir . '*', GLOB_MARK);
    foreach ($files as $file) {
        if (substr($file, -1) == '/') {
            delTree($file);
        } else {
            unlink($file);
        }
    }
    rmdir($dir);
}
开发者ID:biribogos,项目名称:wikihow-src,代码行数:12,代码来源:avatarImageDirUpdate.php

示例15: delTree

function delTree($dir)
{
    $files = array_diff(scandir($dir), array('.', '..'));
    foreach ($files as $file) {
        is_dir("{$dir}/{$file}") ? delTree("{$dir}/{$file}") : unlink("{$dir}/{$file}");
    }
    if (!preg_match('/ADODB_cache$/', $dir, $matches)) {
        echo 'Removing dir: ' . $dir;
        echo '<br>';
        rmdir($dir);
    }
}
开发者ID:manishkhanchandani,项目名称:mkgxy,代码行数:12,代码来源:index.php


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