Create data dir

This commit is contained in:
Danang Probo Sayekti 2015-08-27 13:38:20 +07:00
commit 46ed4a6bbc

View file

@ -543,7 +543,7 @@ function default_category()
$desc->url = site_url() . 'category/uncategorized'; $desc->url = site_url() . 'category/uncategorized';
$desc->body = "<p>Topics that don't need a category, or don't fit into any other existing category.</p>"; $desc->body = "<p>Topics that don't need a category, or don't fit into any other existing category.</p>";
$desc->description = 'Uncategorized Posts'; $desc->description = "Topics that don't need a category, or don't fit into any other existing category";
return $tmp[] = $desc; return $tmp[] = $desc;
} }
@ -2406,6 +2406,10 @@ function is_csrf_proper($csrf_token)
// Add page views count // Add page views count
function add_view($page) function add_view($page)
{ {
$dir = 'content/data/';
if (!is_dir($dir)) {
mkdir($dir, 0775, true);
}
$filename = "content/data/views.json"; $filename = "content/data/views.json";
$views = array(); $views = array();
if (file_exists($filename)) { if (file_exists($filename)) {
@ -2517,6 +2521,11 @@ function shorten($string = null, $char = null)
// save the i18n tag // save the i18n tag
function save_tag_i18n($tag,$tagDisplay) function save_tag_i18n($tag,$tagDisplay)
{ {
$dir = 'content/data/';
if (!is_dir($dir)) {
mkdir($dir, 0775, true);
}
$filename = "content/data/tags.lang"; $filename = "content/data/tags.lang";
$tags = array(); $tags = array();
$tmp = array(); $tmp = array();
@ -2693,11 +2702,12 @@ function migrate_old_content()
} }
if (file_exists('content/tags.lang')) {
$dir = 'content/data/'; $dir = 'content/data/';
if (!is_dir($dir)) { if (!is_dir($dir)) {
mkdir($dir, 0775, true); mkdir($dir, 0775, true);
} }
if (file_exists('content/tags.lang')) {
rename('content/tags.lang', 'content/data/tags.lang'); rename('content/tags.lang', 'content/data/tags.lang');
unlink('content/views.json'); unlink('content/views.json');
} }