In looking for this script I assembled a simple snippet to do the work for me suspecting I will need to do this again. This could make a good plugiin for admins and web people – hmm…
The script – reasonably well commented, Intended to be used on the site root assuming that the WP install is also on the site root. If this is not the case, change the require on the top of the script. Not tested on multi-site WP yet.
<?php
// datamafia.com the wordpress ninja
// This script rolls through the WP DB and finds all fo the tables
// For each table found every column is extracted
// then in each column we perform 3 MYSQL like searches in the style of :
// "%target word or phrase%"
// "%target word or phrase"
// "target word or phrase%"
// The output is then printed to screen with a noticeable text flag and in bold
// ### THE ONE USER FONGIURATION ###
$target_text = 'and'; // set this to the string you want to find
// ### END USER CONFIGURATION ###
define('WP_USE_THEMES', false); // no theme-o-la
require_once($_SERVER['DOCUMENT_ROOT'].'/wp-load.php'); // get the WP coex in the scroipt
global $wpdb; // for use in function / etc
$sql = "SHOW TABLES FROM ".DB_NAME.";"; //tables
$result = $wpdb->get_results($sql);
echo '<p>Results for text `'.$target_text.'` in '.DB_NAME.'</p>'; // WTF you are doing
foreach($result as $row){
$obj1 = 'Tables_in_'.DB_NAME;
$sql2 = "show columns from `".$row->$obj1."`;";
$result2 = $wpdb->get_results($sql2);
foreach($result2 as $row2){
$sql3 = "select count(*) as dacount from `".DB_NAME."`.`".$row->$obj1."` where ".$row2->Field." like '%$target_text%' or ".$row2->Field." like '$target_text%' or ".$row2->Field." like '%$target_text'; ";
$result3 = $wpdb->get_results($sql3);
$strong = $strong2 = null;
if($result3[0]->dacount/*)>0*/){ // triggered for results
$strong = '<br /><br /><strong>BOOM!----------------------------------------------<br />';
$strong2 = '</strong><br /><br />';
}
echo $strong.
"Table: ".$row->$obj1."<br />"
. " COL: ".$row2->Field
. '<br /> count : ('.$result3[0]->dacount.')'.$strong2.'<br />';
}
}
?>
Enjoy!
[MIDI Remote Script] Python baseline [Control Surface] extends the _framework instance of the experimental, undocumented, and officially unsupported API for Ableton. This particular script is very simple in the functions currently provided, but this is pivotal in establishing a clean, usable, and well thought out pattern for building MIDI control surfaces.
iz_custom_script is a WordPress plugin allowing the user to place custom PHP (as well as HTML) scripts inline with content. This plug requires almost zero configuration, is incredibly lightweight, and simple to use.