53 $this->wiki = $a_wiki;
54 $this->
user = $a_user;
67 $set = $this->db->query(
68 "SELECT * FROM wiki_user_html_export " .
69 " WHERE wiki_id = " . $this->db->quote($this->wiki->getId(),
"integer")
71 if (!$this->
data = $this->db->fetchAssoc($set)) {
72 $this->
data = array();
84 $this->log->debug(
"getProcess");
87 $ilAtomQuery = $this->db->buildAtomQuery();
88 $ilAtomQuery->addTableLock(
'wiki_user_html_export');
91 $this->log->debug(
"atom query start");
96 if ($this->
data[
"start_ts"] !=
"" &&
97 $this->
data[
"start_ts"] > $last_change) {
98 $ret = self::PROCESS_UPTODATE;
99 $this->log->debug(
"return: " . self::PROCESS_UPTODATE);
103 if (!isset($this->
data[
"wiki_id"])) {
104 $this->log->debug(
"insert, wiki id: " . $this->wiki->getId() .
", user id: " . $this->
user->getId() .
", ts: " . $ts);
105 $ilDB->
manipulate(
"INSERT INTO wiki_user_html_export " .
106 "(wiki_id, usr_id, progress, start_ts, status) VALUES (" .
107 $ilDB->
quote($this->wiki->getId(),
"integer") .
"," .
108 $ilDB->
quote($this->user->getId(),
"integer") .
"," .
109 $ilDB->
quote(0,
"integer") .
"," .
110 $ilDB->
quote($ts,
"timestamp") .
"," .
111 $ilDB->
quote(self::RUNNING,
"integer") .
114 $this->log->debug(
"update, wiki id: " . $this->wiki->getId() .
", user id: " . $this->
user->getId() .
", ts: " . $ts);
116 "UPDATE wiki_user_html_export SET " .
117 " start_ts = " . $ilDB->
quote($ts,
"timestamp") .
"," .
118 " usr_id = " . $ilDB->
quote($this->
user->getId(),
"integer") .
"," .
119 " progress = " . $ilDB->
quote(0,
"integer") .
"," .
120 " status = " . $ilDB->
quote(self::RUNNING,
"integer") .
121 " WHERE status = " . $ilDB->
quote(self::NOT_RUNNING,
"integer") .
122 " AND wiki_id = " . $ilDB->
quote($this->wiki->getId(),
"integer")
127 if ($this->
data[
"start_ts"] == $ts && $this->
data[
"usr_id"] == $this->
user->getId()) {
129 $ret = self::PROCESS_STARTED;
130 $this->log->debug(
"return: " . self::PROCESS_STARTED);
135 $ret = self::PROCESS_OTHER_USER;
136 $this->log->debug(
"return: " . self::PROCESS_OTHER_USER);
141 $this->log->debug(
"outer return: " .
$ret);
154 $this->db->manipulate(
155 "UPDATE wiki_user_html_export SET " .
156 " progress = " . $this->db->quote((
int) $a_progress,
"integer") .
"," .
157 " status = " . $this->db->quote((
int) $a_status,
"integer") .
158 " WHERE wiki_id = " . $this->db->quote($this->wiki->getId(),
"integer") .
159 " AND usr_id = " . $this->db->quote($this->user->getId(),
"integer")
173 $set = $this->db->query(
174 "SELECT progress, status FROM wiki_user_html_export " .
175 " WHERE wiki_id = " . $this->db->quote($this->wiki->getId(),
"integer")
177 $rec = $this->db->fetchAssoc($set);
179 return array(
"progress" => (
int) $rec[
"progress"],
"status" => (
int) $rec[
"status"]);
201 ignore_user_abort(
true);
203 include_once(
"./Modules/Wiki/classes/class.ilWikiHTMLExport.php");
206 $exp->buildExportFile();
217 $this->log->debug(
"deliver");
218 include_once(
"./Modules/Wiki/classes/class.ilWikiHTMLExport.php");
221 $file = $exp->getUserExportFile();
222 $this->log->debug(
"file: " . $file);
updateStatus($a_progress, $a_status)
Update status.
__construct(ilObjWiki $a_wiki, ilDBInterface $a_db, ilObjUser $a_user)
Construct.
deliverFile()
Deliver file.
initUserHTMLExport()
Init user html export.
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.
Wiki HTML exporter class.
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.