aboutsummaryrefslogtreecommitdiff
path: root/php/cleanup.js
blob: a3f37eaf1c25c382e65f8fcf55144888fe33e805 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
const fs = require('fs');

module.exports = () => {
    fs.readdir("./cache", (error, files) => {
        if (error) {
            console.log(chalk.gray(cluster.worker.id + " ") + chalk.yellow("warn:") + " unable to cleanup cache: " + error.message);
        } else {
            files.forEach((file) => {
                if (file.startsWith("PHP_")) {
                    fs.unlink("./cache/" + file, () => {});
                }
            })
        }
    })
}