Database refactoring and improving blog comments, blog post history and more
This commit is contained in:
@@ -50,44 +50,44 @@
|
||||
|
||||
$possibilities = [
|
||||
'blogPost' => [
|
||||
'sql' => 'SELECT "blogPost" type, bp.postUrl url, bp.postAuthorID author, bp.postImage image, bt.postTitle title, bt.postDesc content, bp.postPublishDate date
|
||||
FROM blog_posts bp
|
||||
INNER JOIN blog_translations bt ON bt.postID = bp.postID AND bt.language = ?
|
||||
LEFT JOIN blog_content bc ON bc.postID = bp.postID AND bc.isActive = TRUE AND bc.language = ?
|
||||
WHERE (LOWER(bt.postTitle) RLIKE ?
|
||||
OR LOWER(bt.postDesc) RLIKE ?
|
||||
OR LOWER(bc.content) RLIKE ?
|
||||
OR bp.postID IN (SELECT bpt.post_id FROM blog_post_tags bpt WHERE bpt.tag_id IN(SELECT bt.ID FROM blog_tags bt WHERE bt.name RLIKE ? OR LOWER(bt.display_name) RLIKE ?))
|
||||
OR (SELECT username FROM users WHERE ID = bp.postAuthorID) RLIKE ?
|
||||
OR (SELECT display_name FROM blog_categories WHERE ID = bp.postCategoryID) RLIKE ?)
|
||||
AND postState = 1 AND postIsDeleted = FALSE',
|
||||
'attributes' => 'llqqqqqqq'
|
||||
'sql' => 'SELECT "blogPost" type, v.url url, bp.authorID author, bp.image image, v.title title, v.description content, bp.initialRelease date
|
||||
FROM blog_post bp
|
||||
INNER JOIN blog_post_versions v ON v.postID = bp.ID AND v.lang = ? AND active
|
||||
WHERE (LOWER(v.title) RLIKE ?
|
||||
OR LOWER(v.description) RLIKE ?
|
||||
OR LOWER(v.content) RLIKE ?
|
||||
OR bp.ID IN (SELECT bpt.postID FROM blog_post_tags bpt WHERE bpt.tagID IN (SELECT bt.tagID FROM blog_tags bt WHERE (bt.name RLIKE ? OR LOWER(bt.displayname) RLIKE ?) AND lang = ?))
|
||||
OR bp.ID IN (SELECT bpc.postID FROM blog_post_categories bpc WHERE bpc.categoryID IN (SELECT bc.categoryID FROM blog_categories bc WHERE (bc.name RLIKE ? OR LOWER(bc.displayname) RLIKE ?) AND lang = ?))
|
||||
OR (SELECT username FROM users WHERE ID = bp.authorID) RLIKE ?)
|
||||
AND state = 1',
|
||||
'attributes' => 'lqqqqqlqqlq'
|
||||
],
|
||||
'blogCategory' => [
|
||||
'sql' => 'SELECT "blogCategory" type, c.name url, 1 author, null image, c.display_name title, null content, null date
|
||||
'sql' => 'SELECT "blogCategory" type, c.name url, 1 author, null image, c.displayname title, null content, null date
|
||||
FROM blog_categories c
|
||||
WHERE c.name RLIKE ? OR LOWER(c.display_name) RLIKE ?',
|
||||
'attributes' => 'qq'
|
||||
WHERE (c.name RLIKE ? OR LOWER(c.displayname) RLIKE ?) AND lang = ?',
|
||||
'attributes' => 'qql'
|
||||
],
|
||||
'blogTag' => [
|
||||
'sql' => 'SELECT "blogTag" type, t.name url, 1 author, null image, t.display_name title, null content, null date
|
||||
'sql' => 'SELECT "blogTag" type, t.name url, 1 author, null image, t.displayname title, null content, null date
|
||||
FROM blog_tags t
|
||||
WHERE t.name RLIKE ? OR LOWER(t.display_name) RLIKE ?',
|
||||
'attributes' => 'qq'
|
||||
WHERE (t.name RLIKE ? OR LOWER(t.displayname) RLIKE ?) AND lang = ?',
|
||||
'attributes' => 'qql'
|
||||
],
|
||||
'user' => [
|
||||
'sql' => 'SELECT "user" type, u.username url, u.ID author, u.header_image image, u.displayname title, u.about content, u.date_created date
|
||||
'sql' => 'SELECT "user" type, u.username url, u.ID author, s.headerImage image, u.displayname title, s.about content, u.dateCreated date
|
||||
FROM users u
|
||||
INNER JOIN user_settings s ON u.ID = s.ID
|
||||
WHERE (username RLIKE ?
|
||||
OR lower(about) RLIKE ?)
|
||||
AND is_activated AND isDeleted = FALSE',
|
||||
AND activated AND isDeleted = FALSE',
|
||||
'attributes' => 'qq',
|
||||
],
|
||||
'userPost' => [
|
||||
'sql' => 'SELECT "userPost" type, p.uuid url, p.user_id author, null image, p.content title, null content, p.date date
|
||||
'sql' => 'SELECT "userPost" type, p.hashID url, p.userID author, null image, p.content title, null content, p.date date
|
||||
FROM user_posts p
|
||||
WHERE LOWER(p.content) RLIKE ?
|
||||
OR (SELECT username FROM users WHERE ID = p.user_id) RLIKE ?',
|
||||
OR (SELECT username FROM users WHERE ID = p.userID) RLIKE ?',
|
||||
'attributes' => 'qq',
|
||||
],
|
||||
'project' => [
|
||||
@@ -100,9 +100,9 @@
|
||||
'attributes' => 'lqqq',
|
||||
],
|
||||
'projectCategory' => [
|
||||
'sql' => 'SELECT "projectCategory" type, c.collection url, 1 author, null image, c.displayname title, c.displayname content, null date
|
||||
'sql' => 'SELECT "projectCategory" type, c.name url, 1 author, null image, c.displayname title, c.displayname content, null date
|
||||
FROM projects_categories c
|
||||
WHERE lower(collection) RLIKE ?
|
||||
WHERE name RLIKE ?
|
||||
OR lower(displayname) RLIKE ?',
|
||||
'attributes' => 'qq'
|
||||
],
|
||||
@@ -136,7 +136,6 @@
|
||||
{
|
||||
foreach ($results as $i => $result) {
|
||||
list(
|
||||
'author' => $author,
|
||||
'authorDisplayname' => $displayname,
|
||||
'authorName' => $username,
|
||||
'content' => $content,
|
||||
|
Reference in New Issue
Block a user