mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-10 11:33:17 +00:00
60 lines
1.1 KiB
PHP
Executable File
60 lines
1.1 KiB
PHP
Executable File
#!/usr/bin/env php
|
|
<?php
|
|
/*
|
|
* Look for unused icons in skin directory
|
|
*
|
|
*/
|
|
|
|
use Symfony\Component\Finder\Finder;
|
|
|
|
require __DIR__ . '/vendor/autoload.php';
|
|
|
|
chdir(__DIR__);
|
|
|
|
set_time_limit(0);
|
|
|
|
$finder = new Finder();
|
|
$finder
|
|
->files()
|
|
->name('*.gif')
|
|
->name('*.jpeg')
|
|
->name('*.jpg')
|
|
->name('*.png')
|
|
->notName('ui-*.png')
|
|
->exclude(
|
|
array(
|
|
'substitution'
|
|
, 'client/959595/images'
|
|
, 'client/000000/images'
|
|
, 'client/FFFFFF/images'
|
|
, 'skins/lng'
|
|
)
|
|
)
|
|
->in(__DIR__ . '/www/skins');
|
|
|
|
$files = array();
|
|
|
|
foreach ($finder as $file) {
|
|
$result = '';
|
|
|
|
foreach (array('templates', 'lib/Alchemy', 'lib/Doctrine', 'lib/classes', 'www') as $dir) {
|
|
$cmd = "grep -IR -m 1 --exclude='(*\.git*)' '" . str_replace(array(), array(), $file->getFilename()) . "' " . __DIR__ . '/' . $dir;
|
|
$result .= @exec($cmd);
|
|
|
|
if (trim($result) !== '') {
|
|
break;
|
|
}
|
|
}
|
|
|
|
if (trim($result) === '') {
|
|
$files[] = $file->getPathname();
|
|
}
|
|
}
|
|
|
|
foreach ($files as $file) {
|
|
echo "rm $file\n";
|
|
unlink($file);
|
|
}
|
|
|
|
exit(0);
|