PluginProbe ʕ •ᴥ•ʔ
WP STAGING – WordPress Backup, Restore, Migration & Clone / trunk
WP STAGING – WordPress Backup, Restore, Migration & Clone vtrunk
4.9.1 4.9.0 4.8.1 trunk 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.10.0 3.2.0 3.3.1 3.3.2 3.3.3 3.4.1 3.4.3 3.5.0 3.6.0 3.7.1 3.8.0 3.8.1 3.8.2 3.8.3 3.8.4 3.8.5 3.8.6 3.8.7 3.9.0 3.9.1 3.9.2 3.9.3 3.9.4 4.0.0 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4 4.2.0 4.2.1 4.3.0 4.3.1 4.3.2 4.4.0 4.5.0 4.6.0 4.7.0 4.7.1 4.7.2 4.7.3 4.8.0
wp-staging / views / tools / tabs / system-info.php
wp-staging / views / tools / tabs Last commit date
system-info-item.php 4 months ago system-info.php 1 week ago
system-info.php
215 lines
1 <?php
2
3 use WPStaging\Core\WPStaging;
4 use WPStaging\Framework\Assets\Assets;
5 use WPStaging\Backend\Modules\SystemInfo;
6 use WPStaging\Backend\Modules\SystemInfoParser;
7 use WPStaging\Framework\Filesystem\DebugLogReader;
8
9 /** @var SystemInfo $systemInfo */
10 $systemInfo = WPStaging::getInstance()->get("systemInfo");
11 $systemInfo->setStructuredOutput(true); // Enable structured output and get sections
12
13 $parser = new SystemInfoParser();
14 $structuredData = $systemInfo->getSections();
15 $navItems = $parser->getOrderedNavigationItems($structuredData);
16 $processedSections = $parser->processStructuredData($structuredData);
17 $assets = WPStaging::make(Assets::class);
18
19 ?>
20
21 <form action="<?php echo esc_url(admin_url("admin-post.php?action=wpstg_download_sysinfo")) ?>" method="post" dir="ltr" class="wpstg--tab--active">
22 <div class="wpstg-settings-layout" id="wpstg-system-info-layout">
23 <aside class="wpstg-settings-sidebar wpstg-system-info-sidebar-sticky">
24 <span class="wpstg-settings-sidebar-label"><?php esc_html_e('System Info', 'wp-staging'); ?></span>
25 <ul class="wpstg-system-info-nav wpstg-settings-sidebar-nav">
26 <?php foreach ($navItems as $navItem) : ?>
27 <li>
28 <a href="#<?php echo esc_attr($navItem['id']); ?>" class="wpstg-settings-sidebar-item" data-section="<?php echo esc_attr($navItem['id']); ?>" title="<?php echo esc_attr($navItem['title']); ?>">
29 <?php $assets->renderSvg($navItem['icon'] ?? ''); ?>
30 <span class="wpstg-system-info-sidebar-title"><?php echo esc_html($navItem['title']); ?></span>
31 </a>
32 </li>
33 <?php endforeach; ?>
34 </ul>
35 </aside>
36
37 <div class="wpstg-settings-content-area">
38 <div class="wpstg-provider-page-header">
39 <h1 class="wpstg-text-2xl wpstg-font-semibold wpstg-text-slate-900 dark:wpstg-text-slate-100"><?php esc_html_e('System Information', 'wp-staging'); ?></h1>
40 <p class="wpstg-mt-1 wpstg-text-sm wpstg-text-slate-600 dark:wpstg-text-slate-400"><?php esc_html_e('Complete system and server information for debugging', 'wp-staging'); ?></p>
41 </div>
42 <div class="wpstg-system-info-actions wpstg-mb-6">
43 <a href="javascript:void(0)" id="wpstg-purge-backup-queue-btn" class="wpstg-btn wpstg-btn-md wpstg-btn-secondary">
44 <?php $assets->renderSvg('trash', 'wpstg--dashicons'); ?>
45 <?php esc_html_e('Purge Backup Queue', 'wp-staging'); ?>
46 </a>
47 <button type="submit" name="wpstg-download-sysinfo" class="wpstg-btn wpstg-btn-md wpstg-btn-primary">
48 <?php $assets->renderSvg('download', 'wpstg--dashicons'); ?>
49 <?php esc_html_e('Download System Info & Logs', 'wp-staging'); ?>
50 </button>
51 </div>
52 <div class="wpstg-system-info-content">
53 <?php
54 $stagingSiteFields = $parser->getStagingSiteFields();
55 $seenSectionIds = [];
56 $isFirstSection = true;
57
58 // Render processed sections
59 foreach ($processedSections as $currentIndex => $section) :
60 if (empty($section['stagingSites']) && empty($section['storageProviders']) && empty($section['infoItems'])) {
61 continue;
62 }
63
64 $sectionId = $parser->getSectionId($section['sectionName'], $navItems);
65 $isNewSection = !in_array($sectionId, $seenSectionIds, true);
66 $addOddClass = $isNewSection && !$isFirstSection;
67 if ($isNewSection) {
68 $seenSectionIds[] = $sectionId;
69 $isFirstSection = false;
70 }
71 ?>
72 <section id="<?php echo esc_attr($sectionId); ?>" class="wpstg-system-info-section <?php echo $addOddClass ? 'wpstg-is-last-odd' : ''; ?>">
73 <?php if (!empty($section['stagingSites'])) : ?>
74 <div class="wpstg-system-info-staging-sites-wrapper wpstg-card">
75 <h2 class="wpstg-system-info-card-title"><?php echo esc_html('WP Staging – Staging Sites'); ?></h2>
76 <p class="wpstg-system-info-card-subtitle"><?php esc_html_e('Configured staging environments', 'wp-staging'); ?></p>
77 <div class="wpstg-system-info-staging-sites-grid">
78 <?php foreach ($section['stagingSites'] as $index => $siteData) : ?>
79 <?php $toggleId = 'staging-site-' . $index; ?>
80 <div class="wpstg-system-info-staging-site-card wpstg-card wpstg-system-info-card-body wpstg-w-[unset]">
81 <div class="wpstg-system-info-staging-site-header wpstg-toggle-header" data-toggle-target="<?php echo esc_attr($toggleId); ?>">
82 <h4 class="wpstg-system-info-staging-site-title"><?php echo esc_html($siteData['cloneName'] ?? ''); ?></h4>
83 <svg class="wpstg-toggle-icon" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
84 <polyline points="6 9 12 15 18 9"></polyline>
85 </svg>
86 </div>
87 <div class="wpstg-system-info-staging-site-details wpstg-toggle-content" id="<?php echo esc_attr($toggleId); ?>">
88 <?php foreach ($stagingSiteFields as $fieldKey => $fieldConfig) : ?>
89 <?php if (isset($siteData[$fieldKey])) : ?>
90 <div class="wpstg-system-info-item">
91 <div class="wpstg-system-info-label"><?php echo esc_html($fieldConfig['label']); ?></div>
92 <div class="wpstg-system-info-value">
93 <?php if ($fieldConfig['is_link']) : ?>
94 <a href="<?php echo esc_url($siteData[$fieldKey]); ?>" target="_blank" title="<?php echo esc_attr($siteData[$fieldKey]); ?>"><?php echo esc_html($siteData[$fieldKey]); ?></a>
95 <?php else : ?>
96 <span class="wpstg-system-info-badge" title="<?php echo esc_attr($siteData[$fieldKey]); ?>"><?php echo esc_html($siteData[$fieldKey]); ?></span>
97 <?php endif; ?>
98 </div>
99 </div>
100 <?php endif; ?>
101 <?php endforeach; ?>
102 <?php
103 $itemLabel = __('Complete Site Info', 'wp-staging');
104 $itemValue = $siteData;
105 include __DIR__ . '/system-info-item.php';
106 ?>
107 </div>
108 </div>
109 <?php endforeach; ?>
110 </div>
111 </div>
112 <?php endif; ?>
113
114 <?php if (!empty($section['storageProviders'])) : ?>
115 <div class="wpstg-system-info-staging-sites-wrapper wpstg-card">
116 <h3 class="wpstg-system-info-card-title">
117 <?php echo esc_html(sprintf('%s (%d)', $section['sectionName'], count($section['storageProviders']))); ?>
118 </h3>
119 <p class="wpstg-system-info-card-subtitle"><?php esc_html_e('Configured remote storage providers', 'wp-staging'); ?></p>
120 <div class="wpstg-system-info-staging-sites-grid">
121 <?php foreach ($section['storageProviders'] as $index => $provider) : ?>
122 <?php $toggleId = 'storage-provider-' . $index; ?>
123 <div class="wpstg-system-info-staging-site-card wpstg-card wpstg-system-info-card-body wpstg-w-[unset]">
124 <div class="wpstg-system-info-staging-site-header wpstg-toggle-header" data-toggle-target="<?php echo esc_attr($toggleId); ?>">
125 <h4 class="wpstg-system-info-staging-site-title">
126 <?php $assets->renderSvg($provider['id'] ?? '', 'wpstg-storages-icon'); ?>
127 <?php echo esc_html($provider['name'] ?? ''); ?>
128 </h4>
129 <svg class="wpstg-toggle-icon" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
130 <polyline points="6 9 12 15 18 9"></polyline>
131 </svg>
132 </div>
133 <div class="wpstg-system-info-staging-site-details wpstg-toggle-content" id="<?php echo esc_attr($toggleId); ?>">
134 <?php foreach ($provider['settings'] ?? [] as $setting) : ?>
135 <?php
136 $itemLabel = $setting['label'] ?? '';
137 $itemValue = $setting['value'] ?? '';
138 include __DIR__ . '/system-info-item.php';
139 ?>
140 <?php endforeach; ?>
141 </div>
142 </div>
143 <?php endforeach; ?>
144 </div>
145 </div>
146 <?php endif; ?>
147
148 <?php if (!empty($section['infoItems'])) : ?>
149 <div class="wpstg-system-info-section-card wpstg-card">
150 <div class="wpstg-system-info-card-header">
151 <h3 class="wpstg-system-info-card-title"><?php echo esc_html($section['sectionName']); ?></h3>
152 <?php
153 $subtitle = $parser->getSectionSubtitle($section['sectionName']);
154 if (!empty($subtitle)) : ?>
155 <p class="wpstg-system-info-card-subtitle"><?php echo esc_html($subtitle); ?></p>
156 <?php endif; ?>
157 </div>
158 <div class="wpstg-system-info-card-body">
159 <?php foreach ($section['infoItems'] as $item) : ?>
160 <?php
161 $itemLabel = $item['label'] ?? '';
162 $itemValue = $item['value'] ?? '';
163 include __DIR__ . '/system-info-item.php';
164 ?>
165 <?php endforeach; ?>
166 </div>
167 </div>
168 <?php endif; ?>
169 </section>
170 <?php endforeach; ?>
171
172 <!-- Logs Section -->
173 <section id="logs" class="wpstg-system-info-section wpstg-system-info-logs-section">
174 <div class="wpstg-system-info-section-card wpstg-card">
175 <div class="wpstg-system-info-header wpstg-logs-header">
176 <h3 class="wpstg-system-info-card-title"><?php esc_html_e('WP Staging Logs', 'wp-staging'); ?></h3>
177 <div class="wpstg-logs-action-container">
178 <a class="wpstg-button wpstg-blue-primary" href="javascript:void(0)" title="<?php esc_attr_e('Copy WP Staging Logs', 'wp-staging'); ?>" data-wpstg-action="copy-text" data-wpstg-source="#wpstg-debug-logs-textarea">
179 <?php $assets->renderSvg('file', 'wpstg--dashicons'); ?>
180 <?php esc_html_e('Copy', 'wp-staging'); ?>
181 </a>
182 <a href="javascript:void(0)" id="wpstg-delete-debug-logs" class="wpstg-button--blue wpstg-error" title="<?php esc_attr_e('Delete WP Staging Logs', 'wp-staging'); ?>" data-url="<?php echo esc_url(admin_url() . 'admin.php?page=wpstg-tools&tab=system-info&deleteLog=wpstaging&deleteLogNonce=' . wp_create_nonce('wpstgDeleteLogNonce')); ?>">
183 <?php $assets->renderSvg('trash', 'wpstg--dashicons'); ?>
184 <?php esc_html_e('Delete', 'wp-staging'); ?>
185 </a>
186 </div>
187 </div>
188 <div class="wpstg-system-info-card-body">
189 <textarea class="wpstg-system-info-textarea" readonly="readonly" id="wpstg-debug-logs-textarea" name="wpstg-debug-logs"><?php echo esc_textarea(WPStaging::make(DebugLogReader::class)->getLastLogEntries(256 * KB_IN_BYTES, true, false)); ?></textarea>
190 </div>
191 </div>
192 <div class="wpstg-system-info-section-card wpstg-card">
193 <div class="wpstg-system-info-header wpstg-logs-header">
194 <h3 class="wpstg-system-info-card-title"><?php esc_html_e('PHP debug.log', 'wp-staging'); ?></h3>
195 <div class="wpstg-logs-action-container">
196 <a class="wpstg-button wpstg-blue-primary" href="javascript:void(0)" title="<?php esc_attr_e('Copy PHP debug.log', 'wp-staging'); ?>" data-wpstg-action="copy-text" data-wpstg-source="#wpstg-php-debug-logs-textarea">
197 <?php $assets->renderSvg('file', 'wpstg--dashicons'); ?>
198 <?php esc_html_e('Copy', 'wp-staging'); ?>
199 </a>
200 <a href="javascript:void(0)" id="wpstg-delete-php-logs" class="wpstg-button--blue wpstg-error" title="<?php esc_attr_e('Delete PHP debug.log', 'wp-staging'); ?>" data-url="<?php echo esc_url(admin_url() . 'admin.php?page=wpstg-tools&tab=system-info&deleteLog=php&deleteLogNonce=' . wp_create_nonce('wpstgDeleteLogNonce')); ?>">
201 <?php $assets->renderSvg('trash', 'wpstg--dashicons'); ?>
202 <?php esc_html_e('Delete', 'wp-staging'); ?>
203 </a>
204 </div>
205 </div>
206 <div class="wpstg-system-info-card-body">
207 <textarea class="wpstg-system-info-textarea" readonly="readonly" id="wpstg-php-debug-logs-textarea" name="wpstg-php-debug-logs"><?php echo esc_textarea(WPStaging::make(DebugLogReader::class)->getLastLogEntries(128 * KB_IN_BYTES, false, true)); ?></textarea>
208 </div>
209 </div>
210 </section>
211 </div>
212 </div>
213 </div>
214 </form>
215