-
Notifications
You must be signed in to change notification settings - Fork 4
/
wp-find-plugins.php
60 lines (41 loc) · 1.5 KB
/
wp-find-plugins.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
52
53
54
55
56
57
58
59
60
<?php
# Root database password - PROTECT THIS FILE WITH chmod 700 !!!!
$pw = 'dbpass';
/*
PHP command-line shell script to access the WordPress database and print out the list of active plugins.
This script does NOT auto-upgrade plugins - it simply reports on which plugins are in use so you can
compare them to lists of known-incompatible plugins before upgrading sites.
You shouldn't need to call this directly - it gets called from wp-mass-plugins.sh.
Just configure the db password below.
From http://gist.github.com/506055
ORIGINAL SYNTAX:
php wp-active-plugins.php $host $db $user $pw
For example:
php wp-active-plugins.php localhost my_wp_db my_wp_login abc123
By Mike Schinkel (http://mikeschinkel.com/custom-wordpress-plugins/)
Licensed GPLv2
This script has been slightly modified by Scot Hacker. Usage is now simply:
php -f /path/to/wp-find-plugins.php $dbname
*/
list($script,$db) = $_SERVER['argv'];
$host = 'localhost';
$user = 'root';
$link = mysql_connect($host,$user,$pw);
if (!$link) {
die('Could not connect: ' . mysql_error());
}
$db_selected = mysql_select_db($db, $link);
if (!$db_selected) {
die ("Can\'t use $db: " . mysql_error());
}
$result = mysql_query("SELECT option_value FROM wp_options WHERE option_name = 'active_plugins'");
if (!$result) {
die('Invalid query: ' . mysql_error());
}
$row = mysql_fetch_assoc($result);
$plugins = unserialize($row['option_value']);
foreach($plugins as $plugin)
echo "$plugin\n";
mysql_free_result($result);
mysql_close($link);
?>