Remove unnecessary files
This commit is contained in:
parent
e5b3c1467b
commit
82e9b1d995
@ -8,6 +8,7 @@ timezone: Europe/Budapest
|
|||||||
name: Gergely Polonkai
|
name: Gergely Polonkai
|
||||||
paginate: 10
|
paginate: 10
|
||||||
paginate_path: "/blog/page/:num"
|
paginate_path: "/blog/page/:num"
|
||||||
|
exclude: ['README.md', 'Gemfile', 'Gemfile.lock', 'CNAME']
|
||||||
|
|
||||||
# Build settings
|
# Build settings
|
||||||
markdown: kramdown
|
markdown: kramdown
|
||||||
|
62
export.php
62
export.php
@ -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…
Reference in New Issue
Block a user