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


PHP Webtrees\Database类代码示例

本文整理汇总了PHP中Fisharebest\Webtrees\Database的典型用法代码示例。如果您正苦于以下问题:PHP Database类的具体用法?PHP Database怎么用?PHP Database使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Database类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: upgrade

 /**
  * Upgrade to to the next version
  */
 public function upgrade()
 {
     $index_dir = Site::getPreference('INDEX_DIRECTORY');
     // Due to the language code changes in 1.7.0, we need to update some other settings
     foreach ($this->languages as $old => $new) {
         try {
             Database::prepare("UPDATE `##site_setting` SET setting_name = REPLACE(setting_name, :old, :new) " . "WHERE setting_name LIKE 'WELCOME_TEXT_AUTH_MODE_%'")->execute(array('old' => $old, 'new' => $new));
         } catch (PDOException $ex) {
             // Duplicate key? Already done?
         }
         Database::prepare("UPDATE `##block_setting` SET setting_value = REPLACE(setting_value, :old, :new) " . "WHERE setting_name = 'languages'")->execute(array('old' => $old, 'new' => $new));
         // Historical fact files
         if (file_exists($index_dir . 'histo.' . $old . '.php') && !file_exists($index_dir . 'histo.' . $new . '.php')) {
             rename($index_dir . 'histo.' . $old . '.php', $index_dir . 'histo.' . $new . '.php');
         }
         // Language files
         if (file_exists($index_dir . 'language/' . $old . '.php') && !file_exists($index_dir . 'language/' . $new . '.php')) {
             rename($index_dir . 'language/' . $old . '.php', $index_dir . 'language/' . $new . '.php');
         }
         if (file_exists($index_dir . 'language/' . $old . '.csv') && !file_exists($index_dir . 'language/' . $new . '.csv')) {
             rename($index_dir . 'language/' . $old . '.csv', $index_dir . 'language/' . $new . '.csv');
         }
         if (file_exists($index_dir . 'language/' . $old . '.mo') && !file_exists($index_dir . 'language/' . $new . '.mo')) {
             rename($index_dir . 'language/' . $old . '.mo', $index_dir . 'language/' . $new . '.mo');
         }
     }
 }
开发者ID:tronsmit,项目名称:webtrees,代码行数:30,代码来源:Migration31.php

示例3: upgrade

 /**
  * Upgrade to to the next version
  */
 public function upgrade()
 {
     // IPv6 addresses can be up to 45 characters.
     Database::exec("ALTER TABLE `##log`     CHANGE ip_address ip_address VARCHAR(45) NOT NULL");
     Database::exec("ALTER TABLE `##message` CHANGE ip_address ip_address VARCHAR(45) NOT NULL");
     Database::exec("ALTER TABLE `##session` CHANGE ip_address ip_address VARCHAR(45) NOT NULL");
 }
开发者ID:tronsmit,项目名称:webtrees,代码行数:10,代码来源:Migration36.php

示例4: upgrade

 /**
  * Upgrade to to the next version
  */
 public function upgrade()
 {
     // Update config data defining theme selection
     Database::exec("UPDATE `##gedcom_setting` SET setting_value=TRIM(LEADING 'themes/' FROM TRIM(TRAILING '/' FROM setting_value)) WHERE setting_name='THEME_DIR'");
     Database::exec("UPDATE `##user_setting` SET setting_value=TRIM(LEADING 'themes/' FROM TRIM(TRAILING '/' FROM setting_value)) WHERE setting_name='THEME_DIR'");
     Database::exec("UPDATE `##user_gedcom_setting` SET setting_value=TRIM(LEADING 'themes/' FROM TRIM(TRAILING '/' FROM setting_value)) WHERE setting_name='THEME_DIR'");
 }
开发者ID:tunandras,项目名称:webtrees,代码行数:10,代码来源:Migration7.php

示例5: upgrade

 /**
  * Upgrade to to the next version
  */
 public function upgrade()
 {
     // Delete old configuration setting
     Database::exec("DELETE FROM `##gedcom_setting` WHERE setting_name IN ('SEARCH_FACTS_DEFAULT', 'DISPLAY_JEWISH_GERESHAYIM', 'DISPLAY_JEWISH_THOUSANDS')");
     // Increase the password column from 64 to 128 characters
     Database::exec("ALTER TABLE `##user` CHANGE password password VARCHAR(128) COLLATE utf8_unicode_ci NOT NULL");
 }
开发者ID:tunandras,项目名称:webtrees,代码行数:10,代码来源:Migration10.php

