Don’t parse backups

This commit is contained in:
Jonny Barnes 2016-09-19 17:19:04 +01:00
parent 6804cc3776
commit 54079e407c

View file

@ -41,13 +41,15 @@ class ParseCachedWebMentions extends Command
{
$HTMLfiles = $filesystem->allFiles(storage_path() . '/HTML');
foreach ($HTMLfiles as $file) {
$filepath = $file->getPathname();
$html = $filesystem->get($filepath);
$url = $this->URLFromFilename($filepath);
$microformats = \Mf2\parse($html, $url);
$webmention = WebMention::where('source', $url)->firstOrFail();
$webmention->mf2 = json_encode($microformats);
$webmention->save();
if ($file->getExtension() != 'backup') { //we dont want to parse.backup files
$filepath = $file->getPathname();
$html = $filesystem->get($filepath);
$url = $this->URLFromFilename($filepath);
$microformats = \Mf2\parse($html, $url);
$webmention = WebMention::where('source', $url)->firstOrFail();
$webmention->mf2 = json_encode($microformats);
$webmention->save();
}
}
}