Lines Matching refs:page

71      * Fills the page index with all unknown pages from the fulltext index
76 $pages = idx_getIndex('page', '');
77 $sql = "INSERT OR IGNORE INTO pages (page, lastmod) VALUES (?,?)";
80 foreach ($pages as $page) {
81 $page = trim($page);
82 $lastmod = @filemtime(wikiFN($page));
85 $this->db->exec($sql, [$page, $lastmod]);
96 * Check if the given pattern matches the given page
99 * @param string $page the cleaned pageid to check
102 public function matchPagePattern($pattern, $page)
108 return (bool)preg_match($pattern, ":$page");
111 $pns = ':' . getNS($page) . ':';
124 } elseif (cleanID($pattern) == $page) {
162 * Delete a page
166 * @param string $page Page ID
168 public function removePage($page)
170 $sql = "DELETE FROM pages WHERE page = ?";
171 $this->db->exec($sql, $page);
175 * Update last modified date of page if content has changed
177 * @param string $page Page ID
180 public function storePageDate($page, $lastmod, $newContent)
182 $changelog = new PageChangeLog($page);
186 $oldContent = str_replace(NL, '', io_readFile(wikiFN($page, $revs[0])));
190 $sql = "REPLACE INTO pages (page, lastmod) VALUES (?,?)";
191 $this->db->exec($sql, [$page, $lastmod]);
198 * Clears direct assignments for a page
200 * @param string $page Page ID
202 public function clearPageAssignments($page)
204 $sql = "UPDATE assignments SET pageassignees = '' WHERE page = ?";
205 $this->db->exec($sql, $page);
209 * Set assignees for a given page as manually specified
211 * @param string $page Page ID
215 public function setPageAssignees($page, $assignees)
219 $sql = "REPLACE INTO assignments ('page', 'pageassignees') VALUES (?,?)";
220 $this->db->exec($sql, [$page, $assignees]);
224 * Set assignees for a given page from the patterns
225 * @param string $page Page ID
227 public function setAutoAssignees($page)
234 // find all patterns that match the page and add the configured assignees
236 if ($this->matchPagePattern($pattern, $page)) {
245 $sql = "REPLACE INTO assignments ('page', 'autoassignees') VALUES (?,?)";
246 $this->db->exec($sql, [$page, $assignees]);
250 * Is the given user one of the assignees for this page
252 * @param string $page Page ID
257 public function isUserAssigned($page, $user, $groups)
259 $sql = "SELECT pageassignees,autoassignees FROM assignments WHERE page = ?";
260 $record = $this->db->queryRecord($sql, $page);
267 * Fetch all assignments for a given user, with additional page information,
279 $sql = "SELECT A.page, A.pageassignees, A.autoassignees, B.lastmod, C.user, C.ack FROM assignments A
281 ON A.page = B.page
283 ON A.page = C.page AND ( (C.user = ? AND C.ack > B.lastmod) )
294 * Resolve names of users assigned to a given page
298 * @param string $page
301 public function getPageAssignees($page)
308 WHERE page = ?";
309 $assignments = $this->db->queryValue($sql, $page);
373 foreach ($affectedPages as $page) {
374 if (isset($pages[$page])) {
375 $pages[$page] .= ',' . $assignees;
377 $pages[$page] = $assignees;
382 $sql = "INSERT INTO assignments (page, autoassignees) VALUES (?, ?)
383 ON CONFLICT(page)
385 foreach ($pages as $page => $assignees) {
388 $this->db->exec($sql, [$page, $assignees, $assignees]);
405 $sql = "SELECT page FROM pages WHERE MATCHES_PAGE_PATTERN(?, page)";
408 return array_column($pages, 'page');
415 * Has the given user acknowledged the given page?
417 * @param string $page
421 public function hasUserAcknowledged($page, $user)
425 WHERE A.page = B.page
426 AND A.page = ?
430 $acktime = $this->db->queryValue($sql, $page, $user);
436 * Timestamp of the latest acknowledgment of the given page
439 * @param string $page
443 public function getLatestUserAcknowledgement($page, $user)
447 WHERE page = ?
450 return $this->db->queryValue($sql, [$page, $user]);
454 * Save user's acknowledgement for a given page
456 * @param string $page
460 public function saveAcknowledgement($page, $user)
462 $sql = "INSERT INTO acks (page, user, ack) VALUES (?,?, strftime('%s','now'))";
464 $this->db->exec($sql, $page, $user);
483 $sql = "SELECT A.page, A.pageassignees, A.autoassignees, B.lastmod, C.user, MAX(C.ack) AS ack
486 ON A.page = B.page
488 ON A.page = C.page AND C.user = ?
490 GROUP BY A.page";
493 ORDER BY A.page";
499 * Get ack status for all assigned users of a given page
503 * @param string $page
510 public function getPageAcknowledgements($page, $user = '', $status = '', $max = 0)
514 $params[] = $page;
522 $users = $this->getPageAssignees($page);
531 $sql = "SELECT A.page, A.lastmod, B.user, MAX(B.ack) AS ack
534 ON A.page = B.page
536 WHERE A.page = ? $userClause $filterClause";
537 $sql .= " GROUP BY A.page, B.user ";
546 // there should be at least one result, unless the page is unknown
550 'page' => $acknowledgements[0]['page'],
556 // fill up the result with all users that never acknowledged the page
591 SELECT A.page, A.user, B.lastmod, max(A.ack) AS ack
593 WHERE A.page = B.page
594 GROUP BY A.user, A.page