/** * Deletes the file * with predefined path (current request uri) * * @return void */ public function delete() { if ($this->cacheFile && $this->cacheFile->isExists()) { $cacheDirectory = $this->cacheFile->getDirectory(); $fileSize = $this->cacheFile->getFileSize(); if (defined("BX_COMPOSITE_DEBUG")) { $backupName = $this->cacheFile->getPath() . ".delete." . microtime(true); if ($this->checkQuota()) { AddMessage2Log($backupName, "composite"); $backupFile = new Main\IO\File($backupName); $backupFile->putContents($this->cacheFile->getContents()); $this->writeStatistic(0, 0, 0, 0, $fileSize); } else { AddMessage2Log($backupName . "(quota exceeded)", "composite"); } } $this->cacheFile->delete(); //Try to cleanup directory $children = $cacheDirectory->getChildren(); if (empty($children)) { $cacheDirectory->delete(); } //Update total files size $this->writeStatistic(0, 0, 0, 0, -$fileSize); } }
public static function showTab($div, $iblockElementInfo) { $engineList = array(); if (Option::get('main', 'vendor', '') == '1c_bitrix') { $engineList[] = array("DIV" => "yandex_direct", "TAB" => Loc::getMessage("SEO_ADV_YANDEX_DIRECT"), "TITLE" => Loc::getMessage("SEO_ADV_YANDEX_DIRECT_TITLE"), "HANDLER" => IO\Path::combine(Application::getDocumentRoot(), BX_ROOT, "/modules/seo/admin/tab/seo_search_yandex_direct.php")); } if (count($engineList) > 0) { $engineTabControl = new \CAdminViewTabControl("engineTabControl", $engineList); ?> <tr> <td colspan="2"> <?php $engineTabControl->begin(); foreach ($engineList as $engineTab) { $engineTabControl->beginNextTab(); $file = new IO\File($engineTab["HANDLER"]); if ($file->isExists()) { require $file->getPath(); } } $engineTabControl->end(); ?> </td> </tr> <?php } }
/** * Returns urlrewrite array * * @param string $site Site ID. * @return array */ private static function getRewriteRules($site) { $docRoot = rtrim(\Bitrix\Main\SiteTable::getDocumentRoot($site), '/'); $rewriteRules = array(); $arUrlRewrite =& $rewriteRules; $rewriteFile = new IO\File($docRoot . '/urlrewrite.php'); if ($rewriteFile->isExists()) { include $rewriteFile->getPath(); } return $rewriteRules; }
public function finish() { foreach ($this->partList as $key => $partName) { $f = new File(Path::combine($this->getDirectoryName(), $partName)); $f->rename(str_replace($this->getPrefix(), '', $f->getPath())); $this->partList[$key] = $f->getName(); } if ($this->isCurrentPartNotEmpty()) { $this->addFooter(); $this->rename(str_replace($this->getPrefix(), '', $this->getPath())); } }
/** * Returns file relative path for URL. * * @param File $f File object. * * @return string */ protected function getFileUrl(File $f) { static $indexNames; if(!is_array($indexNames)) { $indexNames = GetDirIndexArray(); } $path = '/'; if (substr($this->path, 0, strlen($this->documentRoot)) === $this->documentRoot) { $path = '/'.substr($f->getPath(), strlen($this->documentRoot)); } $path = Path::convertLogicalToUri($path); $path = in_array($f->getName(), $indexNames) ? str_replace('/'.$f->getName(), '/', $path) : $path; return '/'.ltrim($path, '/'); }