-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathDatabaseMissing.php
51 lines (41 loc) · 1.26 KB
/
DatabaseMissing.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
namespace AC\Admin\Notice;
use AC\ListScreen;
use AC\Message;
use AC\Plugin\Install\Database;
use AC\Registerable;
use AC\Service\Setup;
class DatabaseMissing implements Registerable
{
public function register(): void
{
add_action('ac/settings/notice', [$this, 'render_notice']);
}
public function render_notice(ListScreen $list_screen): void
{
global $wpdb;
if ( ! Database::verify_database_exists()) {
$message = sprintf(
__('Database table %s is missing.', 'codepress-admin-columns'),
'`' . $wpdb->prefix . 'admin_columns`'
);
$message .= ' ' . sprintf(
'<a href="%s">%s</a>',
esc_url(
(string)$list_screen->get_editor_url()->with_arg(Setup::PARAM_FORCE_INSTALL, '1')
),
esc_html(
__('Create database table.', 'codepress-admin-columns')
)
);
$notice = new Message\InlineMessage(
sprintf(
'<p>%s</p>',
$message
),
Message::ERROR
);
echo $notice->render();
}
}
}