示例#1
0
 /**
  * Creates the migrations table if it does not exist.
  * @return null
  */
 public function create_migrations_table()
 {
     // Make sure migrations have been installed.
     if (!$this->db_tools->sql_table_exists($this->table_prefix . 'migrations')) {
         $this->db_tools->sql_create_table($this->table_prefix . 'migrations', array('COLUMNS' => array('migration_name' => array('VCHAR', ''), 'migration_depends_on' => array('TEXT', ''), 'migration_schema_done' => array('BOOL', 0), 'migration_data_done' => array('BOOL', 0), 'migration_data_state' => array('TEXT', ''), 'migration_start_time' => array('TIMESTAMP', 0), 'migration_end_time' => array('TIMESTAMP', 0)), 'PRIMARY_KEY' => 'migration_name'));
     }
 }
示例#2
0
 /**
  * Returns true if the sphinx table was created
  *
  * @return bool true if sphinx table was created
  */
 public function index_created($allow_new_files = true)
 {
     $created = false;
     if ($this->db_tools->sql_table_exists(SPHINX_TABLE)) {
         $created = true;
     }
     return $created;
 }
示例#3
0
 /**
  * Gets the PBWoW config data from the DB, or the cache if it is present
  */
 protected function get_pbwow_config()
 {
     if (($this->pbwow_config = $this->cache->get('pbwow_config')) != true) {
         $this->pbwow_config = array();
         if ($this->db_tools->sql_table_exists($this->pbwow_config_table)) {
             $sql = 'SELECT config_name, config_value FROM ' . $this->pbwow_config_table;
             $result = $this->db->sql_query($sql);
             while ($row = $this->db->sql_fetchrow($result)) {
                 $this->pbwow_config[$row['config_name']] = $row['config_value'];
             }
             $this->db->sql_freeresult($result);
         }
         $this->cache->put('pbwow_config', $this->pbwow_config);
     }
 }
示例#4
0
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
$mysql_indexer = $drop_index = false;
if (strtolower($row['Type']) === 'mediumtext') {
    $mysql_indexer = true;
}
if (strtolower($row['Key']) === 'mul') {
    $drop_index = true;
}
echo "USE {$dbname};{$newline}{$newline}";
@set_time_limit(0);
$finder = new \phpbb\finder(new \phpbb\filesystem(), $phpbb_root_path);
$classes = $finder->core_path('phpbb/')->directory('/db/migration/data')->get_classes();
$schema_generator = new \phpbb\db\migration\schema_generator($classes, $config, $db, new \phpbb\db\tools($db, true), $phpbb_root_path, $phpEx, $table_prefix);
$schema_data = $schema_generator->get_schema();
$dbms_type_map = \phpbb\db\tools::get_dbms_type_map();
foreach ($schema_data as $table_name => $table_data) {
    $table_name = str_replace('phpbb_', $prefix, $table_name);
    // Write comment about table
    echo "# Table: '{$table_name}'{$newline}";
    // Create Table statement
    $generator = $textimage = false;
    // Do we need to DROP a fulltext index before we alter the table?
    if ($table_name == $prefix . 'posts' && $drop_index) {
        echo "ALTER TABLE {$table_name}{$newline}";
        echo "DROP INDEX post_text,{$newline}DROP INDEX post_subject,{$newline}DROP INDEX post_content;{$newline}{$newline}";
    }
    $line = "ALTER TABLE {$table_name} {$newline}";
    // Table specific so we don't get overlap
    $modded_array = array();
    // Write columns one by one...
 /**
  * Check if avatars by gender can be enabled
  * @return	bool
  */
 public function can_enable_gender_avatars()
 {
     return $this->db_tools->sql_column_exists(USERS_TABLE, 'user_gender');
 }