Last change
on this file since 7991 was
7991,
checked in by mistic100, 13 years ago
|
PHP Optimisateur :
configuration via formulaire
installation semi-automatique des plugins
|
File size:
894 bytes
|
Rev | Line | |
---|
[7988] | 1 | <?php |
---|
| 2 | /***************************************\ |
---|
| 3 | | PHP OPTIMISATEUR | |
---|
| 4 | | Plugin CretaFoldersAlpha | |
---|
| 5 | \***************************************/ |
---|
| 6 | |
---|
| 7 | ## Crée une arborescence alphanumérique dans la dossier source |
---|
| 8 | ## Ne supporte pas une arborescence pré-existante |
---|
| 9 | |
---|
| 10 | $handle = opendir($DIRsource); |
---|
| 11 | |
---|
| 12 | while ($file = readdir($handle)) { |
---|
| 13 | if ($file != '.' && $file != '..' && !is_dir($DIRsource.'/'.$file)) { |
---|
| 14 | // Récupère le parties du nom servant à créer les dossiers |
---|
| 15 | preg_match('#(.{1})([0-9A-Za-z.-]*)_(.*)#', $file, $matches); |
---|
| 16 | |
---|
| 17 | // Crée les dossier |
---|
| 18 | if (!file_exists($DIRsource.strtoupper($matches[1]).'/'.$matches[1].$matches[2])) { |
---|
| 19 | mkdir($DIRsource.strtoupper($matches[1]).'/'.$matches[1].$matches[2], 0777, true); |
---|
| 20 | } |
---|
| 21 | |
---|
| 22 | // Déplace le fichier |
---|
| 23 | rename($DIRsource.$file, $DIRsource.strtoupper($matches[1]).'/'.$matches[1].$matches[2].'/'.$file); |
---|
| 24 | } |
---|
| 25 | } |
---|
| 26 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.