本文整理汇总了PHP中Fisharebest\Webtrees\Module::getInstalledModules方法的典型用法代码示例。如果您正苦于以下问题:PHP Module::getInstalledModules方法的具体用法?PHP Module::getInstalledModules怎么用?PHP Module::getInstalledModules使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fisharebest\Webtrees\Module
的用法示例。
在下文中一共展示了Module::getInstalledModules方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: upgrade
/**
* Upgrade to to the next version
*/
public function upgrade()
{
// New modules (charts) have been added.
Module::getInstalledModules('enabled');
// Delete old/unused settings
Database::exec("DELETE FROM `##gedcom_setting` WHERE setting_name IN ('COMMON_NAMES_ADD', 'COMMON_NAMES_REMOVE', 'COMMON_NAMES_THRESHOLD')");
}
示例2: PageController
use Fisharebest\Webtrees\Controller\PageController;
use Fisharebest\Webtrees\Functions\FunctionsEdit;
use Fisharebest\Webtrees\Module\AbstractModule;
use Fisharebest\Webtrees\Module\ModuleBlockInterface;
use Fisharebest\Webtrees\Module\ModuleChartInterface;
use Fisharebest\Webtrees\Module\ModuleConfigInterface;
use Fisharebest\Webtrees\Module\ModuleMenuInterface;
use Fisharebest\Webtrees\Module\ModuleReportInterface;
use Fisharebest\Webtrees\Module\ModuleSidebarInterface;
use Fisharebest\Webtrees\Module\ModuleTabInterface;
use Fisharebest\Webtrees\Module\ModuleThemeInterface;
define('WT_SCRIPT_NAME', 'admin_modules.php');
require 'includes/session.php';
$controller = new PageController();
$controller->restrictAccess(Auth::isAdmin())->setPageTitle(I18N::translate('Module administration'));
$modules = Module::getInstalledModules('disabled');
$module_status = Database::prepare("SELECT module_name, status FROM `##module`")->fetchAssoc();
uasort($modules, function (AbstractModule $x, AbstractModule $y) {
return I18N::strcasecmp($x->getTitle(), $y->getTitle());
});
if (Filter::post('action') === 'update_mods' && Filter::checkCsrf()) {
foreach ($modules as $module) {
$new_status = Filter::post('status-' . $module->getName(), '[01]');
if ($new_status !== null) {
$new_status = $new_status ? 'enabled' : 'disabled';
$old_status = $module_status[$module->getName()];
if ($new_status !== $old_status) {
Database::prepare("UPDATE `##module` SET status=? WHERE module_name=?")->execute(array($new_status, $module->getName()));
if ($new_status === 'disabled') {
FlashMessages::addMessage(I18N::translate('The module “%s” has been disabled.', $module->getTitle()), 'success');
} else {
示例3: switch
$changes = Database::prepare("SELECT 1 FROM `##change` WHERE status='pending' LIMIT 1")->fetchOne();
if ($changes) {
echo '<br>', I18N::translate('You should accept or reject all pending changes before upgrading.'), $icon_failure;
echo '<br><button onclick="window.open(\'edit_changes.php\',\'_blank\', chan_window_specs); return false;"">', I18N::translate('Pending changes'), '</button>';
echo '</li></ul></form>';
return;
} else {
echo '<br>', I18N::translate('There are no pending changes.'), $icon_success;
}
echo '</li>';
////////////////////////////////////////////////////////////////////////////////
// Custom modules may not work with the new version.
////////////////////////////////////////////////////////////////////////////////
echo '<li>', I18N::translate('Check for custom modules…');
$custom_modules = false;
foreach (Module::getInstalledModules('disabled') as $module) {
switch ($module->getName()) {
case 'GEDFact_assistant':
case 'ahnentafel_report':
case 'batch_update':
case 'bdm_report':
case 'birth_report':
case 'cemetery_report':
case 'change_report':
case 'charts':
case 'ckeditor':
case 'clippings':
case 'death_report':
case 'descendancy':
case 'descendancy_report':
case 'extra_info':