dbObj = Zend_Db::factory('Pdo_Mysql', array(
'host' => 'localhost',
'username' => 'DUMMY',
'password' => 'DUMMY',
'dbname' => 'DUMMY'
));
$this->dbObj->getConnection();
}
protected function holeDatenArray(){
$select = $this->dbObj->select();
$select->from(self::DB_TABLE_CCK_COMMENTS,
array('vid',
'nid',
'field_faq_antwort_value',
'field_faq_antwort_format'));
$select->order('nid ASC');
$stmt = $this->dbObj->query($select);
$result = $stmt->fetchAll();
return $result;
}
protected function _erzeugeDrupalDatensatz(array $parDbInhalteArray){
if($parDbInhalteArray['field_faq_antwort_value'] === null){
if($this->debug){
echo ('Leerer Kommentar');
}
return;
}
$kommentarArray = array('pid' => 0,
'nid' => $parDbInhalteArray['nid'],
'uid' => self::$uidKennung,
'subject' => 'Unser Tipp',
'comment' => $parDbInhalteArray['field_faq_antwort_value'],
'hostname' => $_SERVER['REMOTE_ADDR'],
'timestamp' => time(),
'status' => 0,
'thread' => '01/',
'name' => 'Admin',
'homepage' => 'http://www.TopScoots.com',
'format' => $parDbInhalteArray['field_faq_antwort_format']
);
//NODE-REVISION ERZEUGEN!!
if($this->testmodus === false){
try {
$erzeugt = $this->dbObj->insert(self::DB_TABLE_COMMENTS, $kommentarArray);
$revisionLastInsertVid = $this->dbObj->lastInsertId();
$statUpdate = array('last_comment_timestamp' => time(),
'last_comment_name' => 'Admin',
'last_comment_uid' => self::$uidKennung,
'comment_count' => new Zend_Db_Expr('comment_count+1'));
$this->dbObj->update(self::DB_TABLE_CCK_COMMENTS_STAT, $statUpdate,'nid='.$parDbInhalteArray['nid']);
$this->dbObj->delete(self::DB_TABLE_CCK_COMMENTS, 'nid=\''.$parDbInhalteArray['nid'].'\' and vid=\''.$parDbInhalteArray['vid'].'\'');
} catch(Exception $e){
echo $e;
echo $erzeugt = false;
}
} else {
//Fake
$erzeugt = true;
}
if($this->debug){
echo('
##### BASISDATEN ######
');
echo('
'.print_r($kommentarArray, true).''); } if(empty($erzeugt)){ throw new Exception('Ein Datensatz konnte nicht erzeugt werden!'); } $lastInsertId = $this->dbObj->lastInsertId(); return !empty($erzeugt) and !empty($erzeugtDateien); } public function proceed(){ echo('+++++++++ Import gestartet! +++++++++