N
N
N3K2012-01-31 13:17:12
PHP
N3K, 2012-01-31 13:17:12

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

5 answer(s)
S
script88, 2012-01-31
@script88

Check includes in all files

N
niko83, 2012-01-31
@niko83

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;
}

V
Vyacheslav Plisko, 2012-02-01
@AmdY

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

I
Iskander Giniyatullin, 2012-02-01
@rednaxi

habrahabr.ru/qa/15428/#answer_64347

K
Kuzma, 2012-02-03
@Kuzma

for the zend framework there is a service that allows you to build a library with only the necessary classes. you specify the class, and it packs all the dependencies in the zip archive for you
ikuznetsov.blogspot.com/2012/02/zend-framework.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question