fixing syscp-feature-request #1236 (cron doesnt delete user directories)
This commit is contained in:
4
TODO
4
TODO
@@ -29,7 +29,7 @@ WONTFIX 0001260 2x F5 causes bigger fonts
|
|||||||
WONTFIX 0001259 contract-changes optional with cron to the end of the interval
|
WONTFIX 0001259 contract-changes optional with cron to the end of the interval
|
||||||
WONTFIX 0001258 Make invoices immediately
|
WONTFIX 0001258 Make invoices immediately
|
||||||
0001120 Missing function to calculate the mail traffic
|
0001120 Missing function to calculate the mail traffic
|
||||||
0001236 the cron doesnt delete user directories
|
FIXED 0001236 the cron doesnt delete user directories
|
||||||
0001244 customer view too wide for 1024x768 resolutions
|
0001244 customer view too wide for 1024x768 resolutions
|
||||||
0001229 subdomains and Own vHost-Settings
|
0001229 subdomains and Own vHost-Settings
|
||||||
FIXED 0001254 Installation no next button
|
FIXED 0001254 Installation no next button
|
||||||
@@ -67,7 +67,7 @@ FIXED 0001209 APS crashs when installing magento
|
|||||||
0001185 Autoreponder - send mails via sendmail to set correct Return-Path header
|
0001185 Autoreponder - send mails via sendmail to set correct Return-Path header
|
||||||
0001211 Generated MySQL username too long
|
0001211 Generated MySQL username too long
|
||||||
0001208 HTML Tags in Support Tickets
|
0001208 HTML Tags in Support Tickets
|
||||||
0001207 FTP Passw<73>rter mit Umlauten
|
0001207 FTP Passw<73>rter mit Umlauten
|
||||||
0001201 Virtualusers conflict with local users when using libnss-mysql
|
0001201 Virtualusers conflict with local users when using libnss-mysql
|
||||||
0001204 php5-suhosin
|
0001204 php5-suhosin
|
||||||
FIXED 0001203 Add check for PHP version and required PHP modules in install script
|
FIXED 0001203 Add check for PHP version and required PHP modules in install script
|
||||||
|
|||||||
@@ -228,11 +228,18 @@ if($page == 'customers'
|
|||||||
$log->logAction(ADM_ACTION, LOG_INFO, "deleted user '" . $result['loginname'] . "'");
|
$log->logAction(ADM_ACTION, LOG_INFO, "deleted user '" . $result['loginname'] . "'");
|
||||||
inserttask('1');
|
inserttask('1');
|
||||||
inserttask('4');
|
inserttask('4');
|
||||||
|
|
||||||
|
if(isset($_POST['delete_userfiles'])
|
||||||
|
&& (int)$_POST['delete_userfiles'] == 1)
|
||||||
|
{
|
||||||
|
inserttask('6', $result['loginname']);
|
||||||
|
}
|
||||||
|
|
||||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ask_yesno('admin_customer_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $result['loginname']);
|
ask_yesno_withcheckbox('admin_customer_reallydelete', 'admin_customer_alsoremovefiles', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $result['loginname']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,8 @@ function safe_exec($exec_string, &$return_value = false)
|
|||||||
$settings['system']['awstats_updateall_command'],
|
$settings['system']['awstats_updateall_command'],
|
||||||
'openssl',
|
'openssl',
|
||||||
'unzip',
|
'unzip',
|
||||||
'php'
|
'php',
|
||||||
|
'rm'
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -51,6 +51,15 @@ function inserttask($type, $param1 = '', $param2 = '', $param3 = '')
|
|||||||
$db->query('INSERT INTO `' . TABLE_PANEL_TASKS . '` (`type`, `data`) VALUES ("2", "' . $db->escape($data) . '")');
|
$db->query('INSERT INTO `' . TABLE_PANEL_TASKS . '` (`type`, `data`) VALUES ("2", "' . $db->escape($data) . '")');
|
||||||
$doupdate = true;
|
$doupdate = true;
|
||||||
}
|
}
|
||||||
|
elseif($type == '6'
|
||||||
|
&& $param1 != '')
|
||||||
|
{
|
||||||
|
$data = Array();
|
||||||
|
$data['loginname'] = $param1;
|
||||||
|
$data = serialize($data);
|
||||||
|
$db->query('INSERT INTO `' . TABLE_PANEL_TASKS . '` (`type`, `data`) VALUES ("6", "' . $db->escape($data) . '")');
|
||||||
|
$doupdate = true;
|
||||||
|
}
|
||||||
|
|
||||||
if($doupdate === true
|
if($doupdate === true
|
||||||
&& (int)$settings['system']['realtime_port'] !== 0)
|
&& (int)$settings['system']['realtime_port'] !== 0)
|
||||||
|
|||||||
@@ -63,3 +63,35 @@ function ask_yesno($text, $yesfile, $params = array(), $targetname = '')
|
|||||||
eval("echo \"" . getTemplate('misc/question_yesno', '1') . "\";");
|
eval("echo \"" . getTemplate('misc/question_yesno', '1') . "\";");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function ask_yesno_withcheckbox($text, $chk_text, $yesfile, $params = array(), $targetname = '')
|
||||||
|
{
|
||||||
|
global $userinfo, $db, $s, $header, $footer, $lng;
|
||||||
|
|
||||||
|
$hiddenparams = '';
|
||||||
|
|
||||||
|
if(is_array($params))
|
||||||
|
{
|
||||||
|
foreach($params as $field => $value)
|
||||||
|
{
|
||||||
|
$hiddenparams.= '<input type="hidden" name="' . htmlspecialchars($field) . '" value="' . htmlspecialchars($value) . '" />' . "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isset($lng['question'][$text]))
|
||||||
|
{
|
||||||
|
$text = $lng['question'][$text];
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isset($lng['question'][$chk_text]))
|
||||||
|
{
|
||||||
|
$chk_text = $lng['question'][$chk_text];
|
||||||
|
}
|
||||||
|
|
||||||
|
$checkbox = makecheckbox('delete_userfiles', $chk_text, '1', false, '0', true, true);
|
||||||
|
|
||||||
|
$text = strtr($text, array('%s' => $targetname));
|
||||||
|
eval("echo \"" . getTemplate('misc/question_yesno_checkbox', '1') . "\";");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -255,6 +255,7 @@ $lng['question']['extras_reallydelete_pathoptions'] = 'Do you really want to del
|
|||||||
$lng['question']['ftp_reallydelete'] = 'Do you really want to delete the FTP account %s?';
|
$lng['question']['ftp_reallydelete'] = 'Do you really want to delete the FTP account %s?';
|
||||||
$lng['question']['mysql_reallydelete'] = 'Do you really want to delete the database %s? This cannot be undone!';
|
$lng['question']['mysql_reallydelete'] = 'Do you really want to delete the database %s? This cannot be undone!';
|
||||||
$lng['question']['admin_configs_reallyrebuild'] = 'Do you really want to rebuild all config files?';
|
$lng['question']['admin_configs_reallyrebuild'] = 'Do you really want to rebuild all config files?';
|
||||||
|
$lng['question']['admin_customer_alsoremovefiles'] = 'Remove user files too?';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mails
|
* Mails
|
||||||
|
|||||||
@@ -255,6 +255,7 @@ $lng['question']['extras_reallydelete_pathoptions'] = 'Wollen Sie die Optionen f
|
|||||||
$lng['question']['ftp_reallydelete'] = 'Wollen Sie das FTP-Benutzerkonto %s wirklich löschen?';
|
$lng['question']['ftp_reallydelete'] = 'Wollen Sie das FTP-Benutzerkonto %s wirklich löschen?';
|
||||||
$lng['question']['mysql_reallydelete'] = 'Wollen Sie die Datenbank %s wirklich löschen?<br />ACHTUNG! Alle Daten gehen unwiderruflich verloren!';
|
$lng['question']['mysql_reallydelete'] = 'Wollen Sie die Datenbank %s wirklich löschen?<br />ACHTUNG! Alle Daten gehen unwiderruflich verloren!';
|
||||||
$lng['question']['admin_configs_reallyrebuild'] = 'Wollen Sie wirklich alle Konfigurationsdateien neu erstellen lassen?';
|
$lng['question']['admin_configs_reallyrebuild'] = 'Wollen Sie wirklich alle Konfigurationsdateien neu erstellen lassen?';
|
||||||
|
$lng['question']['admin_customer_alsoremovefiles'] = 'Auch Kunden-Daten löschen?';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mails
|
* Mails
|
||||||
|
|||||||
@@ -54,18 +54,18 @@ while($row = $db->fetch_array($result_tasks))
|
|||||||
if($row['type'] == '1')
|
if($row['type'] == '1')
|
||||||
{
|
{
|
||||||
//dhr: cleanout froxlor-generated awstats configs prior to re-creation
|
//dhr: cleanout froxlor-generated awstats configs prior to re-creation
|
||||||
if ($settings[system][awstats_enabled] == '1')
|
if ($settings['system']['awstats_enabled'] == '1')
|
||||||
{
|
{
|
||||||
$awstatsclean[header] = "## GENERATED BY FROXLOR\n";
|
$awstatsclean['header'] = "## GENERATED BY FROXLOR\n";
|
||||||
$awstatsclean[path] = '/etc/awstats';
|
$awstatsclean['path'] = '/etc/awstats';
|
||||||
$awstatsclean[dir] = dir($awstatsclean[path]);
|
$awstatsclean['dir'] = dir($awstatsclean['path']);
|
||||||
while($awstatsclean[entry] = $awstatsclean[dir]->read()) {
|
while($awstatsclean['entry'] = $awstatsclean['dir']->read()) {
|
||||||
$awstatsclean[fullentry] = $awstatsclean[path].'/'.$awstatsclean[entry];
|
$awstatsclean['fullentry'] = $awstatsclean['path'].'/'.$awstatsclean['entry'];
|
||||||
$awstatsclean[fh] = fopen($awstatsclean[fullentry], 'r');
|
$awstatsclean['fh'] = fopen($awstatsclean['fullentry'], 'r');
|
||||||
$awstatsclean[headerRead] = fgets($awstatsclean[fh], strlen($awstatsclean[header])+1);
|
$awstatsclean['headerRead'] = fgets($awstatsclean['fh'], strlen($awstatsclean['header'])+1);
|
||||||
fclose($awstatsclean[fh]);
|
fclose($awstatsclean['fh']);
|
||||||
if($awstatsclean[headerRead] == $awstatsclean[header]) {
|
if($awstatsclean['headerRead'] == $awstatsclean['header']) {
|
||||||
@unlink($awstatsclean[fullentry]);
|
@unlink($awstatsclean['fullentry']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unset($awstatsclean);
|
unset($awstatsclean);
|
||||||
@@ -199,6 +199,32 @@ while($row = $db->fetch_array($result_tasks))
|
|||||||
mkDirWithCorrectOwnership($directory['customerroot'], $directory['homedir'], $directory['uid'], $directory['gid']);
|
mkDirWithCorrectOwnership($directory['customerroot'], $directory['homedir'], $directory['uid'], $directory['gid']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TYPE=6 MEANS THAT A CUSTOMER HAS BEEN DELETED AND THAT WE HAVE TO REMOVE ITS FILES
|
||||||
|
*/
|
||||||
|
elseif ($row['type'] == '6')
|
||||||
|
{
|
||||||
|
fwrite($debugHandler, ' cron_tasks: Task6 started - deleting customer data' . "\n");
|
||||||
|
$cronlog->logAction(CRON_ACTION, LOG_INFO, 'Task6 started - deleting customer data');
|
||||||
|
|
||||||
|
if(is_array($row['data']))
|
||||||
|
{
|
||||||
|
if(isset($row['data']['loginname']))
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* remove homedir
|
||||||
|
*/
|
||||||
|
$cronlog->logAction(CRON_ACTION, LOG_NOTICE, 'Running: rm -rf ' . escapeshellarg($settings['system']['documentroot_prefix'] . $row['data']['loginname']));
|
||||||
|
safe_exec('rm -rf '.escapeshellarg($settings['system']['documentroot_prefix'] . $row['data']['loginname']));
|
||||||
|
/*
|
||||||
|
* remove maildir
|
||||||
|
*/
|
||||||
|
$cronlog->logAction(CRON_ACTION, LOG_NOTICE, 'Running: rm -rf ' . escapeshellarg($settings['system']['vmail_homedir'] . $row['data']['loginname']));
|
||||||
|
safe_exec('rm -rf '.escapeshellarg($settings['system']['vmail_homedir'] . $row['data']['loginname']));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($db->num_rows($result_tasks) != 0)
|
if($db->num_rows($result_tasks) != 0)
|
||||||
|
|||||||
21
templates/misc/question_yesno_checkbox.tpl
Normal file
21
templates/misc/question_yesno_checkbox.tpl
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
$header
|
||||||
|
<form action="$yesfile" method="post">
|
||||||
|
<input type="hidden" name="s" value="$s" />
|
||||||
|
<input type="hidden" name="send" value="send" />
|
||||||
|
$hiddenparams
|
||||||
|
<table cellpadding="5" cellspacing="0" border="0" align="center" class="maintable_60">
|
||||||
|
<tr>
|
||||||
|
<td class="maintitle"><b> <img src="images/title.gif" alt="" /> {$lng['question']['question']}</b></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="field_name_center_noborder">$text</td>
|
||||||
|
<td class="field_name">$checkbox</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="field_name_border_left" nowrap="nowrap" style="text-align: center;" colspan="2"><input type="submit" class="bottom" name="submitbutton" value="{$lng['panel']['yes']}" /> <input type="button" class="bottom" value="{$lng['panel']['no']}" onclick="history.back();" /></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
$footer
|
||||||
Reference in New Issue
Block a user