Changeset 835

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

IT4All - Exporter.class updated to Version 1.0.0

Location:
de.mdman.importer/de.wbb-security.database.importer.it4allfb.11x
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • de.mdman.importer/de.wbb-security.database.importer.it4allfb.11x/files/lib/data/database/importer/IT4AllFilebase11xExporter.class.php

    r828 r835  
    22 
    33require_once(WCF_DIR.'lib/data/database/importer/AbstractDatabaseExporter.class.php'); 
    4  
    54 
    65/** 
     
    3029                'files' => 1,  
    3130                'links' => 1,  
    32                 'optionals' => 0,  
     31                'optionals' => 1,  
    3332                'thumbnails' => 1, 
    3433                'activation' => 1 
     
    135134         */ 
    136135        public function countOptionals() { 
    137                 return 0; 
     136                $row = $this->getDB()->getFirstRow("SELECT COUNT(u.upload_id) AS `count` FROM ".$this->dbPrefix."fp".$this->settings['dbNumber']."_fileuploads AS `u` LEFT JOIN ".$this->dbPrefix."fp".$this->settings['dbNumber']."_files AS `f` ON (u.file_id = f.file_id) WHERE u.upmode = 'screen'"); 
     137                return $row['count']; 
    138138        } 
    139139         
     
    183183                } 
    184184                 
    185                 $result = $this->getDB()->sendQuery("SELECT d.*,u.username FROM ".$this->dbPrefix."fp".$this->settings['dbNumber']."_files AS `d` LEFT JOIN ".$this->dbPrefix."bb".$this->settings['dbNumber']."_users AS `u` ON (u.userid = d.userid)",$limit,$offset); 
     185                $result = $this->getDB()->sendQuery("SELECT d.*,u.username FROM ".$this->dbPrefix."fp".$this->settings['dbNumber']."_files AS `d` LEFT JOIN ".$this->dbPrefix."bb".$this->settings['dbNumber']."_users AS `u` ON (u.userid = d.userid) ORDER BY `timest` ASC",$limit,$offset); 
    186186                while($row = $this->getDB()->fetchArray($result)) { 
    187187                         
     
    206206                while($row = $this->getDB()->fetchArray($result)) { 
    207207                        //get first thumbnail from each file 
    208                         $result = $this->getDB()->sendQuery("SELECT * FROM ".$this->dbPrefix."fp".$this->settings['dbNumber']."_fileuploads WHERE file_id = '".$row['file_id']."' ORDER BY upload_id ASC LIMIT 1,1"); 
    209                         while ($row2 = $this->getDB()->fetchArray($result)) { 
    210                                 if(file_exists($this->settings['sourcePath']."files/".$row2['upload_id']."_screen_".$row2['encode'].".".$row2['ext'])) { 
    211                                         $this->getImporter()->importThumbnail("t".$row2['upload_id'],"i".$row2['file_id'],$this->settings['sourcePath']."files/".$row2['upload_id']."_screen_".$row2['encode'].".".$row2['ext'],"",$row['userid']); 
    212                                 } 
    213                         } 
    214                 } 
    215         } 
    216          
    217         /** 
    218          * @see AbstractDatabaseExporter::exportScreenshots(); 
    219          */ 
    220         public function exportScreenshots($offset,$limit) { 
    221                 //look for the Screenshots 
    222                 $sql = "SELECT f.*, u.file_id, u.userid FROM ".$this->dbPrefix."fp".$this->settings['dbNumber']."_fileuploads AS `f` LEFT JOIN ".$this->dbPrefix."fp".$this->settings['dbNumber']."_files AS `u` ON (u.file_id = f.file_id) WHERE f.upmode = 'screen' LIMIT 2"; 
    223                 //$result = $this->getDB()->sendQuery($sql,$limit,$offset); 
    224                  
    225                  // file_id = itemID 
    226                  // upload_id = Bild_ID / Datei-ID 
     208                        $row2 = $this->getDB()->getFirstRow("SELECT * FROM ".$this->dbPrefix."fp".$this->settings['dbNumber']."_fileuploads WHERE file_id = '".$row['file_id']."' AND upmode='screen' ORDER BY upload_id ASC"); 
     209                        if(file_exists($this->settings['sourcePath']."files/".$row2['upload_id']."_screen_".$row2['encode'].".".$row2['ext'])) { 
     210                                $this->getImporter()->importThumbnail("t".$row2['upload_id'],"i".$row2['file_id'],$this->settings['sourcePath']."files/".$row2['upload_id']."_screen_".$row2['encode'].".".$row2['ext'],"",$row['userid']); 
     211                        } 
     212                } 
    227213        } 
    228214         
     
    253239         */ 
    254240        public function exportOptionals($offset,$limit) { 
    255                 //nothing 
     241 
     242                require_once(WCF_DIR.'lib/data/message/attachment/AttachmentsEditor.class.php'); 
     243 
     244                $result = $this->getDB()->sendQuery("SELECT f.*, u.file_id, u.userid FROM ".$this->dbPrefix."fp".$this->settings['dbNumber']."_fileuploads AS `f` LEFT JOIN ".$this->dbPrefix."fp".$this->settings['dbNumber']."_files AS `u` ON (u.file_id = f.file_id) WHERE f.upmode = 'screen'",$limit,$offset); 
     245                while($row = $this->getDB()->fetchArray($result)) { 
     246                 
     247                        $source = $this->settings['sourcePath']."files/".$row['upload_id']."_screen_".$row['encode'].".".$row['ext']; 
     248                 
     249                        if(file_exists($source)) { 
     250                         
     251                                $attachmentName = $row['name'].".".$row['ext']; 
     252                         
     253                                $item = $this->getImporter()->getImportKey("i".$row['file_id']);  
     254 
     255                                $attachment = array( 
     256                                        "attachmentSize" => filesize($source), 
     257                                        "sha1Hash" => sha1_file($source), 
     258                                        "fileType" => $row['mime'], 
     259                                        "isBinary" => 1, 
     260                                        "isImage" => 1, 
     261                                        "messageID" => $item['value'], 
     262                                        "messageType" => "database", 
     263                                        "packageID" => PACKAGE_ID, 
     264                                        "idHash" => StringUtil::getRandomID(), 
     265                                        "userID" => $row['userid'], 
     266                                        "uploadTime" => $row['upload_time'] 
     267                                ); 
     268                                 
     269                                $attachment['attachmentID'] = AttachmentsEditor::insert($attachmentName, $attachment); 
     270                                $attachment['attachmentName'] = $attachmentName; 
     271                                $attachment['attachment'] = WCF_DIR.'attachments/attachment-'.$attachment['attachmentID']; 
     272                                $attachment['attachmentExtension'] = $row['ext']; 
     273                                 
     274                                @copy($source,$attachment['attachment']); 
     275                                 
     276                                AttachmentsEditor::saveThumbnail($attachment); 
     277                        } 
     278                         
     279                } 
    256280        } 
    257281         
  • de.mdman.importer/de.wbb-security.database.importer.it4allfb.11x/package.xml

    r829 r835  
    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>