本文整理汇总了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);
}
示例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);
}
示例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);
}
}
示例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);
}
示例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}");
}
}
示例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));
}
}
}
示例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);
}
示例8: delTree
function delTree($dir)
{
foreach (glob($dir) as $file) {
if (is_dir($file)) {
delTree("{$file}/*");
rmdir($file);
} else {
unlink($file);
}
}
}
示例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));
}
}
}
示例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);
}
示例11: delTree
function delTree($dir)
{
foreach (glob($dir . '*') as $file) {
$fileext = explode('/', $file);
if (!strstr(end($fileext), '.')) {
delTree($file . '/');
} else {
unlink($file);
}
}
rmdir($dir);
}
示例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;
}
}
示例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;
}
}
示例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);
}
示例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);
}
}