//----------------------------------------- // Add db index tables //----------------------------------------- $this->ipsclass->DB->query("DESCRIBE " . SQL_PREFIX . "attachments"); $sql = $this->ipsclass->DB->simple_exec(); $queries = array(); while ( $data = $this->ipsclass->DB->fetch_row( $sql ) ) { if ( $data['Field'] == 'attach_file' AND $data['Key'] != 'MUL' ) { $queries[] = "ALTER TABLE " . SQL_PREFIX . "attachments ADD INDEX ( attach_file )"; } if ( $data['Field'] == 'torrent_id' AND $data['Key'] != 'MUL' ) { $queries[] = "ALTER TABLE " . SQL_PREFIX . "attachments ADD INDEX ( torrent_id )"; } } foreach ($queries as $query) { $this->ipsclass->DB->query($query); }