Fix content migration

This commit is contained in:
Danang Probo Sayekti 2015-08-27 11:30:03 +07:00
commit 881aa37dcf
3 changed files with 11 additions and 11 deletions

View file

@ -1,12 +1,20 @@
<?php <?php
$files = array();
$draft = array();
$files = glob('content/*/blog/*.md', GLOB_NOSORT);
$draft = glob('content/*/draft/*.md', GLOB_NOSORT);
if (!empty($files) || !empty($draft)) {
migrate_old_content();
}
rebuilt_cache('all'); rebuilt_cache('all');
foreach (glob('cache/page/*.cache', GLOB_NOSORT) as $file) { foreach (glob('cache/page/*.cache', GLOB_NOSORT) as $file) {
unlink($file); unlink($file);
} }
echo 'All cache has been deleted!'; echo 'All cache has been deleted!';
?> ?>

View file

@ -1,5 +1,4 @@
<h3>Updated to<h3> <h3>Updated to<h3>
<h2>[<?php echo $info['tag_name']; ?>] <?php echo $info['name']; ?></h2> <h2>[<?php echo $info['tag_name']; ?>] <?php echo $info['name']; ?></h2>
<p><?php echo \Michelf\MarkdownExtra::defaultTransform($info['body']); ?></p> <p><?php echo \Michelf\MarkdownExtra::defaultTransform($info['body']); ?></p>
<?php require_once "system/upgrade/run.php"; ?> <?php require_once "system/upgrade/run.php"; ?>

View file

@ -1251,19 +1251,12 @@ get('/admin/update', function () {
// Show the update now link // Show the update now link
get('/admin/update/now/:csrf', function ($CSRF) { get('/admin/update/now/:csrf', function ($CSRF) {
$files = array();
$draft = array();
$files = glob('content/*/blog/*.md', GLOB_NOSORT);
$draft = glob('content/*/draft/*.md', GLOB_NOSORT);
$proper = is_csrf_proper($CSRF); $proper = is_csrf_proper($CSRF);
$updater = new \Kanti\HubUpdater(array( $updater = new \Kanti\HubUpdater(array(
'name' => 'danpros/htmly', 'name' => 'danpros/htmly',
'prerelease' => !!config("prerelease"), 'prerelease' => !!config("prerelease"),
)); ));
if (login() && $proper && $updater->able()) { if (login() && $proper && $updater->able()) {
if (!empty($files) || !empty($draft)) {
migrate_old_content();
}
$updater->update(); $updater->update();
config('views.root', 'system/admin/views'); config('views.root', 'system/admin/views');
render('updated-to', array( render('updated-to', array(