On peux désactiver la possibilité pour l'utilisateur de faire ses propres backups de MySQL
Utile pour les hébergement mutu qui ont déjà des backups de configuré.
This commit is contained in:
parent
2693aab130
commit
19e4739d79
|
@ -30,6 +30,18 @@
|
|||
require_once("../class/config.php");
|
||||
include_once("head.php");
|
||||
|
||||
?>
|
||||
<h3><?php __("MySQL Databases - Configure backups"); ?></h3>
|
||||
<hr id="topbar"/>
|
||||
<br />
|
||||
<?php
|
||||
|
||||
if ( ! variable_get('sql_allow_users_backups') ) {
|
||||
echo "<p class=\"error\">"._("You aren't allowed to access this page. Contact your administrator if you want to.")."</p>";
|
||||
include_once('foot.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
$fields = array (
|
||||
"id" => array ("request", "string", ""),
|
||||
"bck_mode" => array ("request", "integer", 0),
|
||||
|
@ -44,14 +56,9 @@ if (!$r=$mysql->get_mysql_details($id)) {
|
|||
$error=$err->errstr();
|
||||
}
|
||||
|
||||
?>
|
||||
<h3><?php __("MySQL Databases"); ?></h3>
|
||||
<hr id="topbar"/>
|
||||
<br />
|
||||
<?php
|
||||
if (isset($error) && $error) {
|
||||
echo "<p class=\"error\">$error</p><p> </p>";
|
||||
}
|
||||
if (isset($error) && $error) {
|
||||
echo "<p class=\"error\">$error</p><p> </p>";
|
||||
}
|
||||
|
||||
if (is_array($r)) {
|
||||
?>
|
||||
|
|
|
@ -29,6 +29,14 @@
|
|||
*/
|
||||
require_once("../class/config.php");
|
||||
|
||||
if ( ! variable_get('sql_allow_users_backups') ) {
|
||||
include_once('head.php');
|
||||
echo "<p class=\"error\">"._("You aren't allowed to access this page. Contact your administrator if you want to.")."</p>";
|
||||
include_once('foot.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
$fields = array (
|
||||
"id" => array ("request", "string", ""),
|
||||
"bck_mode" => array ("request", "integer", 0),
|
||||
|
|
|
@ -51,7 +51,7 @@ if($rdb){
|
|||
?>
|
||||
<form method="post" action="sql_del.php" name="main" id="main">
|
||||
<table class="tlist">
|
||||
<tr><th> </th><th><?php __("Database"); ?></th><th><?php __("Backup"); ?></th><th><?php __("Restore"); ?></th><th><?php __("Show Settings"); ?></th><th><?php __("Size"); ?></th></tr>
|
||||
<tr><th> </th><th><?php __("Database"); ?></th><?php if ( variable_get('sql_allow_users_backups') ) { ?><th><?php __("Backup"); ?></th><?php } // sql_allow_users_backups ?><th><?php __("Restore"); ?></th><th><?php __("Show Settings"); ?></th><th><?php __("Size"); ?></th></tr>
|
||||
|
||||
<?php
|
||||
$col=1;
|
||||
|
@ -63,7 +63,9 @@ for($i=0;$i<count($rdb);$i++) {
|
|||
<tr class="lst<?php echo $col; ?>">
|
||||
<td align="center"><input type="checkbox" class="inc" id="del_<?php echo $val["db"]; ?>" name="del_<?php echo $val["db"]; ?>" value="<?php echo ($val["db"]); ?>" /></td>
|
||||
<td><label for="del_<?php echo $val["db"]; ?>"><?php echo $val["db"]; ?></label></td>
|
||||
<?php if ( variable_get('sql_allow_users_backups') ) { ?>
|
||||
<td><div class="ina"><a href="sql_bck.php?id=<?php echo $val["db"] ?>"><?php __("Backup"); ?></a></div></td>
|
||||
<?php } // sql_allow_users_backups ?>
|
||||
<td><div class="ina"><a href="sql_restore.php?id=<?php echo $val["db"] ?>"><?php __("Restore"); ?></a></div></td>
|
||||
<td><div class="ina"><a href="sql_getparam.php?dbname=<?php echo $val["db"] ?>"><?php __("Show Settings"); ?></a></div></td>
|
||||
<td><code><?php echo format_size($val["size"]); ?></code></td>
|
||||
|
|
|
@ -74,6 +74,7 @@ class m_mysql {
|
|||
if (!empty($cuid)) {
|
||||
$this->dbus = new DB_users();
|
||||
}
|
||||
variable_get('sql_allow_users_backups', 1,'Set 1 to allow users to configure backup of their databases, 0 if you want do disable this feature. Warning: it will not stop configured backup made by sqlbackup.sh');
|
||||
}
|
||||
|
||||
function reload_dbus() {
|
||||
|
@ -346,6 +347,12 @@ class m_mysql {
|
|||
function put_mysql_backup($dbn,$bck_mode,$bck_history,$bck_gzip,$bck_dir) {
|
||||
global $db,$err,$mem,$bro,$cuid;
|
||||
$err->log("mysql","put_mysql_backup");
|
||||
|
||||
if ( ! variable_get('sql_allow_users_backups') ) {
|
||||
$err->raise("mysql",_("User aren't allowed to configure their backups"));
|
||||
return false;
|
||||
}
|
||||
|
||||
$pos=strpos($dbn,'_');
|
||||
if($pos === false){
|
||||
$dbname=$dbn;
|
||||
|
|
Loading…
Reference in New Issue