openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 2c9056034609d1c0eabddd9d67134c67fd8ff5d4
parent 3e6be8e50abf8cdaaf9f59f3520c9dac8e33a16f
Author: dankert <devnull@localhost>
Date:   Mon,  7 Dec 2009 09:49:08 +0100

Ordner \"lost+found\" nur anlegen, wenn verloren gegangene Dateien gefunden worden sind.

Diffstat:
objectClasses/Project.class.php | 43+++++++++++++++++++++++++++++++------------
1 file changed, 31 insertions(+), 12 deletions(-)

diff --git a/objectClasses/Project.class.php b/objectClasses/Project.class.php @@ -90,6 +90,9 @@ class Project var $content_negotiation; var $cut_index; + var $log = array(); + + // Konstruktor function Project( $projectid='' ) { @@ -444,10 +447,20 @@ SQL return $db->getOne( $sql ); } + + + + function checkLimit() + { + // TODO + } + function checkLostFiles() { + $this->log = array(); + $db = &Session::getDatabase(); $sql = new Sql( <<<EOF @@ -459,20 +472,26 @@ EOF ); $sql->setInt('projectid',$this->projectid); - $lostAndFoundFolder = new Folder(); - $lostAndFoundFolder->projectid = $this->projectid; - $lostAndFoundFolder->languageid = $this->getDefaultLanguageId(); - $lostAndFoundFolder->filename = "lostandfound"; - $lostAndFoundFolder->name = 'Lost+found'; - $lostAndFoundFolder->parentid = $this->getRootObjectId(); - $lostAndFoundFolder->add(); - - foreach( $db->getCol($sql) as $id ) + $idList = $db->getCol($sql); + + if ( count( $idList ) > 0 ) { - echo 'Lost file! moving '.$id.' to lost+found.'; - $obj = new Object( $id ); - $obj->setParentId( $lostAndFoundFolder->objectid ); + $lostAndFoundFolder = new Folder(); + $lostAndFoundFolder->projectid = $this->projectid; + $lostAndFoundFolder->languageid = $this->getDefaultLanguageId(); + $lostAndFoundFolder->filename = "lostandfound"; + $lostAndFoundFolder->name = 'Lost+found'; + $lostAndFoundFolder->parentid = $this->getRootObjectId(); + $lostAndFoundFolder->add(); + + foreach( $idList as $id ) + { + $this->log[] = 'Lost file! Moving '.$id.' to lost+found.'; + $obj = new Object( $id ); + $obj->setParentId( $lostAndFoundFolder->objectid ); + } } + }