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


PHP FileHandler::DeleteDirRecursive方法代码示例

本文整理汇总了PHP中FileHandler::DeleteDirRecursive方法的典型用法代码示例。如果您正苦于以下问题:PHP FileHandler::DeleteDirRecursive方法的具体用法?PHP FileHandler::DeleteDirRecursive怎么用?PHP FileHandler::DeleteDirRecursive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FileHandler的用法示例。


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

示例1: apiRejudge

 /**
  * Re-sends a problem to Grader.
  *
  * @param Request $r
  * @throws InvalidDatabaseOperationException
  */
 public static function apiRejudge(Request $r)
 {
     // Init
     self::initializeGrader();
     // Get the user who is calling this API
     self::authenticateRequest($r);
     self::validateDetailsRequest($r);
     if (!Authorization::CanEditRun($r['current_user_id'], $r['run'])) {
         throw new ForbiddenAccessException('userNotAllowed');
     }
     self::$log->info('Run being rejudged!!');
     // Try to delete existing directory, if exists.
     try {
         $grade_dir = RunController::getGradePath($r['run']);
         FileHandler::DeleteDirRecursive($grade_dir);
     } catch (Exception $e) {
         // Soft error :P
         self::$log->warn($e);
     }
     try {
         self::$grader->Grade([$r['run']->guid], true, $r['debug'] || false);
     } catch (Exception $e) {
         self::$log->error('Call to Grader::grade() failed:');
         self::$log->error($e);
     }
     $response = array();
     $response['status'] = 'ok';
     self::invalidateCacheOnRejudge($r['run']);
     // Expire ranks
     UserController::deleteProblemsSolvedRankCacheList();
     return $response;
 }
开发者ID:andreasantillana,项目名称:omegaup,代码行数:38,代码来源:RunController.php

示例2: ZipArchive

                    $zip = new ZipArchive();
                    $zip->open("{$dirname}/interactive.zip", ZipArchive::CREATE | ZipArchive::OVERWRITE);
                    $files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dirname), RecursiveIteratorIterator::LEAVES_ONLY);
                    foreach ($files as $name => $file) {
                        if ($file->isDir()) {
                            continue;
                        }
                        if ($file->getFilename() == 'interactive.zip') {
                            continue;
                        }
                        $filePath = $file->getRealPath();
                        $relativePath = substr($filePath, strlen($dirname) + 1);
                        // Add current file to archive
                        $zip->addFile($filePath, $relativePath);
                    }
                    $zip->close();
                    header('Content-Type: application/zip');
                    header("Content-Disposition: attachment; filename={$_POST['name']}.zip");
                    readfile("{$dirname}/interactive.zip");
                    FileHandler::DeleteDirRecursive($dirname);
                    die;
                }
            }
        } catch (Exception $e) {
            $smarty->assign('error', $e);
        } finally {
            FileHandler::DeleteDirRecursive($dirname);
        }
    }
}
$smarty->display('../../../templates/libinteractive.gen.tpl');
开发者ID:andreasantillana,项目名称:omegaup,代码行数:31,代码来源:index.php

示例3: cleanup

 public function cleanup()
 {
     if ($this->tmpDir != null && is_dir($this->tmpDir)) {
         FileHandler::DeleteDirRecursive($this->tmpDir);
     }
     // Something went wrong and the target directory was not committed. Rollback.
     if ($this->created && !file_exists($this->targetDir)) {
         FileHandler::DeleteDirRecursive($this->gitDir);
     }
 }
开发者ID:RicardoMelgoza,项目名称:omegaup,代码行数:10,代码来源:ProblemDeployer.php

示例4: CleanPath

 static function CleanPath($path)
 {
     FileHandler::DeleteDirRecursive($path);
     mkdir($path, 0755, true);
 }
开发者ID:kukogit,项目名称:omegaup,代码行数:5,代码来源:Utils.php


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