1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/movim_ynh.git synced 2024-09-03 19:46:19 +02:00
movim_ynh/sources/app/widgets/AdminDB/AdminDB.php
2016-03-29 14:12:33 +02:00

63 lines
1.4 KiB
PHP

<?php
/**
* @package Widgets
*
* @file AdminDB.php
* This file is part of Movim.
*
* @brief The DB Administration widget
*
* @author Jaussoin Timothée <edhelas@movim.eu>
* Copyright (C)2014 Movim project
*
* See COPYING for licensing information.
*/
class AdminDB extends \Movim\Widget\Base
{
function load() {
}
public function ajaxUpdateDatabase()
{
$md = \modl\Modl::getInstance();
$md->check(true);
RPC::call('movim_reload_this');
}
public function hidePassword($pass)
{
return str_repeat('*', strlen($pass));
}
function display()
{
$md = \modl\Modl::getInstance();
$infos = $md->check();
$errors = '';
$this->view->assign('infos', $infos);
$this->view->assign('db_update', $this->call('ajaxUpdateDatabase')
."this.className='button color loading';");
try {
$md->connect();
} catch(Exception $e) {
$errors = $e->getMessage();
}
if(file_exists(DOCUMENT_ROOT.'/config/db.inc.php')) {
require DOCUMENT_ROOT.'/config/db.inc.php';
}
$supported = $md->getSupportedDatabases();
$this->view->assign('connected', $md->_connected);
$this->view->assign('conf', $conf);
$this->view->assign('dbtype', $supported[$conf['type']]);
$this->view->assign('errors', $errors);
}
}