Ajout d'un bouton pour "upgrader" les quotas des membres
lorsqu'on a modifié les quotas du profil. Fix #1317
This commit is contained in:
parent
886068bd03
commit
fb514b928c
|
@ -35,6 +35,10 @@ if (!$admin->enabled) {
|
||||||
__("This page is restricted to authorized staff");
|
__("This page is restricted to authorized staff");
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
$fields = array (
|
||||||
|
"synchronise" => array ("get", "integer", "0"),
|
||||||
|
);
|
||||||
|
getFields($fields);
|
||||||
|
|
||||||
include_once ("head.php");
|
include_once ("head.php");
|
||||||
|
|
||||||
|
@ -43,10 +47,14 @@ include_once ("head.php");
|
||||||
<hr id="topbar"/>
|
<hr id="topbar"/>
|
||||||
<br />
|
<br />
|
||||||
<?php
|
<?php
|
||||||
if (isset($error) && $error) {
|
if ($synchronise==true) {
|
||||||
echo "<p class=\"error\">$error</p>";
|
$quota->synchronise_user_profile();
|
||||||
}
|
echo "<p class=\"error\">";__("User's quotas synchronised");echo "</p>";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($error) && $error) {
|
||||||
|
echo "<p class=\"error\">$error</p>";
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
<form method="post" action="adm_dodefquotas.php">
|
<form method="post" action="adm_dodefquotas.php">
|
||||||
<p>
|
<p>
|
||||||
|
@ -78,6 +86,7 @@ foreach($quota->listtype() as $type) {
|
||||||
<p>
|
<p>
|
||||||
<?php __("Here is the list of the quotas on the server for the new accounts. If you want to change them, enter new values"); ?>
|
<?php __("Here is the list of the quotas on the server for the new accounts. If you want to change them, enter new values"); ?>
|
||||||
</p>
|
</p>
|
||||||
|
<span class="inb"><a href="adm_defquotas.php?synchronise=1"><?php __("Synchronise user's quota"); ?></a></span>
|
||||||
|
|
||||||
<form method="post" action="adm_dodefquotas.php">
|
<form method="post" action="adm_dodefquotas.php">
|
||||||
<div>
|
<div>
|
||||||
|
|
|
@ -83,6 +83,22 @@ class m_quota {
|
||||||
return $qlist;
|
return $qlist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Synchronise the quotas of the users with the quota of the
|
||||||
|
* user's profile.
|
||||||
|
* If the user have a greater quota than the profile, no change.
|
||||||
|
* If the quota entry doesn't exist for the user, create it with
|
||||||
|
* the defaults value.
|
||||||
|
*/
|
||||||
|
function synchronise_user_profile() {
|
||||||
|
global $db,$err;
|
||||||
|
$err->log("quota","apply_greater_quota");
|
||||||
|
$q="insert into quotas select m.uid as uid, d.quota as name, d.value as total from membres m, defquotas d left join quotas q on q.name=d.quota where m.type=d.type ON DUPLICATE KEY UPDATE total = greatest(d.value, quotas.total);";
|
||||||
|
$db->query($q);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------- */
|
/* ----------------------------------------------------------------- */
|
||||||
/** Return a ressource usage (u) and total quota (t)
|
/** Return a ressource usage (u) and total quota (t)
|
||||||
* @param string $ressource ressource to get quota of
|
* @param string $ressource ressource to get quota of
|
||||||
|
|
Loading…
Reference in New Issue