updateRowExists( 'initial_indexes' ) || $this->db->indexExists( 'user', 'user_name', __METHOD__ ) ) { $this->output( "...have initial indexes\n" ); return; } $this->applyPatch( 'initial-indexes.sql', false, "Adding initial indexes" ); } protected function sqliteSetupSearchindex() { $module = DatabaseSqlite::getFulltextSearchModule(); $fts3tTable = $this->updateRowExists( 'fts3' ); if ( $fts3tTable && !$module ) { $this->applyPatch( 'searchindex-no-fts.sql', false, 'PHP is missing FTS3 support, downgrading tables' ); } elseif ( !$fts3tTable && $module == 'FTS3' ) { $this->applyPatch( 'searchindex-fts3.sql', false, "Adding FTS3 search capabilities" ); } else { $this->output( "...fulltext search table appears to be in order.\n" ); } } /** * Check whether an index contain a field * * @param string $table Table name * @param string $index Index name to check * @param string $field Field that should be in the index * @return bool */ protected function indexHasField( $table, $index, $field ) { if ( !$this->doTable( $table ) ) { return true; } $info = $this->db->indexInfo( $table, $index, __METHOD__ ); if ( $info ) { foreach ( $info as $column ) { if ( $column == $field ) { $this->output( "...index $index on table $table includes field $field.\n" ); return true; } } } $this->output( "...index $index on table $table has no field $field; added.\n" ); return false; } protected function doFixIpbAddressUniqueIndex() { if ( !$this->indexHasField( 'ipblocks', 'ipb_address_unique', 'ipb_anon_only' ) ) { $this->output( "...ipb_address_unique index up-to-date.\n" ); return; } $this->applyPatch( 'patch-ipblocks-fix-ipb_address_unique.sql', false, 'Removing ipb_anon_only column from ipb_address_unique index' ); } }