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) {
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() .
100 ", ts: " . $ts .
", with_comments: " . $this->with_comments);
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() .
112 ", ts: " . $ts .
", with_comments: " . $this->with_comments);
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()) {
129 $this->log->debug(
"return: " . self::PROCESS_STARTED);
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"]);
176 echo $this->getProcess();
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();
192 $this->updateStatus(100, self::NOT_RUNNING);
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();
Wiki HTML exporter class.
static getLogger(string $a_component_id)
Get component logger.
Component logger with individual log levels by component id.
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.
static now()
Return current timestamp in Y-m-d H:i:s format.
Class manages user html export.
updateStatus(int $a_progress, int $a_status)
__construct(ilObjWiki $a_wiki, ilDBInterface $a_db, ilObjUser $a_user, bool $with_comments=false)
ILIAS components Export HTML ExportFileManager $html_export_file_manager