19 declare(strict_types=1);
31 protected \ilDBInterface
$db;
43 $and = in_array($lang, [
"",
"-"])
45 :
" AND lang = " . $this->db->
quote($lang,
"text");
46 $query =
"DELETE FROM il_wiki_page" .
47 " WHERE id = " . $this->db->quote(
$id,
"integer") .
49 $this->db->manipulate($query);
54 return $this->data->page(
56 (
int) $rec[
"wiki_id"],
59 (
bool) $rec[
"blocked"],
60 (
bool) $rec[
"rating"],
61 (
bool) $rec[
"hide_adv_md"]
67 return $this->data->pageInfo(
71 (
int) ($rec[
"last_change_user"] ?? 0),
72 $rec[
"last_change"] ??
"",
73 (
int) ($rec[
"create_user"] ?? 0),
74 $rec[
"created"] ??
"",
75 (
int) ($rec[
"cnt"] ?? 0),
76 (
int) ($rec[
"nr"] ?? 0)
85 $set = $this->db->queryF(
86 "SELECT * FROM il_wiki_page " .
87 " WHERE lang = %s AND wiki_id = %s ORDER BY title",
88 [
"string",
"integer"],
91 while ($rec = $this->db->fetchAssoc($set)) {
101 $set = $this->db->queryF(
102 "SELECT w1.* FROM il_wiki_page w1 LEFT JOIN il_wiki_page w2 " .
103 " ON w1.id = w2.id AND w2.lang = %s " .
104 " WHERE w1.lang = %s AND w1.wiki_id = %s AND w2.id IS NULL ORDER BY w1.title",
105 [
"string",
"string",
"integer"],
106 [$trans,
"-", $wiki_id]
108 while ($rec = $this->db->fetchAssoc($set)) {
119 $set = $this->db->queryF(
120 "SELECT w.id, p.last_change_user, p.last_change, w.title " .
"FROM page_object p JOIN il_wiki_page w " .
121 " ON (w.wiki_id = %s AND p.parent_type = %s AND p.page_id = w.id AND w.lang = %s) " .
122 " JOIN ( select page_id, max(last_change) mlc FROM page_object " .
123 " WHERE parent_type='wpg' group by page_id) mp " .
124 " ON (mp.page_id = p.page_id AND mp.mlc = p.last_change)",
125 [
"integer",
"string",
"string"],
126 [$wiki_id,
"wpg",
"-"]
129 while ($rec = $this->db->fetchAssoc($set)) {
132 if (isset($ids[(
int) $rec[
"id"]])) {
135 $ids[(
int) $rec[
"id"]] = (
int) $rec[
"id"];
142 $query =
"SELECT wp.id, p.last_change_user, p.last_change, wp.title, wp.lang " .
143 " FROM il_wiki_page wp JOIN page_object p " .
144 " ON (wp.id = p.page_id AND wp.lang = p.lang) " .
145 " WHERE " . $this->db->in(
"wp.id", $ids,
false,
"integer") .
146 " AND p.parent_type = " . $this->db->quote(
"wpg",
"text") .
147 " AND wp.wiki_id = " . $this->db->quote($wiki_id,
"integer") .
148 " AND wp.lang = " . $this->db->quote($lang,
"text") .
150 $set = $this->db->query($query);
152 while ($rec = $this->db->fetchAssoc($set)) {
165 $limit_ts = date(
'Y-m-d H:i:s', time() - ($period * 24 * 60 * 60));
166 $q1 =
"SELECT w.id, p.last_change_user, p.last_change, w.title, w.lang, 0 nr FROM page_object p " .
167 " JOIN il_wiki_page w ON (w.id = p.page_id AND p.parent_type = %s AND w.lang = p.lang AND w.wiki_id = %s) " .
168 " WHERE p.last_change >= " . $this->db->quote($limit_ts,
"timestamp");
169 $q2 =
"SELECT w.id, p.user_id last_change_user, p.hdate last_change, w.title, w.lang, p.nr FROM page_history p " .
170 " JOIN il_wiki_page w ON (w.id = p.page_id AND p.parent_type = %s AND w.lang = p.lang AND w.wiki_id = %s) " .
171 " WHERE p.hdate >= " . $this->db->quote($limit_ts,
"timestamp");
172 $q = $q1 .
" UNION " . $q2 .
" ORDER BY last_change DESC ";
173 $set = $this->db->queryF(
175 [
"string",
"integer",
"string",
"integer"],
176 [
"wpg", $wiki_id,
"wpg", $wiki_id]
178 while ($rec = $this->db->fetchAssoc($set)) {
188 $set = $this->db->queryF(
189 "SELECT w.id, p.created, p.create_user, w.title, w.lang FROM page_object p " .
190 " JOIN il_wiki_page w " .
191 " ON w.id = p.page_id AND p.parent_type = %s AND w.lang = p.lang AND w.wiki_id = %s " .
192 " ORDER BY created DESC",
193 [
"string",
"integer"],
196 while ($rec = $this->db->fetchAssoc($set)) {
208 $query =
"SELECT wp.id, wp.title, wp.lang, po.view_cnt as cnt FROM il_wiki_page wp JOIN page_object po" .
209 " ON (wp.id = po.page_id AND wp.lang = po.lang) " .
210 " WHERE wp.wiki_id = " . $this->db->quote($a_wiki_id,
"integer") .
211 " AND po.parent_type = " . $this->db->quote(
"wpg",
"text") .
" " .
212 " ORDER BY po.view_cnt";
213 $set = $this->db->query($query);
215 while ($rec = $this->db->fetchAssoc($set)) {
225 $set = $this->db->queryF(
226 "SELECT DISTINCT lang FROM " .
227 " il_wiki_page WHERE id = %s AND lang <> '-' ",
232 while ($rec = $this->db->fetchAssoc($set)) {
233 $langs[] = $rec[
"lang"];
241 $query =
"SELECT count(*) cnt FROM il_wiki_page" .
242 " WHERE " . $this->db->in(
"id", $ids,
false,
"integer") .
243 " AND wiki_id = " . $this->db->quote($wiki_id,
"integer") .
245 $set = $this->db->query($query);
246 $rec = $this->db->fetchAssoc($set);
247 return ((
int) $rec[
"cnt"]) > 0;
260 $query =
"SELECT w.id FROM il_wiki_page w " .
261 " JOIN page_object p ON (w.id = p.page_id AND w.lang = p.lang) " .
262 " WHERE w.wiki_id = " . $this->db->quote($wiki_id,
"integer") .
263 " AND w.title = " . $this->db->quote($title,
"text") .
264 " AND w.lang = " . $this->db->quote($lang,
"text");
265 $set = $this->db->query($query);
266 if ($rec = $this->db->fetchAssoc($set)) {
267 return (
int) $rec[
"id"];
292 $query =
"SELECT w.id FROM il_wiki_page w " .
293 " JOIN page_object p ON (w.id = p.page_id AND w.lang = p.lang) " .
294 " WHERE w.id = " . $this->db->quote($id,
"integer") .
295 " AND w.lang = " . $this->db->quote($lang,
"text");
296 $set = $this->db->query($query);
297 if ($rec = $this->db->fetchAssoc($set)) {
310 $query =
"SELECT title FROM il_wiki_page " .
311 " WHERE id = " . $this->db->quote($id,
"integer") .
312 " AND lang = " . $this->db->quote($lang,
"text");
313 $set = $this->db->query($query);
314 if ($rec = $this->db->fetchAssoc($set)) {
315 return $rec[
"title"];
323 $query =
"SELECT wiki_id FROM il_wiki_page" .
324 " WHERE id = " . $this->db->quote($id,
"integer") .
325 " AND lang = " . $this->db->quote(
'-',
"text");
326 $set = $this->db->query($query);
327 if ($rec = $this->db->fetchAssoc($set)) {
328 return (
int) $rec[
"wiki_id"];
Wiki internal data service.
getPopularPages(int $a_wiki_id)
existsByTitle(int $wiki_id, string $title, string $lang="-")
getTitle(int $id, string $lang="-")
getWikiPages(int $wiki_id, string $lang="-")
getLanguages(int $wpg_id)
quote($value, string $type)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getPageInfoFromRecord(array $rec)
InternalDataService $data
getPageFromRecord(array $rec)
getNewPages(int $wiki_id)
__construct(InternalDataService $data, \ilDBInterface $db)
getRecentChanges(int $wiki_id, int $period=30)
Queries last change and user per page regardless of language.
static makeDbTitle(string $a_par)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
exists(int $id, string $lang="-")
getPageIdForTitle(int $wiki_id, string $title, string $lang="-")
getAllPagesInfo(int $wiki_id)
Queries last change and user per page regardless of language.
getInfoOfSelected($wiki_id, array $ids, $lang="-")
doesAtLeastOnePageExist(int $wiki_id, array $ids)
getMasterPagesWithoutTranslation(int $wiki_id, string $trans)
getWikiIdByPageId(int $id)