48 bool $with_comments =
false 53 $this->wiki = $a_wiki;
54 $this->
user = $a_user;
58 $this->log->debug(
"comments: " . $this->with_comments);
59 $this->html_export_file_manager = $DIC->export()->domain()->html()->fileManager();
62 protected function read(): void
64 $set = $this->db->query(
65 "SELECT * FROM wiki_user_html_export " .
66 " WHERE wiki_id = " . $this->db->quote($this->wiki->getId(),
"integer") .
67 " AND with_comments = " . $this->db->quote($this->with_comments,
"integer")
69 if (!$this->data = $this->db->fetchAssoc($set)) {
70 $this->data = array();
76 $this->log->debug(
"getProcess");
80 $ilAtomQuery = $this->db->buildAtomQuery();
81 $ilAtomQuery->addTableLock(
'wiki_user_html_export');
83 $ilAtomQuery->addQueryCallable(
function (
ilDBInterface $ilDB) use ($last_change, &$ret, $latest) {
84 $this->log->debug(
"atom query start");
89 if (($this->data[
"start_ts"] ??
"") !=
"" &&
90 $this->data[
"start_ts"] > $last_change) {
92 $ret = self::PROCESS_UPTODATE;
93 $this->log->debug(
"return: " . self::PROCESS_UPTODATE);
98 if (!isset($this->data[
"wiki_id"])) {
99 $this->log->debug(
"insert, wiki id: " . $this->wiki->getId() .
", user id: " . $this->
user->getId() .
101 $ilDB->
manipulate(
"INSERT INTO wiki_user_html_export " .
102 "(wiki_id, usr_id, progress, start_ts, status, with_comments) VALUES (" .
103 $ilDB->
quote($this->wiki->getId(),
"integer") .
"," .
104 $ilDB->
quote($this->user->getId(),
"integer") .
"," .
105 $ilDB->
quote(0,
"integer") .
"," .
106 $ilDB->
quote($ts,
"timestamp") .
"," .
107 $ilDB->
quote(self::RUNNING,
"integer") .
"," .
108 $ilDB->
quote($this->with_comments,
"integer") .
111 $this->log->debug(
"update, wiki id: " . $this->wiki->getId() .
", user id: " . $this->
user->getId() .
114 "UPDATE wiki_user_html_export SET " .
115 " start_ts = " . $ilDB->
quote($ts,
"timestamp") .
"," .
116 " usr_id = " . $ilDB->
quote($this->
user->getId(),
"integer") .
"," .
117 " progress = " . $ilDB->
quote(0,
"integer") .
"," .
118 " status = " . $ilDB->
quote(self::RUNNING,
"integer") .
119 " WHERE status = " . $ilDB->
quote(self::NOT_RUNNING,
"integer") .
120 " AND wiki_id = " . $ilDB->
quote($this->wiki->getId(),
"integer") .
121 " AND with_comments = " . $ilDB->
quote($this->with_comments,
"integer")
126 if (($this->data[
"start_ts"] ??
"") == $ts && $this->data[
"usr_id"] == $this->
user->getId()) {
128 $ret = self::PROCESS_STARTED;
129 $this->log->debug(
"return: " . self::PROCESS_STARTED);
134 $ret = self::PROCESS_OTHER_USER;
135 $this->log->debug(
"return: " . self::PROCESS_OTHER_USER);
140 $this->log->debug(
"outer return: " . $ret);
149 $this->db->manipulate(
150 "UPDATE wiki_user_html_export SET " .
151 " progress = " . $this->db->quote($a_progress,
"integer") .
"," .
152 " status = " . $this->db->quote($a_status,
"integer") .
153 " WHERE wiki_id = " . $this->db->quote($this->wiki->getId(),
"integer") .
154 " AND usr_id = " . $this->db->quote($this->user->getId(),
"integer") .
155 " AND with_comments = " . $this->db->quote($this->with_comments,
"integer")
163 $set = $this->db->query(
164 "SELECT progress, status FROM wiki_user_html_export " .
165 " WHERE wiki_id = " . $this->db->quote($this->wiki->getId(),
"integer") .
166 " AND with_comments = " . $this->db->quote($this->with_comments,
"integer")
168 $rec = $this->db->fetchAssoc($set);
170 return array(
"progress" => (
int) $rec[
"progress"],
"status" => (
int) $rec[
"status"]);
182 ignore_user_abort(
true);
185 if (!$this->with_comments) {
186 $exp->setMode(WikiHtmlExport::MODE_USER);
188 $exp->setMode(WikiHtmlExport::MODE_USER_COMMENTS);
190 $exp = $exp->buildExportFile();
199 if ($this->with_comments) {
200 $exp->setMode(WikiHtmlExport::MODE_USER_COMMENTS);
202 $exp->setMode(WikiHtmlExport::MODE_USER);
204 return $exp->getLatest();
209 $this->log->debug(
"deliver");
212 if ($this->with_comments) {
213 $exp->setMode(WikiHtmlExport::MODE_USER_COMMENTS);
215 $exp->setMode(WikiHtmlExport::MODE_USER);
217 $exp->deliverLatest();
ILIAS components Export HTML ExportFileManager $html_export_file_manager
static getLogger(string $a_component_id)
Get component logger.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Wiki HTML exporter class.
quote($value, string $type)
static now()
Return current timestamp in Y-m-d H:i:s format.
Class manages user html export.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
__construct(ilObjWiki $a_wiki, ilDBInterface $a_db, ilObjUser $a_user, bool $with_comments=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getLastChangeByParent(string $a_parent_type, int $a_parent_id, string $a_lang="")
Get all pages for parent object.
updateStatus(int $a_progress, int $a_status)
manipulate(string $query)
Run a (write) Query on the database.