Drupal debug

Sometimes is very hard to debug Drupal when you get white screen of death
Very often some module is making the mess
To check which module is breaking the site
Open includes/module.inc and find function module_invoke_all
Add bolded line to the function to check which exactly module is breaking your site

 

function module_invoke_all($hook) {
$args = func_get_args();
// Remove $hook from the arguments.
unset($args[0]);
$return = array();
foreach (module_implements($hook) as $module) {
$function = $module . ‘_’ . $hook;

print „Starting loading $module <br />“;

if (function_exists($function)) {
$result = call_user_func_array($function, $args);
if (isset($result) && is_array($result)) {
$return = array_merge_recursive($return, $result);
}
elseif (isset($result)) {
$return[] = $result;
}
}

print „Finished loading $module <br />“;

}

return $return;
}

If you need to disable module you can make it with phpmyadmin
UPDATE system SET status=’0′ WHERE name=’module_name’;
After this you need to clean cache
DELETE FROM cache_bootstrap WHERE cid=’system_list’;

 

С етикет: ,
Публикувано в Без категория

check for eval(base64 in multiple files

If you have hacked joomla or wordpress site you need to check all your site files
This commans search all files in current dir and subdirs for eval(base64 which is one of most used combination

find * -name '*.php' |xargs grep -lirn "eval(base64"

Публикувано в linux

bash rename file

This is simple script which rename files based on some pattern
For example rename all files AABBBCCC and replace BBB with DDD
./ren „AAABBBCCC“ „BBB“ „DDD“

#!/bin/bash
# renames.sh
# basic file renamer

criteria=$1
re_match=$2
replace=$3

for i in $( ls *$criteria* );
do
src=$i
tgt=$(echo $i | sed -e „s/$re_match/$replace/“)
mv $src $tgt
done

Публикувано в linux, Без категория

no cache website

<meta http-equiv=“expires“ value=“Thu, 16 Mar 2000 11:00:00 GMT“ />
<meta http-equiv=“pragma“ content=“no-cache“ />

Публикувано в Без категория, интернет

javascript open window with content in it

This function can be used for oppenign of popup window with content in it

function openwin(txt){
var previewWnd = window.open('','embed_preview','width=500,height=400,scrollbars=1,status=0,location=0,directories=0,');
previewWnd.document.body.innerHTML = txt.replace(/\n/g,"
");
previewWnd.focus();

}

Публикувано в Без категория