本文整理汇总了PHP中Bitrix\Main\IO\File::deleteFile方法的典型用法代码示例。如果您正苦于以下问题:PHP File::deleteFile方法的具体用法?PHP File::deleteFile怎么用?PHP File::deleteFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bitrix\Main\IO\File
的用法示例。
在下文中一共展示了File::deleteFile方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: write
public function write($arAllVars, $baseDir, $initDir, $filename, $TTL)
{
$documentRoot = \Bitrix\Main\Application::getDocumentRoot();
$fn = IO\Path::combine($documentRoot, $baseDir, $initDir, $filename);
$file = new IO\File($fn);
$fnTmp = IO\Path::combine($documentRoot, $baseDir, $initDir, md5(mt_rand()) . ".tmp");
$fileTmp = new IO\File($fnTmp);
$dir = $file->getDirectory();
if (!$dir->isExists()) {
$dir->create();
}
if (is_array($arAllVars)) {
$contents = "<?";
$contents .= "\nif(\$INCLUDE_FROM_CACHE!='Y')return false;";
$contents .= "\n\$datecreate = '" . str_pad(mktime(), 12, "0", STR_PAD_LEFT) . "';";
$contents .= "\n\$dateexpire = '" . str_pad(mktime() + IntVal($TTL), 12, "0", STR_PAD_LEFT) . "';";
$v = serialize($arAllVars);
if (static::checkZeroDanger()) {
$v = str_replace("*", "", $v);
$contents .= "\n\$zeroDanger = true;";
}
$contents .= "\n\$ser_content = '" . str_replace("'", "\\'", str_replace("\\", "\\\\", $v)) . "';";
$contents .= "\nreturn true;";
$contents .= "\n?>";
} else {
$contents = "BX" . str_pad(mktime(), 12, "0", STR_PAD_LEFT) . str_pad(mktime() + IntVal($this->TTL), 12, "0", STR_PAD_LEFT);
$contents .= $arAllVars;
}
$this->written = $fileTmp->putContents($contents);
$len = \Bitrix\Main\Text\String::strlenBytes($contents);
//This checks for Zend Server CE in order to supress warnings
if (function_exists('accelerator_reset')) {
try {
$file->delete();
} catch (\Exception $ex) {
}
} elseif ($file->isExists()) {
$file->delete();
}
if ($this->written === $len) {
$fileTmp->rename($fn);
}
//This checks for Zend Server CE in order to supress warnings
if (function_exists('accelerator_reset')) {
try {
IO\File::deleteFile($fnTmp);
} catch (\Exception $ex) {
}
} elseif (IO\File::isFileExists($fnTmp)) {
IO\File::deleteFile($fnTmp);
}
}
示例2: getRemoteTypeGroups
public function getRemoteTypeGroups()
{
if (!$this->useCache || !isset($this->data['settings']['remote']['typeGroups'])) {
$localPath = \CTempFile::GetDirectoryName(100);
static::downloadFile(self::REMOTE_TYPE_GROUP_FILE, self::LOCAL_TYPE_GROUP_FILE, false, $localPath);
$csv = new CSVReader();
$res = $csv->ReadBlock($localPath . self::LOCAL_TYPE_GROUP_FILE);
$result = array();
foreach ($res as $line) {
$result[$line['CODE']] = explode(':', $line['TYPES']);
}
$this->data['settings']['remote']['typeGroups'] = $result;
if (\Bitrix\Main\IO\File::isFileExists($localPath . self::LOCAL_TYPE_GROUP_FILE)) {
try {
\Bitrix\Main\IO\File::deleteFile($localPath . self::LOCAL_TYPE_GROUP_FILE);
\Bitrix\Main\IO\Directory::deleteDirectory($localPath);
} catch (\Exception $e) {
}
}
}
return $this->data['settings']['remote']['typeGroups'];
}
示例3: packData
protected function packData($xmlFile)
{
$tmpDir = $this->path . "/tmp";
$archiveName = $tmpDir . "/" . $this->feedType . "_" . $this->fileNameSalt . ".zip";
$oArchiver = \CBXArchive::GetArchive($archiveName, "ZIP");
$oArchiver->SetOptions(array("REMOVE_PATH" => $this->path . "/xml", "ADD_PATH" => $this->feedType));
if ($oArchiver->Pack($xmlFile)) {
\Bitrix\Main\IO\File::deleteFile($xmlFile);
}
return $archiveName;
}
示例4: UnInstallFiles
/**
* @return bool
*/
function UnInstallFiles()
{
\Bitrix\Main\IO\Directory::deleteDirectory($_SERVER["DOCUMENT_ROOT"] . '/bitrix/components/adelshin/');
if (\Bitrix\Main\IO\Directory::isDirectoryExists($path = $this->GetPath() . '/admin')) {
// удаляем административные файлы
DeleteDirFiles($_SERVER["DOCUMENT_ROOT"] . $this->GetPath() . '/install/admin/', $_SERVER["DOCUMENT_ROOT"] . '/bitrix/admin');
if ($dir = opendir($path)) {
while (false !== ($item = readdir($dir))) {
if (in_array($item, $this->exclusionAdminFiles)) {
continue;
}
\Bitrix\Main\IO\File::deleteFile($_SERVER['DOCUMENT_ROOT'] . '/bitrix/admin/' . $this->MODULE_ID . '_' . $item);
}
closedir($dir);
}
}
return true;
}