phpBB

Code Changes

File: phpbb/db/migration/data/v310/mysql_fulltext_drop.php

  Unmodified   Added   Modified   Removed
Line 15Line 15

class mysql_fulltext_drop extends \phpbb\db\migration\migration
{


class mysql_fulltext_drop extends \phpbb\db\migration\migration
{

 
	protected $indexes;


	public function effectively_installed()
{
// This migration is irrelevant for all non-MySQL DBMSes.

	public function effectively_installed()
{
// This migration is irrelevant for all non-MySQL DBMSes.

		return strpos($this->db->get_sql_layer(), 'mysql') === false;







		if (strpos($this->db->get_sql_layer(), 'mysql') === false)
{
return true;
}

$this->find_indexes_to_drop();
return empty($this->indexes);

	}

static public function depends_on()

	}

static public function depends_on()

Line 30Line 38

public function update_schema()
{


public function update_schema()
{

 
		if (empty($this->indexes))
{
return array();
}


		/*
* Drop FULLTEXT indexes related to MySQL fulltext search.
* Doing so is equivalent to dropping the search index from the ACP.

		/*
* Drop FULLTEXT indexes related to MySQL fulltext search.
* Doing so is equivalent to dropping the search index from the ACP.

Line 40Line 53
		*/
return array(
'drop_keys' => array(

		*/
return array(
'drop_keys' => array(

				$this->table_prefix . 'posts' => array(
'post_subject',
'post_text',
'post_content',
),

				$this->table_prefix . 'posts' => $this->indexes,





			),
);

			),
);

 
	}

public function find_indexes_to_drop()
{
if ($this->indexes !== null)
{
return $this->indexes;
}

$this->indexes = array();
$potential_keys = array('post_subject', 'post_text', 'post_content');
foreach ($potential_keys as $key)
{
if ($this->db_tools->sql_index_exists($this->table_prefix . 'posts', $key))
{
$this->indexes[] = $key;
}
}

return $this->indexes;

	}
}


	}
}