error handling

This commit is contained in:
Roland Gruber 2017-12-13 12:31:26 +01:00
parent 68cd9b53aa
commit db504da5d7
2 changed files with 57 additions and 21 deletions

View File

@ -942,6 +942,7 @@ class posixAccount extends baseModule implements passwordService {
// try to delete directory on all servers // try to delete directory on all servers
for ($i = 0; $i < sizeof($lamdaemonServers); $i++) { for ($i = 0; $i < sizeof($lamdaemonServers); $i++) {
$remote = new \LAM\REMOTE\Remote(); $remote = new \LAM\REMOTE\Remote();
try {
$remote->connect($lamdaemonServers[$i]); $remote->connect($lamdaemonServers[$i]);
$result = $remote->execute( $result = $remote->execute(
implode( implode(
@ -955,6 +956,10 @@ class posixAccount extends baseModule implements passwordService {
) )
)); ));
$remote->disconnect(); $remote->disconnect();
}
catch (LAMException $e) {
$return[] = array('ERROR', $e->getTitle(), $e->getMessage());
}
// lamdaemon results // lamdaemon results
if (!empty($result)) { if (!empty($result)) {
$singleresult = explode(",", $result); $singleresult = explode(",", $result);

View File

@ -336,8 +336,15 @@ class quota extends baseModule {
* @return array Array which contains status messages. Each entry is an array containing the status message parameters. * @return array Array which contains status messages. Each entry is an array containing the status message parameters.
*/ */
function preDeleteActions() { function preDeleteActions() {
try {
$this->initQuotas(); $this->initQuotas();
if (!isset($this->quota) || !is_array($this->quota)) return array(); }
catch (LAMException $e) {
return array(array('ERROR', $e->getTitle(), $e->getMessage()));
}
if (!isset($this->quota) || !is_array($this->quota)) {
return array();
}
// determine if this is a user or group account // determine if this is a user or group account
if ($this->get_scope()=='user') { if ($this->get_scope()=='user') {
$attrs = $this->getAccountContainer()->getAccountModule('posixAccount')->getAttributes(); $attrs = $this->getAccountContainer()->getAccountModule('posixAccount')->getAttributes();
@ -427,8 +434,16 @@ class quota extends baseModule {
*/ */
function display_html_attributes() { function display_html_attributes() {
$return = new htmlTable(); $return = new htmlTable();
try {
$this->initQuotas(); $this->initQuotas();
if (!is_array($this->quota)) return $return; }
catch (LAMException $e) {
$return->addElement(new htmlStatusMessage('ERROR', $e->getTitle(), $e->getMessage()));
return $return;
}
if (!is_array($this->quota)) {
return $return;
}
// get list of lamdaemon servers // get list of lamdaemon servers
$serverDescriptions = array(); $serverDescriptions = array();
$lamdaemonServers = explode(";", $_SESSION['config']->get_scriptServers()); $lamdaemonServers = explode(";", $_SESSION['config']->get_scriptServers());
@ -671,8 +686,16 @@ class quota extends baseModule {
* @see baseModule::get_pdfEntries() * @see baseModule::get_pdfEntries()
*/ */
function get_pdfEntries($pdfKeys, $typeId) { function get_pdfEntries($pdfKeys, $typeId) {
try {
$this->initQuotas(); $this->initQuotas();
if (!isset($this->quota) || !is_array($this->quota)) return array(); }
catch (LAMException $e) {
logNewMessage(LOG_ERR, $e->getTitle(), $e->getMessage());
return array();
}
if (!isset($this->quota) || !is_array($this->quota)) {
return array();
}
if (sizeof($this->quota) > 0) { if (sizeof($this->quota) > 0) {
$pdfTable = new PDFTable(); $pdfTable = new PDFTable();
// get list of lamdaemon servers // get list of lamdaemon servers
@ -720,8 +743,16 @@ class quota extends baseModule {
* @see baseModule::get_uploadColumns() * @see baseModule::get_uploadColumns()
*/ */
function get_uploadColumns($selectedModules, &$type) { function get_uploadColumns($selectedModules, &$type) {
try {
$this->initQuotas(); $this->initQuotas();
if (!isset($this->quota) || !is_array($this->quota)) return array(); }
catch (LAMException $e) {
logNewMessage(LOG_ERR, $e->getTitle(), $e->getMessage());
return array();
}
if (!isset($this->quota) || !is_array($this->quota)) {
return array();
}
$return = array(); $return = array();
if (sizeof($this->quota) > 0) { if (sizeof($this->quota) > 0) {
// get list of lamdaemon servers // get list of lamdaemon servers