46 bool $with_comments =
false 49 $this->wiki = $a_wiki;
50 $this->
user = $a_user;
54 $this->log->debug(
"comments: " . $this->with_comments);
57 protected function read(): void
59 $set = $this->db->query(
60 "SELECT * FROM wiki_user_html_export " .
61 " WHERE wiki_id = " . $this->db->quote($this->wiki->getId(),
"integer") .
62 " AND with_comments = " . $this->db->quote($this->with_comments,
"integer")
64 if (!$this->data = $this->db->fetchAssoc($set)) {
65 $this->data = array();
71 $this->log->debug(
"getProcess");
75 $ilAtomQuery = $this->db->buildAtomQuery();
76 $ilAtomQuery->addTableLock(
'wiki_user_html_export');
78 $ilAtomQuery->addQueryCallable(
function (
ilDBInterface $ilDB) use ($last_change, &$ret, $file_exists) {
79 $this->log->debug(
"atom query start");
84 if (($this->data[
"start_ts"] ??
"") !=
"" &&
85 $this->data[
"start_ts"] > $last_change) {
87 $ret = self::PROCESS_UPTODATE;
88 $this->log->debug(
"return: " . self::PROCESS_UPTODATE);
93 if (!isset($this->data[
"wiki_id"])) {
94 $this->log->debug(
"insert, wiki id: " . $this->wiki->getId() .
", user id: " . $this->
user->getId() .
96 $ilDB->
manipulate(
"INSERT INTO wiki_user_html_export " .
97 "(wiki_id, usr_id, progress, start_ts, status, with_comments) VALUES (" .
98 $ilDB->
quote($this->wiki->getId(),
"integer") .
"," .
99 $ilDB->
quote($this->user->getId(),
"integer") .
"," .
100 $ilDB->
quote(0,
"integer") .
"," .
101 $ilDB->
quote($ts,
"timestamp") .
"," .
102 $ilDB->
quote(self::RUNNING,
"integer") .
"," .
103 $ilDB->
quote($this->with_comments,
"integer") .
106 $this->log->debug(
"update, wiki id: " . $this->wiki->getId() .
", user id: " . $this->
user->getId() .
109 "UPDATE wiki_user_html_export SET " .
110 " start_ts = " . $ilDB->
quote($ts,
"timestamp") .
"," .
111 " usr_id = " . $ilDB->
quote($this->
user->getId(),
"integer") .
"," .
112 " progress = " . $ilDB->
quote(0,
"integer") .
"," .
113 " status = " . $ilDB->
quote(self::RUNNING,
"integer") .
114 " WHERE status = " . $ilDB->
quote(self::NOT_RUNNING,
"integer") .
115 " AND wiki_id = " . $ilDB->
quote($this->wiki->getId(),
"integer") .
116 " AND with_comments = " . $ilDB->
quote($this->with_comments,
"integer")
121 if (($this->data[
"start_ts"] ??
"") == $ts && $this->data[
"usr_id"] == $this->
user->getId()) {
123 $ret = self::PROCESS_STARTED;
124 $this->log->debug(
"return: " . self::PROCESS_STARTED);
129 $ret = self::PROCESS_OTHER_USER;
130 $this->log->debug(
"return: " . self::PROCESS_OTHER_USER);
135 $this->log->debug(
"outer return: " . $ret);
144 $this->db->manipulate(
145 "UPDATE wiki_user_html_export SET " .
146 " progress = " . $this->db->quote($a_progress,
"integer") .
"," .
147 " status = " . $this->db->quote($a_status,
"integer") .
148 " WHERE wiki_id = " . $this->db->quote($this->wiki->getId(),
"integer") .
149 " AND usr_id = " . $this->db->quote($this->user->getId(),
"integer") .
150 " AND with_comments = " . $this->db->quote($this->with_comments,
"integer")
158 $set = $this->db->query(
159 "SELECT progress, status FROM wiki_user_html_export " .
160 " WHERE wiki_id = " . $this->db->quote($this->wiki->getId(),
"integer") .
161 " AND with_comments = " . $this->db->quote($this->with_comments,
"integer")
163 $rec = $this->db->fetchAssoc($set);
165 return array(
"progress" => (
int) $rec[
"progress"],
"status" => (
int) $rec[
"status"]);
177 ignore_user_abort(
true);
180 if (!$this->with_comments) {
181 $exp->setMode(WikiHtmlExport::MODE_USER);
183 $exp->setMode(WikiHtmlExport::MODE_USER_COMMENTS);
185 $exp->buildExportFile();
194 if ($this->with_comments) {
195 $exp->setMode(WikiHtmlExport::MODE_USER_COMMENTS);
197 $exp->setMode(WikiHtmlExport::MODE_USER);
199 $file = $exp->getUserExportFile();
200 return is_file($file);
205 $this->log->debug(
"deliver");
208 if ($this->with_comments) {
209 $exp->setMode(WikiHtmlExport::MODE_USER_COMMENTS);
211 $exp->setMode(WikiHtmlExport::MODE_USER);
213 $file = $exp->getUserExportFile();
214 $this->log->debug(
"file: " . $file);
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.
static deliverFileLegacy(string $a_file, ?string $a_filename=null, ?string $a_mime=null, ?bool $isInline=false, ?bool $removeAfterDelivery=false, ?bool $a_exit_after=true)
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.
exit
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...