Получает агента
Данные подготовлены для экспорта в миграцию или схему
@param $moduleId
@param string $name
@return bool
502466
public function exportAgent($moduleId, $name = '') {
        $agent = $this->getAgent($moduleId, $name);
        if (empty($agent)) {
            return false;
        }

        return $this->prepareExportAgent($agent);
    }
1373267
public function hasModule($name)
	{
	    $name = $this->parseModuleAlias($name);
	    
	    return isset($this->_modules) && in_array($name, $this->_modules);
	}
893041
public function isEnabled($name)
    {
        foreach ($this->modules as $module) {
            if ($name === $module->title) {
                return true;
            }
        }
        return false;
    }
838386
protected function registerModule($moduleName)
    {
        $module = new ModuleModel;
        $module->module_name = $this->def($moduleName, 'name');
        $module->module_version = $this->def($moduleName, 'version');
        $module->module_status = 0;
        $module->module_is_enabled = 0;
        $module->module_is_installed = 1;
        $module->save();

        return true;
    }
948638
public static function hasName( $name, $module_id = null ): bool
	{
		if( !self::isValidName($name) )
		{
			return false;
		}

		$builder = \DB::table("events")->where("name", $name);
		if( is_numeric($module_id) )
		{
			$builder->where("module_id", (int) $module_id );
		}

		return $builder->count(["id"]) > 0;
	}
661994
public function validate(ModuleSetting $moduleSetting, string $moduleId, int $shopId)
    {
        if (!$this->canValidate($moduleSetting)) {
            throw new WrongModuleSettingException($moduleSetting, self::class);
        }

        foreach ($moduleSetting->getValue() as $classToBePatched => $moduleClass) {
            if ($this->shopAdapter->isNamespace($classToBePatched)) {
                $this->validateClassToBePatchedNamespace($classToBePatched);
            }
        }
    }
205014
public function deleteConfigValue($moduleId, $variableName)
    {
        if (null !== $moduleConfig = self::create()
            ->filterByModuleId($moduleId)
            ->filterByName($variableName)
            ->findOne()
        ) {
            $moduleConfig->delete();
        };

        return $this;
    }
185090
public function handleOnModuleActivation(ModuleSetting $moduleSetting, string $moduleId, int $shopId)
    {
        if (!$this->canHandle($moduleSetting)) {
            throw new WrongModuleSettingException($moduleSetting, self::class);
        }

        foreach ($moduleSetting->getValue() as $shopModuleSettingData) {
            $shopModuleSetting = new ShopModuleSetting();
            $shopModuleSetting
                ->setShopId($shopId)
                ->setModuleId($moduleId);

            $shopModuleSetting = $this->mapDataToShopModuleSetting($shopModuleSetting, $shopModuleSettingData);

            $this->shopModuleSettingDao->save($shopModuleSetting);
        }
    }
207502
public function update(int $tagId, string $name)
    {
        $params = [
            'tag' => [
                'id' => $tagId,
                'name' => $name,
            ],
        ];

        return $this->httpPostJson('cgi-bin/tags/update', $params);
    }
865485
protected function getModuleConfigs($moduleId)
    {
        $db = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC);
        $config = \OxidEsales\Eshop\Core\Registry::getConfig();
        $shopId = $config->getShopId();
        $module = $this->getModuleConfigId($moduleId);

        $decodeValueQuery = $config->getDecodeValueQuery();
        $moduleConfigsQuery = "SELECT oxvarname, oxvartype, {$decodeValueQuery} as oxvardecodedvalue FROM oxconfig WHERE oxmodule = ? AND oxshopid = ?";
        $dbConfigs = $db->getAll($moduleConfigsQuery, [$module, $shopId]);

        $result = [];
        foreach ($dbConfigs as $oneModuleConfig) {
            $result[$oneModuleConfig['oxvarname']] = $config->decodeValue($oneModuleConfig['oxvartype'], $oneModuleConfig['oxvardecodedvalue']);
        }

        return $result;
    }
256833
private function getDataFromOxConfigTable(string $name, string $moduleId, int $shopId): array
    {
        $queryBuilder = $this->queryBuilderFactory->create();
        $queryBuilder
            ->select('decode(oxvarvalue, :key) as value, oxvartype as type, oxvarname as name')
            ->from('oxconfig')
            ->where('oxshopid = :shopId')
            ->where('oxmodule = :moduleId')
            ->andWhere('oxvarname = :name')
            ->setParameters([
                'shopId'    => $shopId,
                'moduleId'  => $moduleId,
                'name'      => $name,
                'key'       => $this->context->getConfigurationEncryptionKey(),
            ]);

        $result = $queryBuilder->execute()->fetch();

        if (false === $result) {
            throw new EntryDoesNotExistDaoException();
        }

        return $result;
    }
156243
protected function _addModuleExtensions($moduleExtensions, $moduleId)
    {
        $extensions = (array) \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('aModuleExtensions');
        if (is_array($extensions)) {
            $extensions[$moduleId] = array_values($moduleExtensions);
        }

        $this->_saveToConfig('aModuleExtensions', $extensions);
    }
1132783
public function has($module, $name)
    {
        $this->initializeOnDemand();
        return $this->arrayConfig->has($module, $name);
    }
582853
public static function isExistByNameFormId( $name, $formId ) {

		$field = self::findByNameFormId( $name, $formId );

		return isset( $field );
	}
1308228
public function moduleEnabled($name) {
    $this->options[] = '--format=json';
    $modules = $this->__call('pmList', []);
    if (!$modules = json_decode($modules, TRUE)) {
      throw new DrushFormatException("Cannot parse json output from drush: $modules", $modules);
    }
    $this->options = [];
    return isset($modules[$name]) && $modules[$name]['status'] === 'Enabled';
  }
491332
protected function _addModuleSettings($moduleSettings, $moduleId)
    {
        $config = $this->getConfig();
        $shopId = $config->getShopId();
        if (is_array($moduleSettings)) {
            foreach ($moduleSettings as $setting) {

                $module = $this->getModuleConfigId($moduleId);
                $name = $setting["name"];
                $type = $setting["type"];

                $value = is_null($config->getConfigParam($name)) ? $setting["value"] : $config->getConfigParam($name);

                $changed = $config->saveShopConfVar($type, $name, $value, $shopId, $module);
                if ($changed) {
                    $this->output->writeln("$moduleId: setting for '$name' fixed'");
                    $this->needCacheClear = $this->needCacheClear || $changed;
                }
            }
        }
    }
1340797
public function isFileWritable($moduleName) {
		
		$folder = APPLICATION_PATH . ('common'!=$moduleName ? '/modules/' . $moduleName : '') . '/translations';
		$file = $folder . '/' . $this->getRepresentation() . '.ini';
		
		if ((file_exists($file) and is_writable($file)) or (!file_exists($file) and is_dir($folder) and is_writable($folder))) {
			return TRUE;
		} else {
			return FALSE;
		}
		
	}