當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Module::getInstalledModules方法代碼示例

本文整理匯總了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')");
 }
開發者ID:tronsmit,項目名稱:webtrees,代碼行數:10,代碼來源:Migration34.php

示例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 {
開發者ID:tronsmit,項目名稱:webtrees,代碼行數:31,代碼來源:admin_modules.php

示例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':
開發者ID:pal-saugstad,項目名稱:webtrees,代碼行數:31,代碼來源:admin_site_upgrade.php


注:本文中的Fisharebest\Webtrees\Module::getInstalledModules方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。