示例6: upgrade

 /** {@inheritDoc} */
 public function upgrade()
 {
     $module_options = 'FTV_OPTIONS';
     $ftv_options = Database::prepare("SELECT setting_value FROM `##module_setting` WHERE setting_name=?")->execute(array($module_options))->fetchOne();
     $options = unserialize($ftv_options);
     if (!empty($options)) {
         foreach ($options as $option) {
             foreach ($option as $key => $value) {
                 if ($key == 'USE_FTV_THUMBS') {
                     $option['RESIZE_THUMBS'] = $value;
                     unset($option[$key]);
                 }
                 if ($key == 'COUNTRY') {
                     unset($option[$key]);
                 }
             }
             $option['USE_GEDCOM_PLACES'] = '1';
             $option['THUMB_RESIZE_FORMAT'] = '2';
             $new_options[] = $option;
         }
         if (isset($new_options)) {
             Database::prepare("UPDATE `##module_setting` SET setting_value=? WHERE setting_name=?")->execute(array(serialize($new_options), $module_options));
         }
         unset($new_options);
     }
 }
开发者ID:bxbroze,项目名称:webtrees,代码行数:27,代码来源:Migration7.php

示例7: upgrade

 /**
  * Upgrade to to the next version
  */
 public function upgrade()
 {
     // - delete unused settings and update indexes
     Database::exec("DELETE FROM `##site_setting` WHERE setting_name IN ('WELCOME_TEXT_CUST_HEAD')");
     // Modern versions of Internet Explorer use a different user-agent string
     Database::exec("INSERT IGNORE INTO `##site_access_rule` (user_agent_pattern, rule, comment) VALUES" . " ('Mozilla/% (Windows%; Trident%; rv:%) like Gecko', 'allow', 'Modern Internet Explorer')");
 }
开发者ID:tunandras,项目名称:webtrees,代码行数:10,代码来源:Migration25.php

示例8: upgrade

 /**
  * Upgrade to to the next version
  */
 public function upgrade()
 {
     // Use LONGTEXT instead of TEXT and MEDIUMTEXT, and make NOT NULL.
     Database::exec("UPDATE `##news`   SET body          = '' WHERE body          IS NULL");
     Database::exec("UPDATE `##other`  SET o_gedcom      = '' WHERE o_gedcom      IS NULL");
     Database::exec("UPDATE `##places` SET p_std_soundex = '' WHERE p_std_soundex IS NULL");
     Database::exec("UPDATE `##places` SET p_dm_soundex  = '' WHERE p_dm_soundex  IS NULL");
     Database::exec("ALTER TABLE `##block_setting`  CHANGE setting_value setting_value LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
     Database::exec("ALTER TABLE `##change`         CHANGE new_gedcom    new_gedcom    LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
     Database::exec("ALTER TABLE `##change`         CHANGE old_gedcom    old_gedcom    LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
     Database::exec("ALTER TABLE `##families`       CHANGE f_gedcom      f_gedcom      LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
     Database::exec("ALTER TABLE `##individuals`    CHANGE i_gedcom      i_gedcom      LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
     Database::exec("ALTER TABLE `##log`            CHANGE log_message   log_message   LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
     Database::exec("ALTER TABLE `##media`          CHANGE m_gedcom      m_gedcom      LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
     Database::exec("ALTER TABLE `##message`        CHANGE body          body          LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
     Database::exec("ALTER TABLE `##module_setting` CHANGE setting_value setting_value LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
     Database::exec("ALTER TABLE `##news`           CHANGE body          body          LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
     Database::exec("ALTER TABLE `##other`          CHANGE o_gedcom      o_gedcom      LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
     Database::exec("ALTER TABLE `##places`         CHANGE p_std_soundex p_std_soundex LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
     Database::exec("ALTER TABLE `##places`         CHANGE p_dm_soundex  p_dm_soundex  LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
     Database::exec("ALTER TABLE `##sources`        CHANGE s_gedcom      s_gedcom      LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
     // Use LONGBLOB instead of MEDIUMBLOB.
     Database::exec("ALTER TABLE `##gedcom_chunk`   CHANGE chunk_data    chunk_data    LONGBLOB NOT NULL");
     Database::exec("ALTER TABLE `##session`        CHANGE session_data  session_data  LONGBLOB NOT NULL");
 }
开发者ID:tronsmit,项目名称:webtrees,代码行数:28,代码来源:Migration35.php

示例9: upgrade

 /** {@inheritDoc} */
 public function upgrade()
 {
     // add key 'LINK' to FTV_SETTINGS
     // change options to multidimensional array with array key = tree id.
     $module_settings = 'FTV_SETTINGS';
     $ftv_settings = Database::prepare("SELECT setting_value FROM `##module_setting` WHERE setting_name=?")->execute(array($module_settings))->fetchOne();
     $settings = unserialize($ftv_settings);
     if (!empty($settings)) {
         foreach ($settings as $setting) {
             if (!array_key_exists('LINK', $setting)) {
                 $setting['LINK'] = I18N::translate('Descendants of the %s family', $setting['SURNAME']);
                 $new_settings[] = $setting;
             }
         }
         if (isset($new_settings)) {
             Database::prepare("UPDATE `##module_setting` SET setting_value=? WHERE setting_name=?")->execute(array(serialize($new_settings), $module_settings));
         }
         unset($new_settings);
     }
     $module_options = 'FTV_OPTIONS';
     $ftv_options = Database::prepare("SELECT setting_value FROM `##module_setting` WHERE setting_name=?")->execute(array($module_options))->fetchOne();
     $options = unserialize($ftv_options);
     if (!empty($options)) {
         $show_places = array_key_exists('SHOW_PLACES', $options) ? $options['SHOW_PLACES'] : '1';
         $country = array_key_exists('COUNTRY', $options) ? $options['COUNTRY'] : '';
         $show_occu = array_key_exists('SHOW_OCCU', $options) ? $options['SHOW_OCCU'] : '1';
         foreach (Tree::getAll() as $tree) {
             $new_options[$tree->getTreeId()] = array('SHOW_PLACES' => $show_places, 'COUNTRY' => $country, 'SHOW_OCCU' => $show_occu);
         }
         if (isset($new_options)) {
             Database::prepare("UPDATE `##module_setting` SET setting_value=? WHERE setting_name=?")->execute(array(serialize($new_options), $module_options));
         }
         unset($new_options);
     }
 }
开发者ID:bxbroze,项目名称:webtrees,代码行数:36,代码来源:Migration0.php

示例10: upgrade

 /** {@inheritDoc} */
 public function upgrade()
 {
     // Add new columns
     try {
         Database::exec("ALTER TABLE `##news`" . " ADD user_id INTEGER NULL AFTER n_id," . " ADD gedcom_id INTEGER NULL AFTER user_id," . " ADD updated TIMESTAMP ON UPDATE CURRENT_TIMESTAMP DEFAULT CURRENT_TIMESTAMP," . " ADD KEY news_ix1 (user_id, updated)," . " ADD KEY news_ix2 (gedcom_id, updated)");
     } catch (PDOException $ex) {
         // Already updated?
     }
     // Migrate data from the old columns to the new ones
     try {
         Database::exec("UPDATE `##news` n" . " LEFT JOIN `##gedcom` g ON (n.n_username=g.gedcom_name)" . " LEFT JOIN `##user` u ON (n.n_username=u.user_name)" . " SET n.gedcom_id=g.gedcom_id, n.user_id=u.user_id, updated=FROM_UNIXTIME(n_date)");
     } catch (PDOException $ex) {
         // Already updated?
     }
     // Delete orphaned rows
     try {
         Database::exec("DELETE FROM `##news` WHERE user_id IS NULL AND gedcom_id IS NULL");
     } catch (PDOException $ex) {
         // Already updated?
     }
     // Delete/rename old columns
     try {
         Database::exec("ALTER TABLE `##news`" . " DROP n_username, DROP n_date," . " CHANGE n_id news_id INTEGER NOT NULL AUTO_INCREMENT," . " CHANGE n_title subject VARCHAR(255) COLLATE utf8_unicode_ci," . " CHANGE n_text body TEXT COLLATE utf8_unicode_ci");
     } catch (PDOException $ex) {
         // Already updated?
     }
 }
开发者ID:tunandras,项目名称:webtrees,代码行数:28,代码来源:Migration1.php

示例11: upgrade

 /**
  * Upgrade to to the next version
  */
 public function upgrade()
 {
     // Tree settings become site settings
     Database::exec("INSERT IGNORE INTO `##site_setting` (setting_name, setting_value)" . " SELECT setting_name, setting_value" . " FROM `##gedcom_setting`" . " WHERE setting_name IN ('SHOW_REGISTER_CAUTION', 'WELCOME_TEXT_CUST_HEAD') OR setting_name LIKE 'WELCOME_TEXT_AUTH_MODE%'" . " GROUP BY setting_name");
     Database::exec("DELETE FROM `##gedcom_setting` WHERE setting_name IN ('ALLOW_EDIT_GEDCOM', 'SHOW_REGISTER_CAUTION', 'WELCOME_TEXT_CUST_HEAD') OR setting_name LIKE 'WELCOME_TEXT_AUTH_MODE%'");
     Database::exec("DELETE FROM `##site_setting` WHERE setting_name IN ('STORE_MESSAGES')");
 }
开发者ID:tunandras,项目名称:webtrees,代码行数:10,代码来源:Migration24.php

示例12: upgrade

 /** {@inheritDoc} */
 public function upgrade()
 {
     // Add the new columns
     try {
         Database::exec("ALTER TABLE `##favorites`" . " CHANGE fv_id    favorite_id   INTEGER AUTO_INCREMENT NOT NULL," . " CHANGE fv_gid   xref          VARCHAR(20) NULL," . " CHANGE fv_type  favorite_type ENUM('INDI', 'FAM', 'SOUR', 'REPO', 'OBJE', 'NOTE', 'URL') NOT NULL," . " CHANGE fv_url   url           VARCHAR(255) NULL," . " CHANGE fv_title title         VARCHAR(255) NULL," . " CHANGE fv_note  note          VARCHAR(1000) NULL," . " ADD user_id   INTEGER     NULL AFTER favorite_id," . " ADD gedcom_id INTEGER NOT NULL AFTER user_id," . " DROP KEY ix1," . " ADD KEY news_ix1 (gedcom_id, user_id)");
     } catch (PDOException $ex) {
         // Already updated?
     }
     // Migrate data from the old columns to the new ones
     try {
         Database::exec("UPDATE `##favorites` f" . " LEFT JOIN `##gedcom` g ON (f.fv_file    =g.gedcom_name)" . " LEFT JOIN `##user`   u ON (f.fv_username=u.user_name)" . " SET f.gedcom_id=g.gedcom_id, f.user_id=u.user_id");
     } catch (PDOException $ex) {
         // Already updated?
     }
     // Delete orphaned rows
     try {
         Database::exec("DELETE FROM `##favorites` WHERE user_id IS NULL AND gedcom_id IS NULL");
     } catch (PDOException $ex) {
         // Already updated?
     }
     // Delete the old column
     try {
         Database::exec("ALTER TABLE `##favorites` DROP fv_username, DROP fv_file");
     } catch (PDOException $ex) {
         // Already updated?
     }
     // Rename the table
     try {
         Database::exec("RENAME TABLE `##favorites` TO `##favorite`");
     } catch (PDOException $ex) {
         // Already updated?
     }
 }
开发者ID:tunandras,项目名称:webtrees,代码行数:34,代码来源:Migration1.php

示例13: upgrade

 /**
  * Upgrade to to the next version
  */
 public function upgrade()
 {
     try {
         Database::prepare("ALTER TABLE `##site_setting` CHANGE setting_value setting_value VARCHAR(2000) NOT NULL")->execute();
     } catch (PDOException $ex) {
         // Already done?
     }
 }
开发者ID:tunandras,项目名称:webtrees,代码行数:11,代码来源:Migration32.php

示例14: upgrade

 /**
  * Upgrade to to the next version
  */
 public function upgrade()
 {
     // Delete old config settings
     Database::exec("DELETE FROM `##gedcom_setting` WHERE setting_name IN('GEDCOM_DEFAULT_TAB', 'LINK_ICONS', 'ZOOM_BOXES')");
     Database::exec("DELETE FROM `##user_setting` WHERE setting_name='default'");
     // There is no way to add a RESN tag to NOTE objects
     Database::exec("UPDATE `##gedcom_setting` SET setting_value='SOUR,RESN' WHERE setting_name='NOTE_FACTS_ADD' AND setting_value='SOUR'");
 }
开发者ID:tronsmit,项目名称:webtrees,代码行数:11,代码来源:Migration14.php

示例15: upgrade

 /**
  * Upgrade to to the next version
  */
 public function upgrade()
 {
     try {
         Database::prepare("ALTER TABLE `##site_setting` CHANGE setting_value setting_value VARCHAR(2000) NOT NULL")->execute();
     } catch (PDOException $ex) {
         // Already done?
     }
     Database::prepare("DELETE FROM `##change` WHERE old_gedcom = '' AND new_gedcom = ''")->execute();
 }
开发者ID:tronsmit,项目名称:webtrees,代码行数:12,代码来源:Migration32.php


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