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,19 +942,24 @@ 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();
$remote->connect($lamdaemonServers[$i]); try {
$result = $remote->execute( $remote->connect($lamdaemonServers[$i]);
implode( $result = $remote->execute(
self::$SPLIT_DELIMITER, implode(
array( self::$SPLIT_DELIMITER,
$this->attributes['uid'][0], array(
"home", $this->attributes['uid'][0],
"rem", "home",
$this->attributes[$homeDirAttr][0], "rem",
$this->attributes['uidNumber'][0] $this->attributes[$homeDirAttr][0],
) $this->attributes['uidNumber'][0]
)); )
$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() {
$this->initQuotas(); try {
if (!isset($this->quota) || !is_array($this->quota)) return array(); $this->initQuotas();
}
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();
$this->initQuotas(); try {
if (!is_array($this->quota)) return $return; $this->initQuotas();
}
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) {
$this->initQuotas(); try {
if (!isset($this->quota) || !is_array($this->quota)) return array(); $this->initQuotas();
}
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) {
$this->initQuotas(); try {
if (!isset($this->quota) || !is_array($this->quota)) return array(); $this->initQuotas();
}
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