prefix ), $database->get_charset_collate() ); return new self( $query_runner, $schema, $options_table ); } public function uninstall(): void { $this->schema->drop(); foreach ( $this->plugin_option_names() as $option_name ) { delete_option( $option_name ); } foreach ( JobId::cases() as $job ) { wp_clear_scheduled_hook( $job->hook_name() ); } } /** @return list */ private function plugin_option_names(): array { $conditions = array(); foreach ( self::OPTION_PREFIXES as $option_prefix ) { $conditions[] = $this->query_runner->prepare( 'option_name LIKE %s', $this->query_runner->escape_like( $option_prefix ) . self::LIKE_ANY_ENDING ); } $rows = $this->query_runner->rows( 'SELECT option_name FROM ' . $this->options_table . ' WHERE ' . implode( self::CONDITION_SEPARATOR, $conditions ) ); $option_names = array(); foreach ( $rows as $row ) { $option_names[] = (string) ( $row['option_name'] ?? '' ); } return $option_names; } }