- second commit
This commit is contained in:
parent
4fc3bb0a01
commit
59a99ff3c8
61 changed files with 2625 additions and 1182 deletions
|
@ -1,6 +1,8 @@
|
|||
import { BaseCommand } from '@adonisjs/core/build/standalone';
|
||||
import crypto from 'crypto';
|
||||
import fs from 'fs';
|
||||
// import Config from '@ioc:Adonis/Core/Config';
|
||||
import Logger from '@ioc:Adonis/Core/Logger'
|
||||
|
||||
export default class ValidateChecksum extends BaseCommand {
|
||||
/**
|
||||
|
@ -37,6 +39,9 @@ export default class ValidateChecksum extends BaseCommand {
|
|||
// query all files from database:
|
||||
const files = await File.query().preload('hashvalues');
|
||||
|
||||
// const logLevel = Config.get('app.logger.level', 'info');
|
||||
// console.log(this.logger.)
|
||||
|
||||
for (var file of files) {
|
||||
let hashValue = await file.related('hashvalues').query().pluck('value', 'type');
|
||||
|
||||
|
@ -45,16 +50,17 @@ export default class ValidateChecksum extends BaseCommand {
|
|||
try {
|
||||
calculatedMd5FileHash = await this.checksumFile(filePath, 'md5');
|
||||
} catch (exception) {
|
||||
this.logger.error(exception.message);
|
||||
// this.logger.error(exception.message);
|
||||
Logger.error(exception.message);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (hashValue['md5'] == calculatedMd5FileHash) {
|
||||
this.logger.info(
|
||||
Logger.info(
|
||||
`File id ${file.id}: stored md5 checksum: ${calculatedMd5FileHash}, control md5 checksum: ${hashValue['md5']}`,
|
||||
);
|
||||
} else {
|
||||
this.logger.logError(
|
||||
Logger.error(
|
||||
`File id ${file.id}: stored md5 checksum: ${calculatedMd5FileHash}, control md5 checksum: ${hashValue['md5']}`,
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
editor.link_modal.header
Reference in a new issue