The SSH host key has changed on 8 April, 2022 to this one: SHA256:573uTBSeh74kvOo0HJXi5ijdzRm8me27suzNEDlGyrQ

Remove unnecessary files

sqla-i18n-post
Gergely Polonkai 7 years ago
parent e5b3c1467b
commit 82e9b1d995
  1. 1
      _config.yml
  2. 62
      export.php

@ -8,6 +8,7 @@ timezone: Europe/Budapest
name: Gergely Polonkai
paginate: 10
paginate_path: "/blog/page/:num"
exclude: ['README.md', 'Gemfile', 'Gemfile.lock', 'CNAME']
# Build settings
markdown: kramdown

@ -1,62 +0,0 @@
<?php
$my = mysqli_connect('localhost', 'gergelypolonkai', 'the8dooM');
$my->select_db('gergelypolonkai');
$st = $my->prepare('SELECT * FROM taggit_tag');
$st->execute();
$res = $st->get_result();
$tags = [];
while ($row = $res->fetch_assoc()) {
$tags[$row['id']] = $row['slug'];
}
$st = $my->prepare('SELECT * FROM taggit_taggeditem');
$st->execute();
$res = $st->get_result();
$tagging = [];
while ($row = $res->fetch_assoc()) {
if (!array_key_exists($row['object_id'], $tagging)) {
$tagging[$row['object_id']] = [];
}
$tagging[$row['object_id']][] = $row['tag_id'];
}
$st = $my->prepare('SELECT * FROM blog_post');
$st->execute();
$res = $st->get_result();
while ($row = $res->fetch_assoc()) {
$date = substr($row['created_at'], 0, 10);
preg_match('/([0-9]{4})-([0-9]{2})-([0-9]{2})/', $date, $m);
$url = sprintf("/blog/%d/%d/%d/%s", $m[1], $m[2], $m[3], $row['slug']);
$file = '_posts/' . $date . '-' . $row['slug'] . '.markdown';
$out = "---
layout: post
title: \"{$row['title']}\"
date: {$row['created_at']}
";
if (array_key_exists($row['id'], $tagging)) {
$post_tags = [];
foreach ($tagging[$row['id']] as $tag) {
$post_tags[] = $tags[$tag];
}
$out .= "tags: " . join(' ', $post_tags) . "\n";
}
$out .= "permalink: {$url}
categories: blog
published: {$row['draft']}
---
{$row['content']}
";
$fd = fopen($file, "w");
fputs($fd, $out);
fclose($fd);
}
Loading…
Cancel
Save