function ParseFile($file) { $docRoot = CSite::GetSiteDocRoot(self::$curSite); $file = str_replace("//", "/", $file); $io = CBXVirtualIo::GetInstance(); $bIsDir = $io->DirectoryExists($file); if (is_link($file)) { return; } if ($bIsDir) { // Skip 'bitrix' and 'upload' folders if ($file == $docRoot . '/bitrix' || $file == $docRoot . '/upload' || $file == $docRoot . '/images') { return; } $oDir = new CFilemanUtilDir($file, array('obj' => $this, 'site' => self::$curSite, 'callBack' => "ParseFile", 'checkBreak' => "CheckBreak", 'checkSubdirs' => false)); $bSuccess = $oDir->Start(); $bBreak = $oDir->bBreak; $nextPath = $oDir->nextPath; if ($bBreak) { $this->ParseStop(CFilemanUtils::TrimPath($nextPath, $docRoot), self::$curSite); } } else { if (self::$bSkip) { if ($file == $docRoot . self::$lastPath) { self::$bSkip = false; } else { return; } // Files was handled earlier } $fileName = $io->ExtractNameFromPath($file); // Skip files stating from dot '.' or any non .php files if (GetFileExtension($fileName) != 'php' || preg_match('/^\\..*/i' . BX_UTF_PCRE_MODIFIER, $fileName)) { return; } // 1. Get file content $fTmp = $io->GetFile($file); $fileContent = $fTmp->GetContents(); $fileContent = str_replace("\r", "", $fileContent); $fileContent = str_replace("\n", "", $fileContent); // Find files with needed components $pattern = array('intranet.event_calendar', 'socialnetwork', 'socialnetwork_user', 'socialnetwork_group'); foreach ($pattern as $p) { if (preg_match('/includecomponent\\([\\n\\t\\r\\s]*("|\')bitrix:' . $p . '/i' . BX_UTF_PCRE_MODIFIER, $fileContent)) { $this->FetchParams($fileContent); break; } } } }
public function Chmod($file) { if ($this->bSkip) { if ($file == $this->Params['lastPath']) { $this->bSkip = false; } else { return; } // Files was handled earlier } $this->Result[] = array(CFilemanUtils::TrimPath($file), false); }
if ($bStoped) $bBreak = false; if ($bBreak) break; $oChmod->Chmod($arFile['ABS_PATH']); } clearstatcache(); ?> <script> <?if ($bBreak): // Execution breaks on timeout?> window.spBtimeout = true; window.spLastPath = '<?php echo CUtil::JSEscape(CFilemanUtils::TrimPath($nextPath)); ?> '; <? else: ?> window.spBtimeout = false; <? endif; ?> window.spBstoped = <?php echo $bStoped ? 'true' : 'false'; ?> ; window.spResult = <?php echo CUtil::PhpToJSObject($oChmod->Result); ?> ; </script>
function Chmod($file) { if ($this->bSkip) { if ($file == $this->Params['lastPath']) $this->bSkip = false; // continue handle files from last path else return; // Files was handled earlier } $this->Result[] = array(CFilemanUtils::TrimPath($file), false); }