Server : Apache System : Linux indy02.toastserver.com 3.10.0-962.3.2.lve1.5.85.el7.x86_64 #1 SMP Thu Apr 18 15:18:36 UTC 2024 x86_64 User : palandch ( 1163) PHP Version : 7.1.33 Disable Function : NONE Directory : /home/palandch/www/core/model/modx/processors/workspace/lexicon/ |
<?php /** * Regenerates strings from the base lexicon files, resetting any customizations. * @package modx * @subpackage processors.workspace.lexicon */ class modLexiconReloadFromBaseProcessor extends modProcessor { public function checkPermissions() { return $this->modx->hasPermission('lexicons'); } public function getLanguageTopics() { return array('lexicon'); } public function process() { $language = 'en'; $namespace = 'core'; $corePath = $this->modx->getOption('core_path',null,MODX_CORE_PATH); $this->modx->lexicon->clearCache(); $c = $this->modx->newQuery('modLexiconEntry'); $c->where(array( 'namespace' => $namespace, 'language' => $language, )); $entries = $this->modx->getCollection('modLexiconEntry',$c); $currentTopic = ''; $lex = array(); $i = 0; /** @var modLexiconEntry $entry */ foreach ($entries as $entry) { if ($currentTopic != $entry->get('topic')) { $currentTopic = $entry->get('topic'); $topicPath = str_replace('//','/',$corePath.'/lexicon/'.$language.'/'.$currentTopic.'.inc.php'); $lex = array(); $_lang = array(); if (file_exists($topicPath)) { include $topicPath; $lex = $_lang; } } if (!empty($lex[$entry->get('name')])) { $i++; $entry->remove(); } } $this->modx->log(modX::LOG_LEVEL_WARN,$this->modx->lexicon('reload_success',array( 'total' => $i, ))); $this->modx->log(modX::LOG_LEVEL_INFO,'COMPLETED'); return $this->success(intval($i)); } } return 'modLexiconReloadFromBaseProcessor';