当前位置: 首页>>代码示例>>PHP>>正文


PHP Installer::getDBTypes方法代码示例

本文整理汇总了PHP中Installer::getDBTypes方法的典型用法代码示例。如果您正苦于以下问题:PHP Installer::getDBTypes方法的具体用法?PHP Installer::getDBTypes怎么用?PHP Installer::getDBTypes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Installer的用法示例。


在下文中一共展示了Installer::getDBTypes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: execute

 /**
  * @return string|null When string, "skip" or "continue"
  */
 public function execute()
 {
     if ($this->getVar('_ExistingDBSettings')) {
         return 'skip';
     }
     $r = $this->parent->request;
     if ($r->wasPosted()) {
         $status = $this->submit();
         if ($status->isGood()) {
             $this->setVar('_UpgradeDone', false);
             return 'continue';
         } else {
             $this->parent->showStatusBox($status);
         }
     }
     $this->startForm();
     $types = "<ul class=\"config-settings-block\">\n";
     $settings = '';
     $defaultType = $this->getVar('wgDBtype');
     // Messages: config-dbsupport-mysql, config-dbsupport-postgres, config-dbsupport-oracle,
     // config-dbsupport-sqlite, config-dbsupport-mssql
     $dbSupport = '';
     foreach (Installer::getDBTypes() as $type) {
         $dbSupport .= wfMessage("config-dbsupport-{$type}")->plain() . "\n";
     }
     $this->addHTML($this->parent->getInfoBox(wfMessage('config-support-info', trim($dbSupport))->text()));
     // It's possible that the library for the default DB type is not compiled in.
     // In that case, instead select the first supported DB type in the list.
     $compiledDBs = $this->parent->getCompiledDBs();
     if (!in_array($defaultType, $compiledDBs)) {
         $defaultType = $compiledDBs[0];
     }
     foreach ($compiledDBs as $type) {
         $installer = $this->parent->getDBInstaller($type);
         $types .= '<li>' . Xml::radioLabel($installer->getReadableName(), 'DBType', $type, "DBType_{$type}", $type == $defaultType, array('class' => 'dbRadio', 'rel' => "DB_wrapper_{$type}")) . "</li>\n";
         // Messages: config-header-mysql, config-header-postgres, config-header-oracle,
         // config-header-sqlite
         $settings .= Html::openElement('div', array('id' => 'DB_wrapper_' . $type, 'class' => 'dbWrapper')) . Html::element('h3', array(), wfMessage('config-header-' . $type)->text()) . $installer->getConnectForm() . "</div>\n";
     }
     $types .= "</ul><br style=\"clear: left\"/>\n";
     $this->addHTML($this->parent->label('config-db-type', false, $types) . $settings);
     $this->endForm();
     return null;
 }
开发者ID:Kaph-Noir,项目名称:mediawiki,代码行数:47,代码来源:WebInstallerDBConnect.php

示例2: handleExistingUpgrade

 /**
  * Initiate an upgrade of the existing database
  *
  * @param mixed[] $vars Variables from LocalSettings.php
  *
  * @return Status
  */
 protected function handleExistingUpgrade($vars)
 {
     // Check $wgDBtype
     if (!isset($vars['wgDBtype']) || !in_array($vars['wgDBtype'], Installer::getDBTypes())) {
         return Status::newFatal('config-localsettings-connection-error', '');
     }
     // Set the relevant variables from LocalSettings.php
     $requiredVars = ['wgDBtype'];
     $status = $this->importVariables($requiredVars, $vars);
     $installer = $this->parent->getDBInstaller();
     $status->merge($this->importVariables($installer->getGlobalNames(), $vars));
     if (!$status->isOK()) {
         return $status;
     }
     if (isset($vars['wgDBadminuser'])) {
         $this->setVar('_InstallUser', $vars['wgDBadminuser']);
     } else {
         $this->setVar('_InstallUser', $vars['wgDBuser']);
     }
     if (isset($vars['wgDBadminpassword'])) {
         $this->setVar('_InstallPassword', $vars['wgDBadminpassword']);
     } else {
         $this->setVar('_InstallPassword', $vars['wgDBpassword']);
     }
     // Test the database connection
     $status = $installer->getConnection();
     if (!$status->isOK()) {
         // Adjust the error message to explain things correctly
         $status->replaceMessage('config-connection-error', 'config-localsettings-connection-error');
         return $status;
     }
     // All good
     $this->setVar('_ExistingDBSettings', true);
     // Copy $wgAuthenticationTokenVersion too, if it exists
     $this->setVar('wgAuthenticationTokenVersion', isset($vars['wgAuthenticationTokenVersion']) ? $vars['wgAuthenticationTokenVersion'] : null);
     return $status;
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:44,代码来源:WebInstallerExistingWiki.php

示例3: newForDB

 /**
  * @param DatabaseBase $db
  * @param bool $shared
  * @param Maintenance $maintenance
  *
  * @throws MWException
  * @return DatabaseUpdater
  */
 public static function newForDB(&$db, $shared = false, $maintenance = null)
 {
     $type = $db->getType();
     if (in_array($type, Installer::getDBTypes())) {
         $class = ucfirst($type) . 'Updater';
         return new $class($db, $shared, $maintenance);
     } else {
         throw new MWException(__METHOD__ . ' called for unsupported $wgDBtype');
     }
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:18,代码来源:DatabaseUpdater.php


注:本文中的Installer::getDBTypes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。