5 use \ILIAS\Wiki\Export\WikiHtmlExport;
58 $this->wiki = $a_wiki;
59 $this->
user = $a_user;
63 $this->log->debug(
"comments: " . $this->with_comments);
74 $set = $this->db->query(
75 "SELECT * FROM wiki_user_html_export " .
76 " WHERE wiki_id = " . $this->db->quote($this->wiki->getId(),
"integer") .
77 " AND with_comments = " . $this->db->quote($this->with_comments,
"integer")
79 if (!$this->data = $this->db->fetchAssoc($set)) {
80 $this->data = array();
92 $this->log->debug(
"getProcess");
96 $ilAtomQuery = $this->db->buildAtomQuery();
97 $ilAtomQuery->addTableLock(
'wiki_user_html_export');
100 $this->log->debug(
"atom query start");
105 if ($this->data[
"start_ts"] !=
"" &&
106 $this->data[
"start_ts"] > $last_change) {
108 $ret = self::PROCESS_UPTODATE;
109 $this->log->debug(
"return: " . self::PROCESS_UPTODATE);
114 if (!isset($this->data[
"wiki_id"])) {
115 $this->log->debug(
"insert, wiki id: " . $this->wiki->getId() .
", user id: " . $this->
user->getId() .
117 $ilDB->
manipulate(
"INSERT INTO wiki_user_html_export " .
118 "(wiki_id, usr_id, progress, start_ts, status, with_comments) VALUES (" .
119 $ilDB->
quote($this->wiki->getId(),
"integer") .
"," .
120 $ilDB->
quote($this->user->getId(),
"integer") .
"," .
121 $ilDB->
quote(0,
"integer") .
"," .
122 $ilDB->
quote($ts,
"timestamp") .
"," .
123 $ilDB->
quote(self::RUNNING,
"integer") .
"," .
124 $ilDB->
quote($this->with_comments,
"integer") .
127 $this->log->debug(
"update, wiki id: " . $this->wiki->getId() .
", user id: " . $this->
user->getId() .
130 "UPDATE wiki_user_html_export SET " .
131 " start_ts = " . $ilDB->
quote($ts,
"timestamp") .
"," .
132 " usr_id = " . $ilDB->
quote($this->
user->getId(),
"integer") .
"," .
133 " progress = " . $ilDB->
quote(0,
"integer") .
"," .
134 " status = " . $ilDB->
quote(self::RUNNING,
"integer") .
135 " WHERE status = " . $ilDB->
quote(self::NOT_RUNNING,
"integer") .
136 " AND wiki_id = " . $ilDB->
quote($this->wiki->getId(),
"integer") .
137 " AND with_comments = " . $ilDB->
quote($this->with_comments,
"integer")
142 if ($this->data[
"start_ts"] == $ts && $this->data[
"usr_id"] == $this->
user->getId()) {
144 $ret = self::PROCESS_STARTED;
145 $this->log->debug(
"return: " . self::PROCESS_STARTED);
150 $ret = self::PROCESS_OTHER_USER;
151 $this->log->debug(
"return: " . self::PROCESS_OTHER_USER);
156 $this->log->debug(
"outer return: " .
$ret);
169 $this->db->manipulate(
170 "UPDATE wiki_user_html_export SET " .
171 " progress = " . $this->db->quote((
int) $a_progress,
"integer") .
"," .
172 " status = " . $this->db->quote((
int) $a_status,
"integer") .
173 " WHERE wiki_id = " . $this->db->quote($this->wiki->getId(),
"integer") .
174 " AND usr_id = " . $this->db->quote($this->user->getId(),
"integer") .
175 " AND with_comments = " . $this->db->quote($this->with_comments,
"integer")
189 $set = $this->db->query(
190 "SELECT progress, status FROM wiki_user_html_export " .
191 " WHERE wiki_id = " . $this->db->quote($this->wiki->getId(),
"integer") .
192 " AND with_comments = " . $this->db->quote($this->with_comments,
"integer")
194 $rec = $this->db->fetchAssoc($set);
196 return array(
"progress" => (
int) $rec[
"progress"],
"status" => (
int) $rec[
"status"]);
218 ignore_user_abort(
true);
221 if (!$this->with_comments) {
222 $exp->setMode(WikiHtmlExport::MODE_USER);
224 $exp->setMode(WikiHtmlExport::MODE_USER_COMMENTS);
226 $exp->buildExportFile();
238 if ($this->with_comments) {
239 $exp->setMode(WikiHtmlExport::MODE_USER_COMMENTS);
241 $exp->setMode(WikiHtmlExport::MODE_USER);
243 $file = $exp->getUserExportFile();
244 return is_file($file);
252 $this->log->debug(
"deliver");
255 if ($this->with_comments) {
256 $exp->setMode(WikiHtmlExport::MODE_USER_COMMENTS);
258 $exp->setMode(WikiHtmlExport::MODE_USER);
260 $file = $exp->getUserExportFile();
261 $this->log->debug(
"file: " . $file);
__construct(ilObjWiki $a_wiki, ilDBInterface $a_db, ilObjUser $a_user, $with_comments=false)
Construct.
updateStatus($a_progress, $a_status)
Update status.
doesFileExist()
Does file exist?
deliverFile()
Deliver file.
initUserHTMLExport()
Init user html export.
Wiki HTML exporter class.
static getLastChangeByParent($a_parent_type, $a_parent_id, $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.
getProgress()
Get Progress.
startUserHTMLExport()
Start user html export.
static getLogger($a_component_id)
Get component logger.
manipulate($query)
Run a (write) Query on the database.
static deliverFile( $a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.