本文整理汇总了PHP中Magento\Framework\Module\ModuleListInterface::getAll方法的典型用法代码示例。如果您正苦于以下问题:PHP ModuleListInterface::getAll方法的具体用法?PHP ModuleListInterface::getAll怎么用?PHP ModuleListInterface::getAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\Module\ModuleListInterface
的用法示例。
在下文中一共展示了ModuleListInterface::getAll方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* @param \Symfony\Component\Console\Input\InputInterface $input
* @param \Symfony\Component\Console\Output\OutputInterface $output
* @return int|null|void
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$time = microtime(true);
$ignoreDataUpdate = $input->getOption('ignore-data');
$headers = array('Setup', 'Module', 'DB', 'Data', 'Status');
if ($ignoreDataUpdate) {
unset($headers[array_search('Data', $headers)]);
}
$errorCounter = 0;
$table = array();
foreach ($this->moduleList->getAll() as $moduleName => $moduleInfo) {
$moduleVersion = $moduleInfo['setup_version'];
$dbVersion = $this->resource->getDbVersion($moduleName);
if (!$ignoreDataUpdate) {
$dataVersion = $this->resource->getDataVersion($moduleName);
}
$ok = $dbVersion == $moduleVersion;
if ($ok && !$ignoreDataUpdate) {
$ok = $dataVersion == $moduleVersion;
}
if (!$ok) {
$errorCounter++;
}
$row = array('Module' => $moduleName, 'DB' => $dbVersion, 'Data' => $dataVersion);
if (!$ignoreDataUpdate) {
$row['Data-Version'] = $dataVersion;
}
$row['Status'] = $ok ? 'OK' : 'Error';
$table[] = $row;
}
//if there is no output format
//highlight the status
//and show error'd rows at bottom
if (!$input->getOption('format')) {
usort($table, function ($a, $b) {
return $a['Status'] !== 'OK';
});
array_walk($table, function (&$row) {
$status = $row['Status'];
$availableStatus = array('OK' => 'info', 'Error' => 'error');
$statusString = sprintf('<%s>%s</%s>', $availableStatus[$status], $status, $availableStatus[$status]);
$row['Status'] = $statusString;
});
}
if ($input->getOption('log-junit')) {
$this->logJUnit($table, $input->getOption('log-junit'), microtime($time) - $time);
} else {
$this->getHelper('table')->setHeaders($headers)->renderByFormat($output, $table, $input->getOption('format'));
//if no output format specified - output summary line
if (!$input->getOption('format')) {
if ($errorCounter > 0) {
$this->writeSection($output, sprintf('%s error%s %s found!', $errorCounter, $errorCounter === 1 ? '' : 's', $errorCounter === 1 ? 'was' : 'were'), 'error');
} else {
$this->writeSection($output, 'No setup problems were found.', 'info');
}
}
}
}
示例2: getMagefanModules
/**
* Get Magefan Modules Info
*
* @return $this
*/
protected function getMagefanModules()
{
$modules = array();
foreach ($this->_moduleList->getAll() as $moduleName => $module) {
if (strpos($moduleName, 'Magefan_') !== false && $this->_moduleManager->isEnabled($moduleName)) {
$modules[$moduleName] = $module;
}
}
return $modules;
}
示例3: prepareModuleList
protected function prepareModuleList($vendor)
{
$this->moduleList = [];
foreach ($this->moduleListObject->getAll() as $moduleName => $info) {
// First index is (probably always) vendor
$moduleNameData = explode('_', $moduleName);
if (!is_null($vendor) && strtolower($moduleNameData[0]) !== strtolower($vendor)) {
continue;
}
$this->moduleList[] = [$info['name'], $info['setup_version']];
}
}
示例4: addVendors
protected function addVendors()
{
$vendors = [];
$moduleList = $this->moduleList->getAll();
foreach ($moduleList as $moduleName => $info) {
// First index is (probably always) vendor
$moduleNameData = explode('_', $moduleName);
if (isset($moduleNameData[0])) {
$vendors[] = $moduleNameData[0];
}
}
$this->infos['Vendors'] = implode(', ', array_unique($vendors));
}
示例5: getMagentoModuleList
/**
* @return array
*/
protected function getMagentoModuleList()
{
return $this->moduleList->getAll();
}