37 $this->
keepField([
'pathList',
'seekOffset']);
50 public function run($pathList)
52 if ($this->isNewProcess)
54 $pathList = \preg_split(
"/[\r\n]+/", $pathList);
55 \array_walk($pathList,
'trim');
56 $pathList = \array_unique(\array_filter($pathList));
67 foreach ($pathList as $testPath)
73 $this->pathList[] = $testPath;
77 $this->
addError(
new Main\
Error(Loc::getMessage(
'TR_CLEAN_FILE_NOT_LANG', [
'#FILE#' => $testPath])));
84 $this->pathList[] = $testPath;
92 '=PATH' => \rtrim($testPath,
'/'),
93 '=%PATH' => \rtrim($testPath,
'/').
'/%'
96 'filter' => $pathFilter,
97 'order' => [
'ID' =>
'ASC'],
100 while (
$pathLang = $pathLangRes->fetch())
108 $this->totalItems =
\count($this->pathList);
109 $this->processedItems = 0;
111 if ($this->totalItems == 0)
115 'PROCESSED_ITEMS' => 0,
121 $this->isNewProcess =
false;
132 private function runWiping():
array
134 $processedItemCount = 0;
135 for ($pos = ((
int)$this->seekOffset > 0 ? (
int)$this->seekOffset : 0), $total =
count($this->pathList); $pos < $total; $pos ++)
137 $testPath = $this->pathList[$pos];
146 foreach (self::$enabledLanguagesList as $langId)
152 if ($this->removeEmptyParents($langFullPath))
166 if (\mb_substr($testPath, -5) ===
'/lang')
168 $testPath .=
'/#LANG_ID#';
172 $testPath = Translate\IO\Path::replaceLangId($testPath,
'#LANG_ID#');
175 foreach (self::$enabledLanguagesList as $langId)
177 $langRelPath = Translate\IO\Path::replaceLangId($testPath.
'/.nonExistentTestFile.php', $langId);
178 $langFullPath = Translate\IO\Path::tidy(self::$documentRoot.
'/'.$langRelPath);
179 $langFullPath = Main\Localization\Translation::convertLangPath($langFullPath, $langId);
181 if ($this->removeEmptyParents($langFullPath))
183 Translate\Index\Internals\FileIndexTable::purge(
new Translate\
Filter([
'path' => $testPath,
'langId' => $langId]));
194 Translate\Index\Internals\PathIndexTable::purge(
new Translate\
Filter([
'path' => $testPath,
'recursively' =>
true]));
198 $processedItemCount ++;
200 if (isset($this->pathList[$pos + 1]))
202 $this->seekOffset = $pos + 1;
206 $this->seekOffset =
null;
217 $this->processedItems += $processedItemCount;
238 private function removeEmptyParents($langFullPath): bool
242 $langFile = Translate\File::instantiateByPath($langFullPath);
248 catch (Main\ArgumentException $ex)
263 return self::SETTING_ID;
static convertLangPath($langFile, $language)
static getList(array $parameters=array())