mirror of
https://github.com/YunoHost-Apps/movim_ynh.git
synced 2024-09-03 19:46:19 +02:00
update to movim upstream
This commit is contained in:
parent
607c3099dc
commit
c3e7628712
12 changed files with 217 additions and 195 deletions
|
@ -1,7 +1,7 @@
|
||||||
**Changelog**
|
**Changelog**
|
||||||
|
|
||||||
1.8 2016?
|
1.8 2016?
|
||||||
- Update to movim 0.9 git2016-04-12
|
- Update to movim 0.9 git2016-04-14
|
||||||
|
|
||||||
1.7.1 2016-30-30
|
1.7.1 2016-30-30
|
||||||
- Update to movim 0.9 git2016-03-30
|
- Update to movim 0.9 git2016-03-30
|
||||||
|
|
|
@ -5,7 +5,7 @@ Movim is a decentralized social network, written in PHP and HTML5 and based on t
|
||||||
|
|
||||||
It is recommended to use a "valid" certificate to use Movim, auto-signed is sometimes problematic. You might want to take a look a StartSSL or Let's Encrypt.
|
It is recommended to use a "valid" certificate to use Movim, auto-signed is sometimes problematic. You might want to take a look a StartSSL or Let's Encrypt.
|
||||||
|
|
||||||
Provided Movim version : 0.9 git2016-04-12
|
Provided Movim version : 0.9 git2016-04-14
|
||||||
|
|
||||||
Please read CHANGELOG.
|
Please read CHANGELOG.
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,9 @@ Movim Changelog
|
||||||
|
|
||||||
v0.9.1 (trunk)
|
v0.9.1 (trunk)
|
||||||
---------------------------
|
---------------------------
|
||||||
|
* Moving values from Sessionx to Session
|
||||||
|
* Using chart.js for the statistics
|
||||||
|
* Refactor the "public" system for the Posts
|
||||||
* CSS fixes
|
* CSS fixes
|
||||||
* Add Last Message Edition support
|
* Add Last Message Edition support
|
||||||
* Improve Post discovery in the News page
|
* Improve Post discovery in the News page
|
||||||
|
|
|
@ -88,7 +88,7 @@ class Avatar extends \Movim\Widget\Base
|
||||||
->request();
|
->request();
|
||||||
}
|
}
|
||||||
|
|
||||||
function ajaxGetForm()
|
function ajaxDisplay()
|
||||||
{
|
{
|
||||||
$cd = new \modl\ContactDAO();
|
$cd = new \modl\ContactDAO();
|
||||||
$me = $cd->get();
|
$me = $cd->get();
|
||||||
|
|
|
@ -50,9 +50,6 @@ var Avatar = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MovimWebsocket.attach(function() {
|
|
||||||
Avatar_ajaxGetForm();
|
|
||||||
});
|
|
||||||
/*
|
/*
|
||||||
function showVideo(){
|
function showVideo(){
|
||||||
navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia;
|
navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia;
|
||||||
|
|
|
@ -11,15 +11,14 @@
|
||||||
position: fixed;
|
position: fixed;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
background-color: white;
|
background-color: white;
|
||||||
width: 70%;
|
width: 65%;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
border-top: 1px solid rgba(0, 0, 0, 0.12);
|
border-top: 1px solid rgba(0, 0, 0, 0.12);
|
||||||
}
|
}
|
||||||
|
|
||||||
#chat_widget .chat_box ul {
|
#chat_widget .chat_box ul {
|
||||||
margin: 0 auto;
|
margin: 0;
|
||||||
max-width: 100rem;
|
max-width: 100%;
|
||||||
margin-left: calc(45% - 49rem);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#chat_widget .chat_box form {
|
#chat_widget .chat_box form {
|
||||||
|
@ -53,6 +52,10 @@
|
||||||
right: 2rem;
|
right: 2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#chat_widget .contained ul {
|
||||||
|
overflow-x: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
/* Chatroom */
|
/* Chatroom */
|
||||||
|
|
||||||
#chat_widget ul.simple {
|
#chat_widget ul.simple {
|
||||||
|
@ -172,11 +175,7 @@ table.emojis td:hover {
|
||||||
|
|
||||||
@media screen and (max-width: 1024px) {
|
@media screen and (max-width: 1024px) {
|
||||||
#chat_widget .chat_box {
|
#chat_widget .chat_box {
|
||||||
width: 100%;
|
|
||||||
left: 0;
|
left: 0;
|
||||||
}
|
width: 100%;
|
||||||
|
|
||||||
#chat_widget .chat_box ul {
|
|
||||||
margin-left: auto;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
"monolog/monolog": "1.8.*",
|
"monolog/monolog": "1.8.*",
|
||||||
"rain/raintpl": "dev-master",
|
"rain/raintpl": "dev-master",
|
||||||
"michelf/php-markdown": "1.4.*@dev",
|
"michelf/php-markdown": "1.4.*@dev",
|
||||||
|
|
||||||
"movim/modl": "dev-master",
|
"movim/modl": "dev-master",
|
||||||
"movim/sasl2": "dev-master",
|
"movim/sasl2": "dev-master",
|
||||||
"movim/moxl": "dev-master",
|
"movim/moxl": "dev-master",
|
||||||
|
@ -26,12 +27,13 @@
|
||||||
"react/socket-client": "dev-master",
|
"react/socket-client": "dev-master",
|
||||||
"react/stream": "0.4.3",
|
"react/stream": "0.4.3",
|
||||||
"react/http": "dev-master",
|
"react/http": "dev-master",
|
||||||
|
"react/promise-timer": "^1.1",
|
||||||
|
|
||||||
"stojg/crop": "dev-master",
|
"stojg/crop": "dev-master",
|
||||||
"forxer/Gravatar": "~1.2",
|
"forxer/Gravatar": "~1.2",
|
||||||
"respect/validation": "1.0.*",
|
"respect/validation": "1.0.*",
|
||||||
"ezyang/htmlpurifier": "^4.7",
|
"ezyang/htmlpurifier": "^4.7",
|
||||||
"ramsey/uuid": "^3.2",
|
"ramsey/uuid": "^3.2",
|
||||||
"react/promise-timer": "^1.1"
|
"symfony/console": "^3.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
74
sources/composer.lock
generated
74
sources/composer.lock
generated
|
@ -4,8 +4,8 @@
|
||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"hash": "959957c08a6e0a7b09d5b3bccf6f6979",
|
"hash": "03f969c6eb107a15b0b5239da2d3c76e",
|
||||||
"content-hash": "958b7ab7a85b3465f8038d6848504ff1",
|
"content-hash": "bfebdd8e42854b5a00c9d5dc776a6212",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "cboden/ratchet",
|
"name": "cboden/ratchet",
|
||||||
|
@ -439,16 +439,16 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "guzzlehttp/psr7",
|
"name": "guzzlehttp/psr7",
|
||||||
"version": "1.2.3",
|
"version": "1.3.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/guzzle/psr7.git",
|
"url": "https://github.com/guzzle/psr7.git",
|
||||||
"reference": "2e89629ff057ebb49492ba08e6995d3a6a80021b"
|
"reference": "31382fef2889136415751badebbd1cb022a4ed72"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/guzzle/psr7/zipball/2e89629ff057ebb49492ba08e6995d3a6a80021b",
|
"url": "https://api.github.com/repos/guzzle/psr7/zipball/31382fef2889136415751badebbd1cb022a4ed72",
|
||||||
"reference": "2e89629ff057ebb49492ba08e6995d3a6a80021b",
|
"reference": "31382fef2889136415751badebbd1cb022a4ed72",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -493,7 +493,7 @@
|
||||||
"stream",
|
"stream",
|
||||||
"uri"
|
"uri"
|
||||||
],
|
],
|
||||||
"time": "2016-02-18 21:54:00"
|
"time": "2016-04-13 19:56:01"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "heyupdate/emoji",
|
"name": "heyupdate/emoji",
|
||||||
|
@ -1636,6 +1636,66 @@
|
||||||
],
|
],
|
||||||
"time": "2015-12-03 05:49:01"
|
"time": "2015-12-03 05:49:01"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "symfony/console",
|
||||||
|
"version": "v3.0.4",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/symfony/console.git",
|
||||||
|
"reference": "6b1175135bc2a74c08a28d89761272de8beed8cd"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/symfony/console/zipball/6b1175135bc2a74c08a28d89761272de8beed8cd",
|
||||||
|
"reference": "6b1175135bc2a74c08a28d89761272de8beed8cd",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.5.9",
|
||||||
|
"symfony/polyfill-mbstring": "~1.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"psr/log": "~1.0",
|
||||||
|
"symfony/event-dispatcher": "~2.8|~3.0",
|
||||||
|
"symfony/process": "~2.8|~3.0"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"psr/log": "For using the console logger",
|
||||||
|
"symfony/event-dispatcher": "",
|
||||||
|
"symfony/process": ""
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "3.0-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Symfony\\Component\\Console\\": ""
|
||||||
|
},
|
||||||
|
"exclude-from-classmap": [
|
||||||
|
"/Tests/"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Fabien Potencier",
|
||||||
|
"email": "fabien@symfony.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Symfony Community",
|
||||||
|
"homepage": "https://symfony.com/contributors"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Symfony Console Component",
|
||||||
|
"homepage": "https://symfony.com",
|
||||||
|
"time": "2016-03-16 17:00:50"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/event-dispatcher",
|
"name": "symfony/event-dispatcher",
|
||||||
"version": "v3.0.4",
|
"version": "v3.0.4",
|
||||||
|
|
|
@ -40,7 +40,7 @@ if($infos != null) {
|
||||||
}
|
}
|
||||||
|
|
||||||
echo colorize("\nTo update the database run\n", 'green');
|
echo colorize("\nTo update the database run\n", 'green');
|
||||||
echo colorize("php mud.php db set\n", 'purple');
|
echo colorize("php mud.php db --set\n", 'purple');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
179
sources/mud.php
179
sources/mud.php
|
@ -5,178 +5,15 @@ require __DIR__ . '/vendor/autoload.php';
|
||||||
define('DOCUMENT_ROOT', dirname(__FILE__));
|
define('DOCUMENT_ROOT', dirname(__FILE__));
|
||||||
|
|
||||||
use Movim\Bootstrap;
|
use Movim\Bootstrap;
|
||||||
|
use Movim\Console\DatabaseCommand;
|
||||||
|
use Movim\Console\ConfigCommand;
|
||||||
|
use Symfony\Component\Console\Application;
|
||||||
|
|
||||||
$bootstrap = new Bootstrap();
|
$bootstrap = new Bootstrap();
|
||||||
$bootstrap->boot();
|
$bootstrap->boot();
|
||||||
|
|
||||||
$argsize = count($argv);
|
$application = new Application;
|
||||||
if($argsize == 1) {
|
$application->add(new DatabaseCommand);
|
||||||
echo
|
$application->add(new ConfigCommand);
|
||||||
colorize("Welcome to Mud - Movim Unified Doer
|
$application->run();
|
||||||
|
|
||||||
Here some requests you can do with me :", 'green')."
|
|
||||||
- ".colorize("getloc", 'yellow')." grab all the translations in Movim and generate a global locale file
|
|
||||||
- ".colorize("comploc", 'yellow')." compile the current locales to a simple PHP array to boost Movim execution
|
|
||||||
- ".colorize("comptz", 'yellow')." compile the timezones
|
|
||||||
- ".colorize("db", 'yellow')." create/update the database
|
|
||||||
- ".colorize("config", 'yellow')." set the configuration of Movim (separated by commas and colons) eg. info:Test,description:Hop
|
|
||||||
";
|
|
||||||
|
|
||||||
} elseif($argsize == 2) {
|
|
||||||
switch ($argv[1]) {
|
|
||||||
case 'getloc':
|
|
||||||
getloc();
|
|
||||||
break;
|
|
||||||
/*case 'comploc':
|
|
||||||
comploc();
|
|
||||||
break;*/
|
|
||||||
case 'comptz':
|
|
||||||
comptz();
|
|
||||||
break;
|
|
||||||
case 'config':
|
|
||||||
echo colorize("You need to pass an argument", 'red');
|
|
||||||
break;
|
|
||||||
case 'db':
|
|
||||||
$md = Modl\Modl::getInstance();
|
|
||||||
$infos = $md->check();
|
|
||||||
|
|
||||||
if($infos == null) {
|
|
||||||
echo colorize("Nothing to do\n", 'green');
|
|
||||||
} else {
|
|
||||||
echo colorize("The database need to be updated\n", 'green');
|
|
||||||
foreach($infos as $i) {
|
|
||||||
echo colorize($i."\n", 'blue');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} elseif($argsize == 3) {
|
|
||||||
switch ($argv[1]) {
|
|
||||||
case 'config':
|
|
||||||
config($argv[2]);
|
|
||||||
break;
|
|
||||||
case 'db':
|
|
||||||
if($argv[2] == 'set') {
|
|
||||||
$md = Modl\Modl::getInstance();
|
|
||||||
$md->check(true);
|
|
||||||
echo colorize("Database updated\n", 'green');
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function config($values) {
|
|
||||||
echo colorize("Movim configuration setter\n", 'green');
|
|
||||||
|
|
||||||
$cd = new \Modl\ConfigDAO();
|
|
||||||
$config = $cd->get();
|
|
||||||
|
|
||||||
$values = explode(',', $values);
|
|
||||||
foreach($values as $value) {
|
|
||||||
$exp = explode(':', $value);
|
|
||||||
$key = $exp[0];
|
|
||||||
array_shift($exp);
|
|
||||||
$value = implode(':', $exp);
|
|
||||||
|
|
||||||
if(property_exists($config, $key)) {
|
|
||||||
$old = $config->$key;
|
|
||||||
$config->$key = $value;
|
|
||||||
|
|
||||||
$cd->set($config);
|
|
||||||
echo colorize("The configuration key ", 'yellow').
|
|
||||||
colorize($key, 'red').
|
|
||||||
colorize(" has been updated from ", 'yellow').
|
|
||||||
colorize($old, 'blue').
|
|
||||||
colorize(" to ", 'yellow').
|
|
||||||
colorize($value, 'blue')."\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function getloc() {
|
|
||||||
echo colorize("Locales grabber\n", 'green');
|
|
||||||
|
|
||||||
// We look for all the ini files
|
|
||||||
$inifiles = glob(WIDGETS_PATH.'*/*.ini');
|
|
||||||
array_push($inifiles, LOCALES_PATH . 'locales.ini');
|
|
||||||
|
|
||||||
$locales = CACHE_PATH.'locales.php';
|
|
||||||
$pot = CACHE_PATH.'messages.pot';
|
|
||||||
|
|
||||||
// We create the cache file
|
|
||||||
$out = "<?php\n";
|
|
||||||
|
|
||||||
foreach($inifiles as $ini) {
|
|
||||||
$keys = parse_ini_file($ini);
|
|
||||||
foreach($keys as $key => $value) {
|
|
||||||
$out .= "t(\"$value\");\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$fp = fopen($locales, 'w');
|
|
||||||
fwrite($fp, $out);
|
|
||||||
fclose($fp);
|
|
||||||
|
|
||||||
echo "File $locales created\n";
|
|
||||||
|
|
||||||
// And we run gettext on it
|
|
||||||
exec("xgettext -e --no-wrap -kt -o $pot -L PHP $locales ");
|
|
||||||
|
|
||||||
echo "File $pot created\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
function comploc() {
|
|
||||||
echo colorize("Locales compiler\n", 'green');
|
|
||||||
|
|
||||||
$folder = CACHE_PATH.'/locales/';
|
|
||||||
|
|
||||||
if(!file_exists($folder)) {
|
|
||||||
$bool = mkdir($folder);
|
|
||||||
if(!$bool) {
|
|
||||||
echo colorize("The locales cache folder can't be created", 'red');
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
echo colorize("Folder already exist, don't re-create it\n", 'red');
|
|
||||||
|
|
||||||
|
|
||||||
$langs = loadLangArray();
|
|
||||||
foreach($langs as $key => $value) {
|
|
||||||
$langarr = parseLangFile(DOCUMENT_ROOT . '/locales/' . $key . '.po');
|
|
||||||
|
|
||||||
$out = '<?php global $translations;
|
|
||||||
$translations = array(';
|
|
||||||
|
|
||||||
foreach($langarr as $msgid => $msgstr)
|
|
||||||
if($msgid != '')
|
|
||||||
$out .= '"'.$msgid.'" => "'. $msgstr . '",'."\n";
|
|
||||||
|
|
||||||
$out .= ');';
|
|
||||||
|
|
||||||
$fp = fopen($folder.$key.'.php', 'w');
|
|
||||||
fwrite($fp, $out);
|
|
||||||
fclose($fp);
|
|
||||||
|
|
||||||
echo "- $key compiled\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function comptz() {
|
|
||||||
$file = HELPERS_PATH.'TimezoneList.php';
|
|
||||||
$tz = generateTimezoneList();
|
|
||||||
|
|
||||||
$out = '<?php global $timezones;
|
|
||||||
$timezones = array(';
|
|
||||||
|
|
||||||
foreach($tz as $key => $value)
|
|
||||||
$out .= '"'.$key.'" => "'. $value . '",'."\n";
|
|
||||||
|
|
||||||
$out .= ');';
|
|
||||||
|
|
||||||
$fp = fopen($file, 'w');
|
|
||||||
fwrite($fp, $out);
|
|
||||||
fclose($fp);
|
|
||||||
|
|
||||||
echo "- Timezones compiled in $file\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "\n";
|
|
||||||
|
|
79
sources/src/Movim/Console/ConfigCommand.php
Normal file
79
sources/src/Movim/Console/ConfigCommand.php
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
<?php
|
||||||
|
namespace Movim\Console;
|
||||||
|
|
||||||
|
use Symfony\Component\Console\Command\Command;
|
||||||
|
use Symfony\Component\Console\Input\InputArgument;
|
||||||
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
|
||||||
|
class ConfigCommand extends Command
|
||||||
|
{
|
||||||
|
protected function configure()
|
||||||
|
{
|
||||||
|
$this
|
||||||
|
->setName('config')
|
||||||
|
->setDescription('Change the configuration')
|
||||||
|
->addOption(
|
||||||
|
'info',
|
||||||
|
null,
|
||||||
|
InputOption::VALUE_REQUIRED,
|
||||||
|
'Content of the info box on the login page'
|
||||||
|
)
|
||||||
|
->addOption(
|
||||||
|
'username',
|
||||||
|
null,
|
||||||
|
InputOption::VALUE_REQUIRED,
|
||||||
|
'Username for the admin area'
|
||||||
|
)
|
||||||
|
->addOption(
|
||||||
|
'password',
|
||||||
|
null,
|
||||||
|
InputOption::VALUE_REQUIRED,
|
||||||
|
'Password for the admin area'
|
||||||
|
)
|
||||||
|
->addOption(
|
||||||
|
'timezone',
|
||||||
|
null,
|
||||||
|
InputOption::VALUE_REQUIRED,
|
||||||
|
'The server timezone'
|
||||||
|
)
|
||||||
|
->addOption(
|
||||||
|
'loglevel',
|
||||||
|
null,
|
||||||
|
InputOption::VALUE_REQUIRED,
|
||||||
|
'The server loglevel, default 0'
|
||||||
|
)
|
||||||
|
->addOption(
|
||||||
|
'locale',
|
||||||
|
null,
|
||||||
|
InputOption::VALUE_REQUIRED,
|
||||||
|
'The server main locale'
|
||||||
|
)
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function execute(InputInterface $input, OutputInterface $output)
|
||||||
|
{
|
||||||
|
$cd = new \Modl\ConfigDAO();
|
||||||
|
$config = $cd->get();
|
||||||
|
|
||||||
|
foreach($input->getOptions() as $key => $value) {
|
||||||
|
if(property_exists($config, $key) && isset($value)) {
|
||||||
|
if($key == 'password') $value = sha1($value);
|
||||||
|
|
||||||
|
$old = $config->$key;
|
||||||
|
$config->$key = $value;
|
||||||
|
|
||||||
|
$cd->set($config);
|
||||||
|
$output->writeln(
|
||||||
|
'<info>The configuration key</info> '.
|
||||||
|
$key.
|
||||||
|
' <info>has been updated from</info> '.
|
||||||
|
$old.
|
||||||
|
' <info>to</info> '.
|
||||||
|
$value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
45
sources/src/Movim/Console/DatabaseCommand.php
Normal file
45
sources/src/Movim/Console/DatabaseCommand.php
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
<?php
|
||||||
|
namespace Movim\Console;
|
||||||
|
|
||||||
|
use Symfony\Component\Console\Command\Command;
|
||||||
|
use Symfony\Component\Console\Input\InputArgument;
|
||||||
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
|
||||||
|
class DatabaseCommand extends Command
|
||||||
|
{
|
||||||
|
protected function configure()
|
||||||
|
{
|
||||||
|
$this
|
||||||
|
->setName('db')
|
||||||
|
->setDescription('Database updater')
|
||||||
|
->addOption(
|
||||||
|
'set',
|
||||||
|
's',
|
||||||
|
InputOption::VALUE_NONE,
|
||||||
|
'Will apply updates on the database'
|
||||||
|
)
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function execute(InputInterface $input, OutputInterface $output)
|
||||||
|
{
|
||||||
|
$md = \Modl\Modl::getInstance();
|
||||||
|
|
||||||
|
if($input->getOption('set')) {
|
||||||
|
$md->check(true);
|
||||||
|
$output->writeln('<info>Database updated</info>');
|
||||||
|
} else {
|
||||||
|
$toDo = $md->check();
|
||||||
|
if($toDo != null) {
|
||||||
|
$output->writeln('<comment>The database needs to be updated</comment>');
|
||||||
|
foreach($toDo as $do) {
|
||||||
|
$output->writeln('<question>'.$do.'</question>');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$output->writeln('<info>Nothing to do here</info>');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue