Debugs admin/plugins feature
parent
064614f73f
commit
aff2ec4003
|
|
@ -654,30 +654,36 @@ endif; ?>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Check plugin files exist
|
// Check plugin files exist
|
||||||
|
$migrationFiles = glob($plugin['path'] . '/migrations/*.sql');
|
||||||
|
$hasMigration = !empty($migrationFiles);
|
||||||
|
|
||||||
$checkResults['files'] = [
|
$checkResults['files'] = [
|
||||||
'manifest' => file_exists($plugin['path'] . '/plugin.json'),
|
'manifest' => file_exists($plugin['path'] . '/plugin.json'),
|
||||||
'bootstrap' => file_exists($plugin['path'] . '/bootstrap.php'),
|
'bootstrap' => file_exists($plugin['path'] . '/bootstrap.php'),
|
||||||
'migration' => file_exists($plugin['path'] . '/migrations/create_' . $plugin['slug'] . '_tables.sql'),
|
'migration' => $hasMigration,
|
||||||
];
|
];
|
||||||
|
|
||||||
// Check database tables
|
// Check database tables
|
||||||
global $db;
|
global $db;
|
||||||
|
$pluginTables = [];
|
||||||
if ($db instanceof PDO) {
|
if ($db instanceof PDO) {
|
||||||
$stmt = $db->query("SHOW TABLES LIKE 'user_pro_%'");
|
$stmt = $db->query("SHOW TABLES");
|
||||||
$allTables = $stmt->fetchAll(PDO::FETCH_COLUMN, 0);
|
$allTables = $stmt->fetchAll(PDO::FETCH_COLUMN, 0);
|
||||||
|
|
||||||
$migrationFile = $plugin['path'] . '/migrations/create_' . $plugin['slug'] . '_tables.sql';
|
if ($hasMigration) {
|
||||||
if (file_exists($migrationFile)) {
|
// Check each migration file for table references
|
||||||
$migrationContent = file_get_contents($migrationFile);
|
foreach ($migrationFiles as $migrationFile) {
|
||||||
$pluginTables = [];
|
$migrationContent = file_get_contents($migrationFile);
|
||||||
foreach ($allTables as $table) {
|
foreach ($allTables as $table) {
|
||||||
if (strpos($migrationContent, $table) !== false) {
|
if (strpos($migrationContent, $table) !== false) {
|
||||||
$pluginTables[] = $table;
|
$pluginTables[] = $table;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$checkResults['tables'] = $pluginTables;
|
$pluginTables = array_unique($pluginTables);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$checkResults['tables'] = $pluginTables;
|
||||||
|
|
||||||
// Check plugin functions
|
// Check plugin functions
|
||||||
$bootstrapPath = $plugin['path'] . '/bootstrap.php';
|
$bootstrapPath = $plugin['path'] . '/bootstrap.php';
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue