Answer the question
In order to leave comments, you need to log in
Php, finding unused files?
Good afternoon. I got a project from which I need to cut a module and make it an independent project. The project uses a lot of helpers (more than 300) and decently additional libraries. Can you tell me some way to find all the files that are not in use and delete them?
Project on Zf.
Answer the question
In order to leave comments, you need to log in
this code will delete files from a folder that have not been accessed for more than N minutes,
the find command is at the heart, you can modernize it to make a more unique request
WITHOUT CONSIDERING THE SOURCE CODE, DO NOT RUN IN THE SOURCE, WHAT B DOESN'T MAKE TROUBLE
public function clearCache($ttl = self::DEFAULT_CACHE_TTL)
{
$ttl = (int) $ttl;
$dir = escapeshellcmd($this->_cacheDir);
$command = "find {$dir} \! -type d -amin +{$ttl} -exec rm -v '{}' ';'";
exec($command, $stringOutput);
return $stringOutput;
}
You really want this. Firstly, you don't know when this or that helper will suddenly be needed, maybe the project will be finalized. Secondly, what do you need for this extra megabyte, a couple of pictures weigh much more, and the cache in normal projects is generated by orders of magnitude larger than the size of the entire code.
But, if you still decide - isalmin.ru/zfp
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question