PluginProbe
Booktics – Appointment Booking Calendar for Service Businesses / 1.0.29
Booktics – Appointment Booking Calendar for Service Businesses v1.0.29
1.0.29 1.0.28 1.0.27 1.0.26 1.0.25 1.0.24 1.0.23 1.0.22 1.0.21 1.0.20 1.0.19 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.2 1.0.3 All 31 releases
← All changes | base/installer.php +24 -12 1.0.14 → 1.0.29 View file →
@@ -1,8 +1,12 @@
1 1 <?php
2 2
3 3 namespace Booktics;
4 4
5 +if ( ! defined( 'ABSPATH' ) ) {
6 + exit;
7 +}
8 +
5 9 use Booktics\Dummy_Data\Dummy_Data_Manager;
6 10
7 11 class Installer {
8 12 /**
@@ -148,8 +152,10 @@
148 152 foreach ( $table_schema as $table_sql ) {
149 153 dbDelta( $table_sql );
150 154 }
151 155
156 + // phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.SchemaChange, WordPress.DB.PreparedSQL.NotPrepared -- Schema migration; direct DB access required, caching inappropriate for DDL, identifiers sanitized via esc_sql().
157 +
152 158 // Add currency column to existing orders table if it doesn't exist
153 159 $orders_table = "{$table_prefix}booktics_orders";
154 160 $column_exists = $wpdb->get_results(
155 161 "SHOW COLUMNS FROM `" . \esc_sql( $orders_table ) . "` LIKE 'currency'"
@@ -229,15 +235,17 @@
229 235 );
230 236
231 237 foreach ( $orders_columns_to_add as $column => $definition ) {
232 238 if ( ! in_array( $column, $orders_columns, true ) ) {
233 - $query = sprintf(
234 - 'ALTER TABLE `%s` ADD COLUMN `%s` %s',
235 - esc_sql( $orders_table ),
236 - esc_sql( $column ),
237 - $definition
239 + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.SchemaChange, WordPress.DB.PreparedSQL.NotPrepared -- Schema migration; identifiers sanitized via esc_sql().
240 + $wpdb->query(
241 + sprintf(
242 + 'ALTER TABLE `%s` ADD COLUMN `%s` %s',
243 + esc_sql( $orders_table ),
244 + esc_sql( $column ),
245 + $definition
246 + )
238 247 );
239 - $wpdb->query( $query );
240 248 }
241 249 }
242 250
243 251 // Add index for directorist_id if it doesn't exist
@@ -281,15 +289,19 @@
281 289 );
282 290
283 291 foreach ( $cart_items_columns_to_add as $column => $definition ) {
284 292 if ( ! in_array( $column, $cart_items_columns, true ) ) {
285 - $query = sprintf(
286 - 'ALTER TABLE `%s` ADD COLUMN `%s` %s',
287 - esc_sql( $cart_items_table ),
288 - esc_sql( $column ),
289 - $definition
293 + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.SchemaChange, WordPress.DB.PreparedSQL.NotPrepared -- Schema migration; identifiers sanitized via esc_sql().
294 + $wpdb->query(
295 + sprintf(
296 + 'ALTER TABLE `%s` ADD COLUMN `%s` %s',
297 + esc_sql( $cart_items_table ),
298 + esc_sql( $column ),
299 + $definition
300 + )
290 301 );
291 - $wpdb->query( $query );
292 302 }
293 303 }
304 +
305 + // phpcs:enable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.SchemaChange, WordPress.DB.PreparedSQL.NotPrepared
294 306 }
295 307 }