Config switch script

This commit is contained in:
Marcel Kapfer (mmk2410) 2016-04-22 18:49:14 +02:00
parent f632bf2de5
commit 9773669684
2 changed files with 88 additions and 1 deletions

67
bin/config.php Normal file
View file

@ -0,0 +1,67 @@
<?php
// Marcel Kapfer (mmk2410)
// Script for moving from config.php to config.yaml
// License: MIT
require 'res/php/Config.php';
require 'config.php';
use mmk2410\rbe\config\Config as Config;
if ($bloghome == "yes") {
$bloghome = "on";
}
if ($blogintro == "yes") {
$blogintro = "on";
}
if ($sharefab == "yes") {
$sharefab = "on";
}
if ($rcc == "yes") {
$rcc = "on";
}
if ($nav_drawer == "yes") {
$nav_drawer = "on";
}
$yaml = array(
"blog" => array(
"title" => $blogtitle,
"author" => $blogauthor,
"description" => $blogdescription,
"home" => $bloghome,
"homeurl" => $bloghomeurl,
"homename" => $bloghomename,
"mainname" => $blogmainname,
"intro" => $blogintro,
"disqus" => $blogdisqus,
"analytics" => $bloganalytics,
"footer" => $blogfooter,
"url" => $blogurl
),
"design" => array(
"fab" => $sharefab,
"drawer" => $nav_drawer,
"theme" => $theme,
"pagination" => $pagination,
"favicon" => $favicon,
),
"rcc" => array(
"rcc" => "off",
"api" => "off",
),
"language" => $language,
);
$config = new Config('config.yaml', 'vendor/autoload.php');
if ($config->writeConfig($yaml)) {
echo "YAML config saved.\nYou can delete the config.php file\n";
} else {
echo "Failed to save YAML config.";
}

View file

@ -1,3 +1,23 @@
blog:
title: 'Example Blog'
author: John
description: 'A short description of your blog'
home: 'on'
homeurl: ../
homename: Home
mainname: ''
intro: 'on'
disqus: rangitaki
analytics: ''
footer: "Rangitaki 2016 <a href=\"https://github.com/mmk2410/Rangitaki\" target=\"blank\">\n github.com/mmk2410/Rangitaki</a>"
url: 'https://example.com/blog/'
design:
fab: 'on'
drawer: 'on'
theme: material-light
pagination: 0
favicon: 'http://example.com/res/img/favicon.png'
rcc:
rcc: 'off'
rcc: 'on'
api: 'on'
language: en