Most of the time you can tell if a file is being used by using grep.
grep -r "index2.php" *
You can also use the PHP parser to help you cleanup. Here is an example script that prints out the functions that are declared and function calls:
#!/usr/bin/php
type = $rawToken[0];
$this->contents = $rawToken[1];
} else {
$this->type = -1;
$this->contents = $rawToken;
}
}
}
$file = $argv[1];
$code = file_get_contents($file);
$rawTokens = token_get_all($code);
$tokens = array();
foreach ($rawTokens as $rawToken) {
$tokens[] = new Token($rawToken);
}
function skipWhitespace(&$tokens, &$i) {
global $lineNo;
$i++;
$token = $tokens[$i];
while ($token->type == T_WHITESPACE) {
$lineNo += substr($token->contents, "\n");
$i++;
$token = $tokens[$i];
}
}
function nextToken(&$j) {
global $tokens, $i;
$j = $i;
do {
$j++;
$token = $tokens[$j];
} while ($token->type == T_WHITESPACE);
return $token;
}
for ($i = 0, $n = count($tokens); $i < $n; $i++) {
$token = $tokens[$i];
if ($token->type == T_FUNCTION) {
skipWhitespace($tokens, $i);
$functionName = $tokens[$i]->contents;
echo 'Function: ' . $functionName . "\n";
} elseif ($token->type == T_STRING) {
skipWhitespace($tokens, $i);
$nextToken = $tokens[$i];
if ($nextToken->contents == '(') {
echo 'Call: ' . $token->contents . "\n";
}
}
}