Changeset 836

Show
Ignore:
Timestamp:
03/22/09 20:32:44 (4 years ago)
Author:
MDMAN
Message:

JGS - Exporter.class updated to Version 1.0.0

Location:
de.mdman.importer/de.wbb-security.database.importer.jgsdb.30x
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • de.mdman.importer/de.wbb-security.database.importer.jgsdb.30x/files/lib/data/database/importer/JGSDatenbank30xExporter.class.php

    r834 r836  
    3030                'files' => 1,  
    3131                'links' => 1,  
    32                 'optionals' => 0,  
     32                'optionals' => 1,  
    3333                'thumbnails' => 1, 
    3434                'activation' => 1 
     
    135135         */ 
    136136        public function countOptionals() { 
    137                 return 0; 
     137                $row = $this->getDB()->getFirstRow("SELECT COUNT(*) AS `count` FROM ".$this->dbPrefix."bb".$this->settings['dbNumber']."_jgs_db_bilder AS `f` LEFT JOIN ".$this->dbPrefix."bb".$this->settings['dbNumber']."_jgs_db_eintrag AS `u` ON (u.id = f.eintrags_id)"); 
     138                return $row['count']; 
    138139        } 
    139140         
     
    204205                                $this->getImporter()->importFile("f".$row['id'],"i".$row['eintrags_id'],$this->settings['sourcePath']."jgs_db_download/download-".$row['zeit']."-".$row['id'].".".$row['datei_endung']."",$row['datei_name'].".".$row['datei_endung'],"",$row['userid']); 
    205206                        } 
    206                 } 
    207                  
     207                }                
    208208        } 
    209209         
     
    222222         */ 
    223223        public function exportOptionals($offset,$limit) { 
    224                 //nothing 
     224 
     225                require_once(WCF_DIR.'lib/data/message/attachment/AttachmentsEditor.class.php'); 
     226                         
     227                $result = $this->getDB()->sendQuery("SELECT f.*, u.userid FROM ".$this->dbPrefix."bb".$this->settings['dbNumber']."_jgs_db_bilder AS `f` LEFT JOIN ".$this->dbPrefix."bb".$this->settings['dbNumber']."_jgs_db_eintrag AS `u` ON (u.id = f.eintrags_id)",$limit,$offset); 
     228                while($row = $this->getDB()->fetchArray($result)) { 
     229                 
     230                        $source = $this->settings['sourcePath']."jgs_db_bilder/bild-".$row['zeit']."-".$row['id'].".jpg"; 
     231                        if(file_exists($source)) { 
     232                         
     233                                $attachmentName = $row['bild_name'].".jpg"; 
     234                         
     235                                $item = $this->getImporter()->getImportKey("i".$row['eintrags_id']);  
     236 
     237                                $attachment = array( 
     238                                        "attachmentSize" => filesize($source), 
     239                                        "sha1Hash" => sha1_file($source), 
     240                                        "fileType" => "image/jpeg", 
     241                                        "isBinary" => 1, 
     242                                        "isImage" => 1, 
     243                                        "messageID" => $item['value'], 
     244                                        "messageType" => "database", 
     245                                        "packageID" => PACKAGE_ID, 
     246                                        "idHash" => StringUtil::getRandomID(), 
     247                                        "userID" => $row['userid'], 
     248                                        "uploadTime" => $row['zeit'] 
     249                                ); 
     250 
     251                                $attachment['attachmentID'] = AttachmentsEditor::insert($attachmentName, $attachment); 
     252                                $attachment['attachmentName'] = $attachmentName; 
     253                                $attachment['attachment'] = WCF_DIR.'attachments/attachment-'.$attachment['attachmentID']; 
     254                                $attachment['attachmentExtension'] = 'jgp'; 
     255                                 
     256                                @copy($source,$attachment['attachment']); 
     257                                 
     258                                AttachmentsEditor::saveThumbnail($attachment); 
     259                        }  
     260                } 
    225261        } 
    226262         
  • de.mdman.importer/de.wbb-security.database.importer.jgsdb.30x/package.xml

    r830 r836  
    77                <standalone>0</standalone> 
    88                <isUnique>1</isUnique> 
    9                 <version>1.0.0 RC 2</version> 
     9                <version>1.0.0</version> 
    1010                <plugin>de.wbb-security.database</plugin> 
    11                 <date>2009-03-21</date> 
     11                <date>2009-03-22</date> 
    1212        </packageInformation> 
    1313 
     
    3333        </instructions> 
    3434         
    35         <instructions type="update" fromversion="1.0.0 RC 1"> 
     35        <instructions type="update" fromversion="1.0.0 RC *"> 
    3636                <files>files.tar</files> 
    3737        </instructions>