Commit 43773895 authored by Carsten  Rose's avatar Carsten Rose
Browse files

Dirty.php: save SIP in dirty record

parent 3648bf36
...@@ -14,6 +14,8 @@ const API_DIR = 'typo3conf/ext/qfq/qfq/api'; ...@@ -14,6 +14,8 @@ const API_DIR = 'typo3conf/ext/qfq/qfq/api';
const QFQ_LOG = 'qfq.log'; const QFQ_LOG = 'qfq.log';
const MAX_LENGTH_IPV6 = 45;
const SESSION_LIFETIME_SECONDS = 86400; const SESSION_LIFETIME_SECONDS = 86400;
const SESSION_NAME = 'qfq'; const SESSION_NAME = 'qfq';
const SESSION_FE_USER_UID = 'feUserUid'; const SESSION_FE_USER_UID = 'feUserUid';
......
...@@ -96,7 +96,7 @@ class Dirty { ...@@ -96,7 +96,7 @@ class Dirty {
if (count($recordDirty) == 0) { if (count($recordDirty) == 0) {
// No dirty record found. // No dirty record found.
$answer = $this->writeDirty($recordId, $tableName, $formDirtyMode, $feUser); $answer = $this->writeDirty($this->client[SIP_SIP], $recordId, $tableName, $formDirtyMode, $feUser);
} else { } else {
$answer = $this->checkConflict($recordDirty, $formDirtyMode, $feUser); $answer = $this->checkConflict($recordDirty, $formDirtyMode, $feUser);
} }
...@@ -142,14 +142,16 @@ class Dirty { ...@@ -142,14 +142,16 @@ class Dirty {
/** /**
* Write a 'Dirty'-Record. * Write a 'Dirty'-Record.
* *
* @param $s
* @param $recordId * @param $recordId
* @param $tableName * @param $tableName
* @param $formDirtyMode * @param $formDirtyMode
* @param $feUser
* @return array * @return array
* @throws CodeException * @throws CodeException
* @throws DbException * @throws DbException
*/ */
private function writeDirty($recordId, $tableName, $formDirtyMode, $feUser) { private function writeDirty($s, $recordId, $tableName, $formDirtyMode, $feUser) {
$record = $this->db->sql("SELECT * FROM $tableName WHERE id=?", ROW_EXPECT_1, [$recordId], "Record to tag 'dirty' not found."); $record = $this->db->sql("SELECT * FROM $tableName WHERE id=?", ROW_EXPECT_1, [$recordId], "Record to tag 'dirty' not found.");
...@@ -157,8 +159,8 @@ class Dirty { ...@@ -157,8 +159,8 @@ class Dirty {
$recordModified = empty($record[COLUMN_MODIFIED]) ? 0 : $record[COLUMN_MODIFIED]; $recordModified = empty($record[COLUMN_MODIFIED]) ? 0 : $record[COLUMN_MODIFIED];
// Write 'dirty' record // Write 'dirty' record
$this->db->sql("INSERT INTO Dirty (`tableName`, `recordId`, `recordModified`, `feUser`, `qfqUserSessionCookie`, `dirtyMode`, `remoteAddress`, `created`) " . $this->db->sql("INSERT INTO Dirty (`sip`, `tableName`, `recordId`, `recordModified`, `feUser`, `qfqUserSessionCookie`, `dirtyMode`, `remoteAddress`, `created`) " .
"VALUES ( ?,?,?,?,?,?,?,? )", ROW_REGULAR, [$tableName, $recordId, $recordModified, $feUser, $this->client[CLIENT_COOKIE_QFQ], $formDirtyMode, $this->client[CLIENT_REMOTE_ADDRESS], date('YmdHis')]); "VALUES ( ?,?,?,?,?,?,?,?,? )", ROW_REGULAR, [$s, $tableName, $recordId, $recordModified, $feUser, $this->client[CLIENT_COOKIE_QFQ], $formDirtyMode, $this->client[CLIENT_REMOTE_ADDRESS], date('YmdHis')]);
return [API_STATUS => API_ANSWER_STATUS_SUCCESS, API_MESSAGE => '']; return [API_STATUS => API_ANSWER_STATUS_SUCCESS, API_MESSAGE => ''];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment