clean gebuggfiggsert
This commit is contained in:
parent
efc9444589
commit
a2d46e9d3d
|
@ -11,31 +11,26 @@ module.exports = (bot, trigger, lib) => {
|
||||||
var dir_t = fs.readdirSync('./t/'); // Thumbnails
|
var dir_t = fs.readdirSync('./t/'); // Thumbnails
|
||||||
var items_id = [];
|
var items_id = [];
|
||||||
var items_dest = [];
|
var items_dest = [];
|
||||||
|
|
||||||
var failed_ids = [];
|
var failed_ids = [];
|
||||||
var failed_dests = [];
|
var failed_dests = [];
|
||||||
|
|
||||||
lib.sql.query("select `id`, `dest` from `f0ck`.`items`", (err, rows, fields) => {
|
lib.sql.query("select `id`, `dest` from `f0ck`.`items`", (err, rows, fields) => {
|
||||||
rows.forEach((e,i,a) => {
|
rows.forEach((e,i,a) => {
|
||||||
items_id.push(e.id);
|
items_id.push(e.id+'.png');
|
||||||
items_dest.push(e.dest.replace('./b/', ''));
|
items_dest.push(e.dest);
|
||||||
});
|
});
|
||||||
|
|
||||||
dir_b.forEach((e,i,a) => {
|
dir_b.forEach((e,i,a) => {
|
||||||
if(!(e in items_dest)) {
|
if( items_dest.indexOf('./b/'+e) === -1 ) {
|
||||||
failed_dests.push(e);
|
failed_dests.push(e);
|
||||||
//fs.unlink('./b/'+e);
|
fs.unlink('./b/'+e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
dir_t.forEach((e,i,a) => {
|
dir_t.forEach((e,i,a) => {
|
||||||
if(!(e.replace('.png', '') in items_id)) {
|
if( items_id.indexOf(e) === -1 ) {
|
||||||
failed_ids.push(e);
|
failed_ids.push(e);
|
||||||
//fs.unlink('./t/'+e);
|
fs.unlink('./t/'+e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
e.reply('unused thumbnails: ' + failed_ids.length + ' ; unused dests: ' + failed_dests.length);
|
e.reply('unused thumbnails: ' + failed_ids.length + ' ; unused dests: ' + failed_dests.length);
|
||||||
//console.log(failed_dests);
|
|
||||||
}).on('error', (err) => {
|
}).on('error', (err) => {
|
||||||
e.reply(err);
|
e.reply(err);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user