<?php $dir=rtrim($argv[1],'/');$s=file_get_contents($dir.'/wp-config.php');
function gc($s,$k){return preg_match('/define\(\s*[\x27\x22]'.$k.'[\x27\x22]\s*,\s*[\x27\x22]([^\x27\x22]*)/',$s,$m)?$m[1]:'';}
$pfx=preg_match('/\$table_prefix\s*=\s*[\x27\x22]([^\x27\x22]+)/',$s,$m)?$m[1]:'wp_';
$h=gc($s,'DB_HOST');$p=0;if(strpos($h,':')!==false){list($h,$p)=explode(':',$h,2);}
$m=@new mysqli($h,gc($s,'DB_USER'),gc($s,'DB_PASSWORD'),gc($s,'DB_NAME'),$p?:3306);
foreach(['active_plugins','template','stylesheet'] as $o){$r=$m->query("SELECT option_value FROM {$pfx}options WHERE option_name='$o'");$v=$r&&$r->num_rows?$r->fetch_row()[0]:'?';if($o=='active_plugins'){$a=@unserialize($v);echo "active_plugins:\n";if(is_array($a))foreach($a as $x)echo "   - $x\n";}else echo "$o = $v\n";}
