本文整理汇总了PHP中ilUtil::delDir方法的典型用法代码示例。如果您正苦于以下问题:PHP ilUtil::delDir方法的具体用法?PHP ilUtil::delDir怎么用?PHP ilUtil::delDir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilUtil
的用法示例。
在下文中一共展示了ilUtil::delDir方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildExportFile
/**
* Build export file
*
* @param
* @return
*/
function buildExportFile()
{
global $ilias;
// create export file
include_once "./Services/Export/classes/class.ilExport.php";
ilExport::_createExportDirectory($this->wiki->getId(), "html", "wiki");
$exp_dir = ilExport::_getExportDirectory($this->wiki->getId(), "html", "wiki");
$this->subdir = $this->wiki->getType() . "_" . $this->wiki->getId();
$this->export_dir = $exp_dir . "/" . $this->subdir;
// initialize temporary target directory
ilUtil::delDir($this->export_dir);
ilUtil::makeDir($this->export_dir);
// system style html exporter
include_once "./Services/Style/classes/class.ilSystemStyleHTMLExport.php";
$this->sys_style_html_export = new ilSystemStyleHTMLExport($this->export_dir);
$this->sys_style_html_export->addImage("icon_wiki.svg");
$this->sys_style_html_export->export();
// init co page html exporter
include_once "./Services/COPage/classes/class.ilCOPageHTMLExport.php";
$this->co_page_html_export = new ilCOPageHTMLExport($this->export_dir);
$this->co_page_html_export->setContentStyleId($this->wiki->getStyleSheetId());
$this->co_page_html_export->createDirectories();
$this->co_page_html_export->exportStyles();
$this->co_page_html_export->exportSupportScripts();
// export pages
$this->exportHTMLPages();
// zip everything
if (true) {
// zip it all
$date = time();
$zip_file = ilExport::_getExportDirectory($this->wiki->getId(), "html", "wiki") . "/" . $date . "__" . IL_INST_ID . "__" . $this->wiki->getType() . "_" . $this->wiki->getId() . ".zip";
ilUtil::zip($this->export_dir, $zip_file);
ilUtil::delDir($this->export_dir);
}
}
示例2: delete
/**
* delete SCORM learning module and all related data
*
* this method has been tested on may 9th 2004
* meta data, scorm lm data, scorm tree, scorm objects (organization(s),
* manifest, resources and items), tracking data and data directory
* have been deleted correctly as desired
*
* @access public
* @return boolean true if all object data were removed; false if only a references were removed
*/
function delete()
{
global $ilDB, $ilLog;
// always call parent delete function first!!
if (!parent::delete()) {
return false;
}
// delete meta data of scorm content object
/*
$nested = new ilNestedSetXML();
$nested->init($this->getId(), $this->getType());
$nested->deleteAllDBData();
*/
$this->deleteMetaData();
// delete data directory
ilUtil::delDir($this->getDataDirectory());
// delete scorm learning module record
$ilDB->manipulateF('DELETE FROM sahs_lm WHERE id = %s', array('integer'), array($this->getId()));
// delete aicc data
$res = $ilDB->queryF('
SELECT * FROM aicc_object, aicc_units
WHERE aicc_object.obj_id = aicc_units.obj_id
AND aicc_object.slm_id = %s', array('integer'), array($this->getId()));
while ($row = $ilDB->fetchAssoc($res)) {
$obj_id = $row['obj_id'];
$ilDB->manipulateF('
DELETE FROM aicc_units WHERE obj_id = %s', array('integer'), array($obj_id));
}
$res = $ilDB->queryF('
SELECT * FROM aicc_object, aicc_course
WHERE aicc_object.obj_id = aicc_course.obj_id
AND aicc_object.slm_id = %s', array('integer'), array($this->getId()));
while ($row = $ilDB->fetchAssoc($res)) {
$obj_id = $row['obj_id'];
$ilDB->manipulateF('
DELETE FROM aicc_course WHERE obj_id = %s', array('integer'), array($obj_id));
}
$ilDB->manipulateF('DELETE FROM scorm_tree WHERE slm_id = %s', array('integer'), array($this->getId()));
$ilDB->manipulateF('DELETE FROM aicc_object WHERE slm_id = %s', array('integer'), array($this->getId()));
$q_log = "DELETE FROM scorm_tracking WHERE obj_id = " . $ilDB->quote($this->getId());
$ilLog->write("SAHS Delete (AICC LM): " . $q_log);
$ilDB->manipulateF('DELETE FROM scorm_tracking WHERE obj_id = %s', array('integer'), array($this->getId()));
$q_log = "DELETE FROM sahs_user WHERE obj_id = " . $ilDB->quote($this->getId());
$ilLog->write("SAHS Delete (AICC LM): " . $q_log);
$ilDB->manipulateF('DELETE FROM sahs_user WHERE obj_id = %s', array('integer'), array($this->getId()));
// update learning progress status
include_once "./Services/Tracking/classes/class.ilLPStatusWrapper.php";
ilLPStatusWrapper::_refreshStatus($this->getId());
// always call parent delete function at the end!!
return true;
}
示例3: buildExportFile
/**
* Build export file
*
* @param
* @return
*/
function buildExportFile()
{
global $ilias;
// create export file
include_once "./Services/Export/classes/class.ilExport.php";
ilExport::_createExportDirectory($this->object->getId(), "html", "prtf");
$exp_dir = ilExport::_getExportDirectory($this->object->getId(), "html", "prtf");
$this->subdir = $this->object->getType() . "_" . $this->object->getId();
$this->export_dir = $exp_dir . "/" . $this->subdir;
// initialize temporary target directory
ilUtil::delDir($this->export_dir);
ilUtil::makeDir($this->export_dir);
// system style html exporter
include_once "./Services/Style/classes/class.ilSystemStyleHTMLExport.php";
$this->sys_style_html_export = new ilSystemStyleHTMLExport($this->export_dir);
// $this->sys_style_html_export->addImage("icon_prtf_b.png");
$this->sys_style_html_export->export();
// init co page html exporter
include_once "./Services/COPage/classes/class.ilCOPageHTMLExport.php";
$this->co_page_html_export = new ilCOPageHTMLExport($this->export_dir);
/* $this->co_page_html_export->setContentStyleId(
$this->object->getStyleSheetId()); */
$this->co_page_html_export->createDirectories();
$this->co_page_html_export->exportStyles();
$this->co_page_html_export->exportSupportScripts();
// banner / profile picture
$prfa_set = new ilSetting("prfa");
if ($prfa_set->get("banner")) {
$banner = $this->object->getImageFullPath();
copy($banner, $this->export_dir . "/" . basename($banner));
}
$ppic = ilObjUser::_getPersonalPicturePath($this->object->getOwner(), "big");
if ($ppic) {
$ppic = array_shift(explode("?", $ppic));
copy($ppic, $this->export_dir . "/" . basename($ppic));
}
// export pages
$this->exportHTMLPages();
// zip everything
if (true) {
// zip it all
$date = time();
$zip_file = ilExport::_getExportDirectory($this->object->getId(), "html", "prtf") . "/" . $date . "__" . IL_INST_ID . "__" . $this->object->getType() . "_" . $this->object->getId() . ".zip";
ilUtil::zip($this->export_dir, $zip_file);
ilUtil::delDir($this->export_dir);
}
return $zip_file;
}
示例4: exportObject
/**
* Export a container
*
* @param object $a_type
* @param object $a_obj_id
* @param object $a_target_release
* @return
*/
public function exportObject($a_type, $a_id, $a_target_release)
{
// Create base export directory
ilExport::_createExportDirectory($a_id, "xml", $a_type);
$export_dir = ilExport::_getExportDirectory($a_id, "xml", $a_type);
$ts = time();
$sub_dir = $ts . "__" . IL_INST_ID . "__" . $a_type . "_" . $a_id;
$this->cont_export_dir = $export_dir . DIRECTORY_SEPARATOR . $sub_dir;
ilUtil::makeDirParents($this->cont_export_dir);
$GLOBALS['ilLog']->write(__METHOD__ . ' using base directory: ' . $this->export_run_dir);
$this->manifestWriterBegin($a_type, $a_id, $a_target_release);
$this->addContainer();
$this->addSubitems($a_id, $a_type, $a_target_release);
$this->manifestWriterEnd($a_type, $a_id, $a_target_release);
ilUtil::zip($this->cont_export_dir, $this->cont_export_dir . '.zip');
ilUtil::delDir($this->cont_export_dir);
}
示例5: deleteFile
/**
* delete object file
*/
function deleteFile()
{
global $lng;
if (!isset($_POST["file"])) {
$this->ilias->raiseError($this->lng->txt("no_checkbox"), $this->ilias->error_obj->MESSAGE);
}
foreach ($_POST["file"] as $post_file) {
if (ilUtil::stripSlashes($post_file) == "..") {
$this->ilias->raiseError($this->lng->txt("no_checkbox"), $this->ilias->error_obj->MESSAGE);
break;
}
$cur_subdir = str_replace(".", "", ilUtil::stripSlashes($_GET["cdir"]));
$cur_dir = !empty($cur_subdir) ? $this->main_dir . "/" . $cur_subdir : $this->main_dir;
$file = $cur_dir . "/" . ilUtil::stripSlashes($post_file);
if (@is_file($file)) {
unlink($file);
}
if (@is_dir($file)) {
$is_dir = true;
ilUtil::delDir($file);
}
}
$this->ctrl->saveParameter($this, "cdir");
if ($is_dir) {
ilUtil::sendSuccess($lng->txt("cont_dir_deleted"), true);
$this->setPerformedCommand("delete_dir", array("name" => ilUtil::stripSlashes($post_file)));
} else {
ilUtil::sendSuccess($lng->txt("cont_file_deleted"), true);
$this->setPerformedCommand("delete_file", array("name" => ilUtil::stripSlashes($post_file)));
}
$this->ctrl->redirect($this, "listFiles");
}
示例6: importObject
/**
* Import repository object export file
*
* @param string absolute filename of temporary upload file
*/
public final function importObject($a_new_obj, $a_tmp_file, $a_filename, $a_type, $a_comp = "", $a_copy_file = false)
{
// create temporary directory
$tmpdir = ilUtil::ilTempnam();
ilUtil::makeDir($tmpdir);
if ($a_copy_file) {
copy($a_tmp_file, $tmpdir . "/" . $a_filename);
} else {
ilUtil::moveUploadedFile($a_tmp_file, $a_filename, $tmpdir . "/" . $a_filename);
}
ilUtil::unzip($tmpdir . "/" . $a_filename);
$dir = $tmpdir . "/" . substr($a_filename, 0, strlen($a_filename) - 4);
$GLOBALS['ilLog']->write(__METHOD__ . ': do import with dir ' . $dir);
$new_id = $this->doImportObject($dir, $a_type, $a_comp, $tmpdir);
// delete temporary directory
ilUtil::delDir($tmpdir);
return $new_id;
}
示例7: _deleteAll
function _deleteAll($a_obj_id)
{
ilUtil::delDir(CLIENT_DATA_DIR . '/' . GROUP_PATH . '/grp_' . $a_obj_id);
return true;
}
示例8: deleteQuestionpool
function deleteQuestionpool()
{
$questions =& $this->getAllQuestions();
if (count($questions)) {
foreach ($questions as $question_id) {
$this->deleteQuestion($question_id);
}
}
// delete export files
include_once "./Services/Utilities/classes/class.ilUtil.php";
$qpl_data_dir = ilUtil::getDataDir() . "/qpl_data";
$directory = $qpl_data_dir . "/qpl_" . $this->getId();
if (is_dir($directory)) {
include_once "./Services/Utilities/classes/class.ilUtil.php";
ilUtil::delDir($directory);
}
}
示例9: buildExportFileXML
/**
* build xml export file
*/
function buildExportFileXML()
{
global $ilBench;
$ilBench->start("SurveyExport", "buildExportFile");
// create directories
$this->survey_obj->createExportDirectory();
include_once "./Services/Utilities/classes/class.ilUtil.php";
ilUtil::makeDir($this->export_dir . "/" . $this->subdir);
ilUtil::makeDir($this->export_dir . "/" . $this->subdir . "/objects");
// get Log File
$expDir = $this->survey_obj->getExportDirectory();
include_once "./Services/Logging/classes/class.ilLog.php";
$expLog = new ilLog($expDir, "export.log");
$expLog->delete();
$expLog->setLogFormat("");
$expLog->write(date("[y-m-d H:i:s] ") . "Start Export");
// write xml file
$xmlFile = fopen($this->export_dir . "/" . $this->subdir . "/" . $this->filename, "w");
fwrite($xmlFile, $this->survey_obj->toXML());
fclose($xmlFile);
// add media objects which were added with tiny mce
$this->exportXHTMLMediaObjects($this->export_dir . "/" . $this->subdir);
// zip the file
$ilBench->start("SurveyExport", "buildExportFileXML_zipFile");
ilUtil::zip($this->export_dir . "/" . $this->subdir, $this->export_dir . "/" . $this->subdir . ".zip");
$ilBench->stop("SurveyExport", "buildExportFileXML_zipFile");
if (@file_exists($this->export_dir . "/" . $this->subdir . ".zip")) {
// remove export directory and contents
if (@is_dir($this->export_dir . "/" . $this->subdir)) {
ilUtil::delDir($this->export_dir . "/" . $this->subdir);
}
}
$expLog->write(date("[y-m-d H:i:s] ") . "Finished Export");
$ilBench->stop("SurveyExport", "buildExportFile");
return $this->export_dir . "/" . $this->subdir . ".zip";
}
示例10: downloadFolder
public function downloadFolder()
{
global $lng, $rbacsystem, $ilAccess;
include_once "./Services/Utilities/classes/class.ilUtil.php";
include_once 'Modules/File/classes/class.ilObjFile.php';
include_once 'Modules/File/classes/class.ilFileException.php';
if (!$ilAccess->checkAccess("read", "", $this->getRefId())) {
$this->ilErr->raiseError(get_class($this) . "::downloadFolder(): missing read permission!", $this->ilErr->WARNING);
}
if (ilObject::_isInTrash($this->getRefId())) {
$this->ilErr->raiseError(get_class($this) . "::downloadFolder(): object is trashed!", $this->ilErr->WARNING);
}
$zip = PATH_TO_ZIP;
$tmpdir = ilUtil::ilTempnam();
ilUtil::makeDir($tmpdir);
$basename = ilUtil::getAsciiFilename($this->getTitle());
$deliverFilename = $basename . ".zip";
$zipbasedir = $tmpdir . DIRECTORY_SEPARATOR . $basename;
$tmpzipfile = $tmpdir . DIRECTORY_SEPARATOR . $deliverFilename;
try {
ilObjFolder::recurseFolder($this->getRefId(), $this->getTitle(), $tmpdir);
ilUtil::zip($zipbasedir, $tmpzipfile);
rename($tmpzipfile, $zipfile = ilUtil::ilTempnam());
ilUtil::delDir($tmpdir);
ilUtil::deliverFile($zipfile, $deliverFilename, '', false, true);
} catch (ilFileException $e) {
ilUtil::sendInfo($e->getMessage(), true);
}
}
示例11: delete
/**
* Delete files
*/
public function delete()
{
/**
* @var $lng ilLanguage
* @var $ilCtrl ilCtrl
*/
global $lng, $ilCtrl;
$export_dir = $this->obj->getExportDirectory();
foreach ($_POST['file'] as $file) {
$exp_file = $export_dir . '/' . $file;
$exp_dir = $export_dir . '/' . substr($file, 0, strlen($file) - 4);
if (@is_file($exp_file)) {
unlink($exp_file);
}
if (@is_dir($exp_dir)) {
ilUtil::delDir($exp_dir);
}
}
ilUtil::sendSuccess($lng->txt('msg_deleted_export_files'), true);
$ilCtrl->redirect($this, 'listExportFiles');
}
示例12: importVerifiedFileObject
/**
* imports question(s) into the questionpool (after verification)
*/
function importVerifiedFileObject()
{
if ($_POST["questions_only"] == 1) {
$newObj =& $this->object;
} else {
include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
// create new questionpool object
$newObj = new ilObjQuestionPool(0, true);
// set type of questionpool object
$newObj->setType($_GET["new_type"]);
// set title of questionpool object to "dummy"
$newObj->setTitle("dummy");
// set description of questionpool object
$newObj->setDescription("questionpool import");
// create the questionpool class in the ILIAS database (object_data table)
$newObj->create(true);
// create a reference for the questionpool object in the ILIAS database (object_reference table)
$newObj->createReference();
// put the questionpool object in the administration tree
$newObj->putInTree($_GET["ref_id"]);
// get default permissions and set the permissions for the questionpool object
$newObj->setPermissions($_GET["ref_id"]);
// notify the questionpool object and all its parent objects that a "new" object was created
$newObj->notify("new", $_GET["ref_id"], $_GET["parent_non_rbac_id"], $_GET["ref_id"], $newObj->getRefId());
}
// start parsing of QTI files
include_once "./Services/QTI/classes/class.ilQTIParser.php";
$qtiParser = new ilQTIParser($_SESSION["qpl_import_qti_file"], IL_MO_PARSE_QTI, $newObj->getId(), $_POST["ident"]);
$result = $qtiParser->startParsing();
// import page data
if (strlen($_SESSION["qpl_import_xml_file"])) {
include_once "./Modules/LearningModule/classes/class.ilContObjParser.php";
$contParser = new ilContObjParser($newObj, $_SESSION["qpl_import_xml_file"], $_SESSION["qpl_import_subdir"]);
$contParser->setQuestionMapping($qtiParser->getImportMapping());
$contParser->startParsing();
}
// set another question pool name (if possible)
$qpl_name = $_POST["qpl_new"];
if (strcmp($qpl_name, $newObj->getTitle()) != 0 && strlen($qpl_name) > 0) {
$newObj->setTitle($qpl_name);
$newObj->update();
}
// delete import directory
include_once "./Services/Utilities/classes/class.ilUtil.php";
ilUtil::delDir(dirname(ilObjQuestionPool::_getImportDirectory()));
if ($_POST["questions_only"] == 1) {
$this->ctrl->redirect($this, "questions");
} else {
ilUtil::sendSuccess($this->lng->txt("object_imported"), true);
ilUtil::redirect("ilias.php?ref_id=" . $newObj->getRefId() . "&baseClass=ilObjQuestionPoolGUI");
}
}
示例13: delete
/**
* delete media object
*/
function delete()
{
if (!($this->getId() > 0)) {
return;
}
$usages = $this->getUsages();
if (count($usages) == 0) {
// remove directory
ilUtil::delDir(ilObjMediaObject::_getDirectory($this->getId()));
// remove thumbnail directory
ilUtil::delDir(ilObjMediaObject::_getThumbnailDirectory($this->getId()));
// delete meta data of mob
$this->deleteMetaData();
// delete media items
ilMediaItem::deleteAllItemsOfMob($this->getId());
// this is just to make sure, there should be no entries left at
// this point as they depend on the usage
self::handleQuotaUpdate($this);
// delete object
parent::delete();
}
}
示例14: importObject
//.........这里部分代码省略.........
* @access public
*/
function importObject($file_info, $svy_qpl_id)
{
if ($svy_qpl_id < 1) {
$svy_qpl_id = -1;
}
// check if file was uploaded
$source = $file_info["tmp_name"];
$error = "";
if ($source == 'none' || !$source || $file_info["error"] > UPLOAD_ERR_OK) {
$error = $this->lng->txt("import_no_file_selected");
}
// check correct file type
$isXml = FALSE;
$isZip = FALSE;
if (strcmp($file_info["type"], "text/xml") == 0 || strcmp($file_info["type"], "application/xml") == 0) {
$isXml = TRUE;
}
// too many different mime-types, so we use the suffix
$suffix = pathinfo($file_info["name"]);
if (strcmp(strtolower($suffix["extension"]), "zip") == 0) {
$isZip = TRUE;
}
if (!$isXml && !$isZip) {
$error = $this->lng->txt("import_wrong_file_type");
global $ilLog;
$ilLog->write("Survey: Import error. Filetype was \"" . $file_info["type"] . "\"");
}
if (strlen($error) == 0) {
// import file as a survey
$import_dir = $this->getImportDirectory();
$import_subdir = "";
$importfile = "";
include_once "./Services/Utilities/classes/class.ilUtil.php";
if ($isZip) {
$importfile = $import_dir . "/" . $file_info["name"];
ilUtil::moveUploadedFile($source, $file_info["name"], $importfile);
ilUtil::unzip($importfile);
$found = $this->locateImportFiles($import_dir);
if (!(strlen($found["dir"]) > 0 && strlen($found["xml"]) > 0)) {
$error = $this->lng->txt("wrong_import_file_structure");
return $error;
}
$importfile = $found["xml"];
$import_subdir = $found["dir"];
} else {
$importfile = tempnam($import_dir, "survey_import");
ilUtil::moveUploadedFile($source, $file_info["name"], $importfile);
}
$fh = fopen($importfile, "r");
if (!$fh) {
$error = $this->lng->txt("import_error_opening_file");
return $error;
}
$xml = fread($fh, filesize($importfile));
$result = fclose($fh);
if (!$result) {
$error = $this->lng->txt("import_error_closing_file");
return $error;
}
unset($_SESSION["import_mob_xhtml"]);
if (strpos($xml, "questestinterop")) {
include_once "./Services/Survey/classes/class.SurveyImportParserPre38.php";
$import = new SurveyImportParserPre38($svy_qpl_id, "", TRUE);
$import->setSurveyObject($this);
$import->setXMLContent($xml);
$import->startParsing();
} else {
include_once "./Services/Survey/classes/class.SurveyImportParser.php";
$import = new SurveyImportParser($svy_qpl_id, "", TRUE);
$import->setSurveyObject($this);
$import->setXMLContent($xml);
$import->startParsing();
}
if (is_array($_SESSION["import_mob_xhtml"])) {
include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
include_once "./Services/RTE/classes/class.ilRTE.php";
include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
foreach ($_SESSION["import_mob_xhtml"] as $mob) {
$importfile = $import_subdir . "/" . $mob["uri"];
if (file_exists($importfile)) {
$media_object =& ilObjMediaObject::_saveTempFileAsMediaObject(basename($importfile), $importfile, FALSE);
ilObjMediaObject::_saveUsage($media_object->getId(), "svy:html", $this->getId());
$this->setIntroduction(str_replace("src=\"" . $mob["mob"] . "\"", "src=\"" . "il_" . IL_INST_ID . "_mob_" . $media_object->getId() . "\"", $this->getIntroduction()));
$this->setOutro(str_replace("src=\"" . $mob["mob"] . "\"", "src=\"" . "il_" . IL_INST_ID . "_mob_" . $media_object->getId() . "\"", $this->getOutro()));
} else {
global $ilLog;
$ilLog->write("Error: Could not open XHTML mob file for test introduction during test import. File {$importfile} does not exist!");
}
}
$this->setIntroduction(ilRTE::_replaceMediaObjectImageSrc($this->getIntroduction(), 1));
$this->setOutro(ilRTE::_replaceMediaObjectImageSrc($this->getOutro(), 1));
$this->saveToDb();
}
// delete import directory
ilUtil::delDir($this->getImportDirectory());
}
return $error;
}
示例15: afterXmlRecordWriting
/**
* After xml record writing hook record
*
* @param
* @return
*/
function afterXmlRecordWriting($a_entity, $a_version, $a_set)
{
if ($a_entity == "usr_profile") {
// cleanup temp dirs for pictures
$tmp_dir = $this->temp_picture_dirs[$a_set["Id"]];
if ($tmp_dir != "" && is_dir($tmp_dir)) {
ilUtil::delDir($tmp_dir);
}
}
}