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

Small fixes/additions #524

Merged
merged 10 commits into from Oct 14, 2018

Conversation

Projects
None yet
2 participants
@bls1999
Contributor

bls1999 commented Sep 3, 2018

Fixes:

  • Fix guest login not working when returning from the level editor (#530)
  • Stop 2 headers from appearing on an error in /contests/award_prize.php
  • Add a header on success in /admin/contests/add_prize.php
  • Fix fatal error when awarding prizes to accounts that don't have entries in pr2, epic_upgrades, or both* (a DB query is needed to complete this. see below)

Additions:

  • Add a link to add another prize on success in /contests/award_prize.php
  • Userify the HH deactivated message (socket server)
  • Userify the perk activated messages (socket server)
  • Add a tiny botting check, as discussed in this comment (socket server)

*= run this query on the database (changes the default value for part fields in epic_upgrades from NULL to empty):

ALTER TABLE `epic_upgrades` 
  CHANGE `epic_hats` `epic_hats` VARCHAR(110) CHARACTER SET latin1 COLLATE 
  latin1_swedish_ci NOT NULL DEFAULT '', 
  CHANGE `epic_heads` `epic_heads` VARCHAR(110) CHARACTER SET latin1 COLLATE 
  latin1_swedish_ci NOT NULL DEFAULT '', 
  CHANGE `epic_bodies` `epic_bodies` VARCHAR(110) CHARACTER SET latin1 COLLATE 
  latin1_swedish_ci NOT NULL DEFAULT '', 
  CHANGE `epic_feet` `epic_feet` VARCHAR(110) CHARACTER SET latin1 COLLATE 
  latin1_swedish_ci NOT NULL DEFAULT ''; 

Also, it would be great if you could run this query as well:

ALTER TABLE `recent_logins`
ADD INDEX(`user_id`);

This should significantly decrease database load when calling data from that table.

bls1999 added some commits Sep 3, 2018

fix header issue
also adds link to award another prize
fix cosmetic error on admin/add_prize.php
Adds a header on success
fix no pr2/epart data when awarding prize
Allow prizes to be awarded to people who don't have entries in the pr2 or epic_upgrades tables in the db. This shouldn't be an issue too often, since most of the contests that award prizes award them to active users; however, for a contest like CotM which can award prizes to inactive level makers, this will stop an error from showing.
@bls1999

This comment has been minimized.

Contributor

bls1999 commented Sep 3, 2018

Travis Status for this branch (idk why it isn't showing on its own): Build Status

bls1999 added some commits Sep 3, 2018

@bls1999 bls1999 changed the title Fix misc errors (cosmetic, small) Small fixes/additions Sep 3, 2018

@bls1999 bls1999 referenced this pull request Sep 3, 2018

Open

Fast botting prevention #285

bls1999 added some commits Sep 3, 2018

@jacob-grahn

This comment has been minimized.

Owner

jacob-grahn commented Oct 14, 2018

mysql> ALTER TABLE `epic_upgrades` 
    ->   CHANGE `epic_hats` `epic_hats` VARCHAR(110) CHARACTER SET latin1 COLLATE 
    ->   latin1_swedish_ci NOT NULL DEFAULT '', 
    ->   CHANGE `epic_heads` `epic_heads` VARCHAR(110) CHARACTER SET latin1 COLLATE 
    ->   latin1_swedish_ci NOT NULL DEFAULT '', 
    ->   CHANGE `epic_bodies` `epic_bodies` VARCHAR(110) CHARACTER SET latin1 COLLATE 
    ->   latin1_swedish_ci NOT NULL DEFAULT '', 
    ->   CHANGE `epic_feet` `epic_feet` VARCHAR(110) CHARACTER SET latin1 COLLATE 
    ->   latin1_swedish_ci NOT NULL DEFAULT ''; 
Query OK, 266324 rows affected (0.60 sec)
Records: 266324  Duplicates: 0  Warnings: 0
@jacob-grahn

This comment has been minimized.

Owner

jacob-grahn commented Oct 14, 2018

I'm concerned that an index on the recent_logins table would eat up more memory than the db has.

mysql> select count(*) from recent_logins;
+----------+
| count(*) |
+----------+
| 11099298 |
+----------+

Ug...

@jacob-grahn jacob-grahn merged commit 2d1dd48 into jacob-grahn:master Oct 14, 2018

@bls1999

This comment has been minimized.

Contributor

bls1999 commented Oct 14, 2018

@jacob-grahn would it take any more memory than having both the friends and ignored tables indexed on both columns? You definitely know more about this stuff than I do, but I'm wondering, realistically, how much load it'll really add.

@bls1999 bls1999 deleted the bls1999:sept2-fixes branch Oct 14, 2018

@jacob-grahn

This comment has been minimized.

Owner

jacob-grahn commented Oct 14, 2018

mysql> select count(*) from friends;
+----------+
| count(*) |
+----------+
|  2921551 |
+----------+
1 row in set (0.00 sec)

mysql> select count(*) from ignored;
+----------+
| count(*) |
+----------+
|   362734 |
+----------+

There are quite a few rows in friends, I'll see if there's some way to tell how much memory it's using

@jacob-grahn

This comment has been minimized.

Owner

jacob-grahn commented Oct 14, 2018

Well, I was hoping there would be some easy mysql command to figure that out. Several seconds of googling hasn't revealed an answer, so I'm going to bed for the night!

@bls1999

This comment has been minimized.

Contributor

bls1999 commented Oct 14, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment