commit 53870748061e6ac04d4892ea2789e44510a36ffc
parent 04455d3f73ee0cfa98a8c0218dd85c842ca1c718
Author: Jan Dankert <devnull@localhost>
Date: Thu, 25 Oct 2012 22:08:51 +0200
Wenn ein Objekt nicht gefunden wird, eine ObjectNotFoundException werfen.
Diffstat:
2 files changed, 28 insertions(+), 33 deletions(-)
diff --git a/model/Project.class.php b/model/Project.class.php
@@ -249,11 +249,18 @@ SQL
$sql->setInt ('projectid' ,$this->projectid );
$db->query( $sql );
-
- $rootFolder = new Folder( $this->getRootObjectId() );
- $rootFolder->load();
- $rootFolder->filename = $this->name;
- $rootFolder->save();
+
+ try
+ {
+ $rootFolder = new Folder( $this->getRootObjectId() );
+ $rootFolder->load();
+ $rootFolder->filename = $this->name;
+ $rootFolder->save();
+ }
+ catch( Exception $e )
+ {
+ Logger::warn('Project '.$this->projectid.' has not a root folder'."\n".$e->getTraceAsString());
+ }
}
diff --git a/model/User.class.php b/model/User.class.php
@@ -211,6 +211,9 @@ SQL
$sql->setInt( 'userid',$this->userid );
$row = $db->getRow( $sql );
+ if ( count($row) == 0 )
+ throw new ObjectNotFoundException();
+
$this->setDatabaseRow( $row );
}
@@ -258,36 +261,21 @@ SQL
{
global $conf;
- if ( count($row) > 1 )
- {
- $this->userid = $row['id' ];
- $this->name = $row['name' ];
- $this->style = $row['style' ];
- $this->isAdmin = ( $row['is_admin'] == '1');
- $this->ldap_dn = $row['ldap_dn' ];
- $this->fullname = $row['fullname'];
- $this->tel = $row['tel' ];
- $this->mail = $row['mail' ];
- $this->desc = $row['descr' ];
+ $this->userid = $row['id' ];
+ $this->name = $row['name' ];
+ $this->style = $row['style' ];
+ $this->isAdmin = ( $row['is_admin'] == '1');
+ $this->ldap_dn = $row['ldap_dn' ];
+ $this->fullname = $row['fullname'];
+ $this->tel = $row['tel' ];
+ $this->mail = $row['mail' ];
+ $this->desc = $row['descr' ];
+
+ if ( $this->fullname == '' )
+ $this->fullname = $this->name;
- if ( $this->fullname == '' )
- $this->fullname = $this->name;
-
- if ( $this->style == '' )
+ if ( $this->style == '' )
$this->style = $conf['interface']['style']['default'];
- }
- else
- {
- $this->userid = -99;
- $this->name = lang('UNKNOWN');
- $this->style = $conf['interface']['style']['default'];
- $this->isAdmin = false;
- $this->ldap_dn = '';
- $this->fullname = lang('UNKNOWN');
- $this->tel = '';
- $this->mail = '';
- $this->desc = '';
- }
/* vorerst unbenutzt:
if ( $row['use_ldap'] == '1' )