Skip to content

Commit 60aa2d5

Browse files
Setup namespace - requires dump of autoload
1 parent 7b3fa87 commit 60aa2d5

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

bluem-db.php

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,21 @@
1111
* Initialize a database table for the requests.
1212
* @return void
1313
*/
14-
function bluem_db_create_requests_table(): void {
15-
global $wpdb, $bluem_db_version;
16-
17-
$installed_ver = (float) get_option( "bluem_db_version" );
18-
19-
if ( empty( $installed_ver ) || $installed_ver < $bluem_db_version ) {
20-
$charset_collate = $wpdb->get_charset_collate();
21-
22-
include_once ABSPATH . 'wp-admin/includes/upgrade.php';
14+
function bluem_db_create_requests_table(): void
15+
{
16+
global $bluem_db_version;
2317

24-
$migrationRepository = new DatabaseMigrationRepository();
25-
foreach($migrationRepository->getMigrations($installed_ver) as $migration) {
26-
dbDelta($migration->sql);
27-
}
18+
include_once ABSPATH . 'wp-admin/includes/upgrade.php';
2819

29-
update_option(
30-
"bluem_db_version",
31-
$bluem_db_version
32-
);
20+
$repo = new DatabaseMigrationRepository();
21+
foreach($repo->getMigrations() as $migration) {
22+
dbDelta($migration->sql);
3323
}
24+
25+
update_option(
26+
"bluem_db_version",
27+
$bluem_db_version
28+
);
3429
}
3530

3631
function bluem_db_check() {

composer.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@
2525
"yoast/phpunit-polyfills": "^1.0",
2626
"vimeo/psalm": "^4.16"
2727
},
28+
"autoload": {
29+
"psr-4": {
30+
"Bluem\\WooCommerce\\": "src"
31+
}
32+
},
2833
"config": {
2934
"allow-plugins": {
3035
"composer/package-versions-deprecated": false

0 commit comments

Comments
 (0)