コード例 #1
0
ファイル: IRCScraper.php プロジェクト: kaibosh/nZEDb
 /**
  * Updates PRE data in the DB.
  *
  * @access protected
  */
 protected function _updatePre()
 {
     if (empty($this->_curPre['title'])) {
         return;
     }
     $query = 'UPDATE predb SET ';
     $query .= !empty($this->_curPre['size']) ? 'size = ' . $this->_pdo->escapeString($this->_curPre['size']) . ', ' : '';
     $query .= !empty($this->_curPre['source']) ? 'source = ' . $this->_pdo->escapeString($this->_curPre['source']) . ', ' : '';
     $query .= !empty($this->_curPre['files']) ? 'files = ' . $this->_pdo->escapeString($this->_curPre['files']) . ', ' : '';
     $query .= !empty($this->_curPre['reason']) ? 'nukereason = ' . $this->_pdo->escapeString($this->_curPre['reason']) . ', ' : '';
     $query .= !empty($this->_curPre['reqid']) ? 'requestid = ' . $this->_curPre['reqid'] . ', ' : '';
     $query .= !empty($this->_curPre['group_id']) ? 'group_id = ' . $this->_curPre['group_id'] . ', ' : '';
     $query .= !empty($this->_curPre['predate']) ? 'predate = ' . $this->_curPre['predate'] . ', ' : '';
     $query .= !empty($this->_curPre['nuked']) ? 'nuked = ' . $this->_curPre['nuked'] . ', ' : '';
     $query .= !empty($this->_curPre['filename']) ? 'filename = ' . $this->_pdo->escapeString($this->_curPre['filename']) . ', ' : '';
     $query .= empty($this->_oldPre['category']) && !empty($this->_curPre['category']) ? 'category = ' . $this->_pdo->escapeString($this->_curPre['category']) . ', ' : '';
     if ($query === 'UPDATE predb SET ') {
         return;
     }
     $query .= 'title = ' . $this->_pdo->escapeString($this->_curPre['title']);
     $query .= ' WHERE title = ' . $this->_pdo->escapeString($this->_curPre['title']);
     $this->_pdo->ping(true);
     $this->_pdo->queryExec($query);
     $this->_doEcho(false);
 }