Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Q
question2answer
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
outils
question2answer
Commits
6c5d47da
Commit
6c5d47da
authored
Oct 28, 2014
by
Scott
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #61 from pupi1985/patch-24
Added firing an event before deleting a post
parents
dcd8b3d8
c4fb366b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
16 deletions
+28
-16
qa-app-post-update.php
qa-include/qa-app-post-update.php
+28
-16
No files found.
qa-include/qa-app-post-update.php
View file @
6c5d47da
...
...
@@ -450,6 +450,13 @@
$useridvotes
=
qa_db_uservote_post_get
(
$oldquestion
[
'postid'
]);
$oldpath
=
qa_db_post_get_category_path
(
$oldquestion
[
'postid'
]);
$params
=
array
(
'postid'
=>
$oldquestion
[
'postid'
],
'oldquestion'
=>
$oldquestion
,
);
qa_report_event
(
'q_delete_before'
,
$userid
,
$handle
,
$cookieid
,
$params
);
qa_post_unindex
(
$oldquestion
[
'postid'
]);
qa_db_post_delete
(
$oldquestion
[
'postid'
]);
// also deletes any related voteds due to foreign key cascading
qa_update_counts_for_q
(
null
);
...
...
@@ -460,10 +467,7 @@
qa_db_points_update_ifuser
(
$voteruserid
,
(
$vote
>
0
)
?
'qupvotes'
:
'qdownvotes'
);
// could do this in one query like in qa_db_users_recalc_points() but this will do for now - unlikely to be many votes
qa_report_event
(
'q_delete'
,
$userid
,
$handle
,
$cookieid
,
array
(
'postid'
=>
$oldquestion
[
'postid'
],
'oldquestion'
=>
$oldquestion
,
));
qa_report_event
(
'q_delete'
,
$userid
,
$handle
,
$cookieid
,
$params
);
}
...
...
@@ -696,6 +700,14 @@
$useridvotes
=
qa_db_uservote_post_get
(
$oldanswer
[
'postid'
]);
$params
=
array
(
'postid'
=>
$oldanswer
[
'postid'
],
'parentid'
=>
$oldanswer
[
'parentid'
],
'oldanswer'
=>
$oldanswer
,
);
qa_report_event
(
'a_delete_before'
,
$userid
,
$handle
,
$cookieid
,
$params
);
qa_post_unindex
(
$oldanswer
[
'postid'
]);
qa_db_post_delete
(
$oldanswer
[
'postid'
]);
// also deletes any related voteds due to cascading
...
...
@@ -712,11 +724,7 @@
qa_db_points_update_ifuser
(
$voteruserid
,
(
$vote
>
0
)
?
'aupvotes'
:
'adownvotes'
);
// could do this in one query like in qa_db_users_recalc_points() but this will do for now - unlikely to be many votes
qa_report_event
(
'a_delete'
,
$userid
,
$handle
,
$cookieid
,
array
(
'postid'
=>
$oldanswer
[
'postid'
],
'parentid'
=>
$oldanswer
[
'parentid'
],
'oldanswer'
=>
$oldanswer
,
));
qa_report_event
(
'a_delete'
,
$userid
,
$handle
,
$cookieid
,
$params
);
}
...
...
@@ -1009,18 +1017,22 @@
if
(
$oldcomment
[
'type'
]
!=
'C_HIDDEN'
)
qa_fatal_error
(
'Tried to delete a non-hidden comment'
);
qa_post_unindex
(
$oldcomment
[
'postid'
]);
qa_db_post_delete
(
$oldcomment
[
'postid'
]);
qa_db_points_update_ifuser
(
$oldcomment
[
'userid'
],
array
(
'cposts'
));
qa_db_ccount_update
();
qa_report_event
(
'c_delete'
,
$userid
,
$handle
,
$cookieid
,
array
(
$params
=
array
(
'postid'
=>
$oldcomment
[
'postid'
],
'parentid'
=>
$oldcomment
[
'parentid'
],
'oldcomment'
=>
$oldcomment
,
'parenttype'
=>
$parent
[
'basetype'
],
'questionid'
=>
$question
[
'postid'
],
));
);
qa_report_event
(
'c_delete_before'
,
$userid
,
$handle
,
$cookieid
,
$params
);
qa_post_unindex
(
$oldcomment
[
'postid'
]);
qa_db_post_delete
(
$oldcomment
[
'postid'
]);
qa_db_points_update_ifuser
(
$oldcomment
[
'userid'
],
array
(
'cposts'
));
qa_db_ccount_update
();
qa_report_event
(
'c_delete'
,
$userid
,
$handle
,
$cookieid
,
$params
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment