-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathactivate_plugin.php
More file actions
64 lines (51 loc) · 1.75 KB
/
activate_plugin.php
File metadata and controls
64 lines (51 loc) · 1.75 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
/**
* Activate WP Content Flow Plugin
*/
define('ABSPATH', '/var/www/html/');
require_once ABSPATH . 'wp-config.php';
require_once ABSPATH . 'wp-settings.php';
echo "🔧 Activating WP Content Flow Plugin...\n";
// Check if plugin exists
$plugin_file = 'wp-content-flow/wp-content-flow.php';
$plugin_path = WP_PLUGIN_DIR . '/' . $plugin_file;
if (!file_exists($plugin_path)) {
echo "❌ Plugin file not found: $plugin_path\n";
exit(1);
}
echo "✅ Plugin file exists: $plugin_path\n";
// Get current active plugins
$active_plugins = get_option('active_plugins', array());
echo "Currently active plugins: " . count($active_plugins) . "\n";
// Check if already active
if (in_array($plugin_file, $active_plugins)) {
echo "✅ Plugin is already active!\n";
} else {
echo "🔧 Plugin is inactive, activating...\n";
// Add to active plugins
$active_plugins[] = $plugin_file;
// Update option
$result = update_option('active_plugins', $active_plugins);
if ($result) {
echo "✅ Plugin activated successfully!\n";
// Verify activation
$updated_active = get_option('active_plugins', array());
if (in_array($plugin_file, $updated_active)) {
echo "✅ Activation verified in database\n";
} else {
echo "❌ Activation not verified in database\n";
}
} else {
echo "❌ Failed to update active_plugins option\n";
}
}
// Try to load the plugin to check for errors
echo "\n🔍 Testing plugin loading...\n";
try {
include_once $plugin_path;
echo "✅ Plugin file loaded without fatal errors\n";
} catch (Exception $e) {
echo "❌ Plugin loading error: " . $e->getMessage() . "\n";
}
echo "\n🏁 Plugin activation complete\n";
?>