[ Index ]

PHP Cross Reference of phpBB-3.1.12-deutsch

title

Body

[close]

/phpbb/db/migration/data/v310/ -> postgres_fulltext_drop.php (source)

   1  <?php
   2  /**
   3  *
   4  * This file is part of the phpBB Forum Software package.
   5  *
   6  * @copyright (c) phpBB Limited <https://www.phpbb.com>
   7  * @license GNU General Public License, version 2 (GPL-2.0)
   8  *
   9  * For full copyright and license information, please see
  10  * the docs/CREDITS.txt file.
  11  *
  12  */
  13  
  14  namespace phpbb\db\migration\data\v310;
  15  
  16  class postgres_fulltext_drop extends \phpbb\db\migration\migration
  17  {
  18      protected $indexes;
  19  
  20  	public function effectively_installed()
  21      {
  22          // This migration is irrelevant for all non-PostgreSQL DBMSes.
  23          if (strpos($this->db->get_sql_layer(), 'postgres') === false)
  24          {
  25              return true;
  26          }
  27  
  28          $this->find_indexes_to_drop();
  29          return empty($this->indexes);
  30      }
  31  
  32  	static public function depends_on()
  33      {
  34          return array(
  35              '\phpbb\db\migration\data\v310\dev',
  36          );
  37      }
  38  
  39  	public function update_schema()
  40      {
  41          if (empty($this->indexes))
  42          {
  43              return array();
  44          }
  45  
  46          /*
  47          * Drop FULLTEXT indexes related to PostgreSQL fulltext search.
  48          * Doing so is equivalent to dropping the search index from the ACP.
  49          * Possibly time-consuming recreation of the search index (i.e.
  50          * FULLTEXT indexes) is left as a task to the admin to not
  51          * unnecessarily stall the upgrade process. The new search index will
  52          * then require about 40% less table space (also see PHPBB3-11040).
  53          */
  54          return array(
  55              'drop_keys' => array(
  56                  $this->table_prefix . 'posts' => $this->indexes,
  57              ),
  58          );
  59      }
  60  
  61  	public function find_indexes_to_drop()
  62      {
  63          if ($this->indexes !== null)
  64          {
  65              return $this->indexes;
  66          }
  67  
  68          $this->indexes = array();
  69          $potential_keys = array('post_subject', 'post_text', 'post_content');
  70          foreach ($potential_keys as $key)
  71          {
  72              if ($this->db_tools->sql_index_exists($this->table_prefix . 'posts', $key))
  73              {
  74                  $this->indexes[] = $key;
  75              }
  76          }
  77  
  78          return $this->indexes;
  79      }
  80  }


Generated: Thu Jan 11 00:25:41 2018 Cross-referenced by PHPXref 0.7.1