mirror of
https://github.com/xuthus83/pigallery2.git
synced 2024-11-03 21:04:03 +08:00
Fix blog updating on proper scanning.
This commit is contained in:
parent
a6bfced5f0
commit
f5ed66d0ad
@ -303,7 +303,8 @@ export class IndexingManager {
|
|||||||
})
|
})
|
||||||
.getMany();
|
.getMany();
|
||||||
|
|
||||||
const metaFilesToSave = [];
|
const metaFilesToInsert = [];
|
||||||
|
const MDFilesToUpdate = [];
|
||||||
for (const item of scannedDirectory.metaFile) {
|
for (const item of scannedDirectory.metaFile) {
|
||||||
let metaFile: FileDTO = null;
|
let metaFile: FileDTO = null;
|
||||||
for (let j = 0; j < indexedMetaFiles.length; j++) {
|
for (let j = 0; j < indexedMetaFiles.length; j++) {
|
||||||
@ -319,18 +320,26 @@ export class IndexingManager {
|
|||||||
metaFile = Utils.clone(item);
|
metaFile = Utils.clone(item);
|
||||||
item.directory = scannedDirectory;
|
item.directory = scannedDirectory;
|
||||||
metaFile.directory = {id: currentDirID} as DirectoryBaseDTO;
|
metaFile.directory = {id: currentDirID} as DirectoryBaseDTO;
|
||||||
metaFilesToSave.push(metaFile);
|
metaFilesToInsert.push(metaFile);
|
||||||
|
} else if ((item as MDFileDTO).date) {
|
||||||
|
if ((item as MDFileDTO).date != (metaFile as MDFileDTO).date) {
|
||||||
|
(metaFile as MDFileDTO).date = (item as MDFileDTO).date;
|
||||||
|
MDFilesToUpdate.push(metaFile);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const MDFiles = metaFilesToSave.filter(f => !isNaN((f as MDFileDTO).date));
|
const MDFiles = metaFilesToInsert.filter(f => !isNaN((f as MDFileDTO).date));
|
||||||
const generalFiles = metaFilesToSave.filter(f => isNaN((f as MDFileDTO).date));
|
const generalFiles = metaFilesToInsert.filter(f => isNaN((f as MDFileDTO).date));
|
||||||
await fileRepository.save(generalFiles, {
|
await fileRepository.save(generalFiles, {
|
||||||
chunk: Math.max(Math.ceil(generalFiles.length / 500), 1),
|
chunk: Math.max(Math.ceil(generalFiles.length / 500), 1),
|
||||||
});
|
});
|
||||||
await MDfileRepository.save(MDFiles, {
|
await MDfileRepository.save(MDFiles, {
|
||||||
chunk: Math.max(Math.ceil(MDFiles.length / 500), 1),
|
chunk: Math.max(Math.ceil(MDFiles.length / 500), 1),
|
||||||
});
|
});
|
||||||
|
await MDfileRepository.save(MDFilesToUpdate, {
|
||||||
|
chunk: Math.max(Math.ceil(MDFilesToUpdate.length / 500), 1),
|
||||||
|
});
|
||||||
await fileRepository.remove(indexedMetaFiles, {
|
await fileRepository.remove(indexedMetaFiles, {
|
||||||
chunk: Math.max(Math.ceil(indexedMetaFiles.length / 500), 1),
|
chunk: Math.max(Math.ceil(indexedMetaFiles.length / 500), 1),
|
||||||
});
|
});
|
||||||
|
@ -75,7 +75,7 @@ export class BlogService {
|
|||||||
return groupDate;
|
return groupDate;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// There is no splits
|
||||||
if (matches.length == 0) {
|
if (matches.length == 0) {
|
||||||
return [{
|
return [{
|
||||||
text: markdown,
|
text: markdown,
|
||||||
|
Loading…
Reference in New Issue
Block a user