@@ -71,12 +71,6 @@ public function __construct( $plugin ) {
71
71
$ this ->db_version = $ this ->get_db_version ();
72
72
$ this ->stream_url = self_admin_url ( $ this ->plugin ->admin ->admin_parent_page . '&page= ' . $ this ->plugin ->admin ->settings_page_slug );
73
73
74
- // Check DB and display an admin notice if there are tables missing.
75
- add_action ( 'init ' , array ( $ this , 'verify_db ' ) );
76
-
77
- // Install the plugin.
78
- add_action ( 'wp_stream_before_db_notices ' , array ( $ this , 'check ' ) );
79
-
80
74
register_activation_hook ( $ this ->plugin ->locations ['plugin ' ], array ( $ this , 'check ' ) );
81
75
}
82
76
@@ -137,87 +131,6 @@ public function check() {
137
131
$ this ->update_db_option ();
138
132
}
139
133
140
- /**
141
- * Verify that the required DB tables exists
142
- *
143
- * @return void
144
- */
145
- public function verify_db () {
146
- /**
147
- * Filter will halt install() if set to true
148
- *
149
- * @param bool
150
- *
151
- * @return bool
152
- */
153
- if ( apply_filters ( 'wp_stream_no_tables ' , false ) ) {
154
- return ;
155
- }
156
-
157
- if ( ! function_exists ( 'is_plugin_active_for_network ' ) ) {
158
- require_once ABSPATH . '/wp-admin/includes/plugin.php ' ;
159
- }
160
-
161
- /**
162
- * Fires before admin notices are triggered for missing database tables.
163
- */
164
- do_action ( 'wp_stream_before_db_notices ' );
165
-
166
- global $ wpdb ;
167
-
168
- $ database_message = '' ;
169
- $ uninstall_message = '' ;
170
-
171
- // Check if all needed DB is present.
172
- $ missing_tables = array ();
173
-
174
- foreach ( $ this ->plugin ->db ->get_table_names () as $ table_name ) {
175
- $ table_search = $ wpdb ->get_var (
176
- $ wpdb ->prepare ( 'SHOW TABLES LIKE %s ' , $ table_name )
177
- );
178
- if ( $ table_search !== $ table_name ) {
179
- $ missing_tables [] = $ table_name ;
180
- }
181
- }
182
-
183
- if ( $ missing_tables ) {
184
- $ database_message .= sprintf (
185
- '%s <strong>%s</strong> ' ,
186
- _n (
187
- 'The following table is not present in the WordPress database: ' ,
188
- 'The following tables are not present in the WordPress database: ' ,
189
- count ( $ missing_tables ),
190
- 'stream '
191
- ),
192
- esc_html ( implode ( ', ' , $ missing_tables ) )
193
- );
194
- }
195
-
196
- if ( $ this ->plugin ->is_network_activated () && current_user_can ( 'manage_network_plugins ' ) ) {
197
- $ uninstall_message = sprintf (
198
- /* translators: %#$s: HTML Link tags (e.g. "<a href="https://foo.com/wp-admin/">") */
199
- __ ( 'Please %1$suninstall%2$s the Stream plugin and activate it again. ' , 'stream ' ),
200
- '<a href=" ' . network_admin_url ( 'plugins.php#stream ' ) . '"> ' ,
201
- '</a> '
202
- );
203
- } elseif ( current_user_can ( 'activate_plugins ' ) ) {
204
- $ uninstall_message = sprintf (
205
- /* translators: %#$s: HTML Link tags (e.g. "<a href="https://foo.com/wp-admin/">") */
206
- __ ( 'Please %1$suninstall%2$s the Stream plugin and activate it again. ' , 'stream ' ),
207
- '<a href=" ' . admin_url ( 'plugins.php#stream ' ) . '"> ' ,
208
- '</a> '
209
- );
210
- }
211
-
212
- if ( ! empty ( $ database_message ) ) {
213
- $ this ->plugin ->admin ->notice ( $ database_message );
214
-
215
- if ( ! empty ( $ uninstall_message ) ) {
216
- $ this ->plugin ->admin ->notice ( $ uninstall_message );
217
- }
218
- }
219
- }
220
-
221
134
/**
222
135
* Register a routine to be called when stream or a stream connector has been updated
223
136
* It works by comparing the current version with the version previously stored in the database.
0 commit comments