Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Utrs 99 #4

Closed
wants to merge 9 commits into from
Closed

Utrs 99 #4

wants to merge 9 commits into from

Conversation

martijnhoekstra
Copy link
Contributor

script to close UTRS 99.

Prerequisites:

  • Needs a user named SYSTEM in the users database

Actions to actually close UTRS 99:

  • run clean_requests.php periodically. Probably easiest from a daily cronjob

Quite some changes:

Add script (clean_requests.php) to send reminders when an appeal is AWAITING USER for 5 days or more, and to send close notification and close appeal 5 days after the reminder is sent.

Under the hood:

  • moved part of email functionality to appeals object.
  • Made some changes here and there to be able to set the user of log messages, backwards compatible through default values.
  • Change query for 5 last closed requests to be more forgiving, and always fetch 5 last closed requests, even if the lastComment of an appeal doesn't have the exact content 'closed'
  • fix one require_once path in unblocklib

Because the changes are largish, good beta testing is prefered on this patch

@martijnhoekstra
Copy link
Contributor Author

actualy, that's UTRS 101

$firstuserid = "null";
$seconduserid = null;
} else {
$firstuserid = User::getUserByUsername($username)->getUserId();
$seconduserid = User::getUserByUsername($username)->getUserId();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will result in a second SQL query. $seconduserid = $firstuserid; should suffice, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, it should. I considered that, but I went for what was closest to the original. your suggestion was my first thought too, and IMO a lot cleaner

public function sendEmail($bodytemplate, $subject, $admin = false){
$success = false;
try {
if (!$admin){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be if ($admin === false)

@martijnhoekstra
Copy link
Contributor Author

closed again until I have it merged against the current master, because of the PDO transition

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants