FoolFuuka/Housekeeping

From Bibliotheca Anonoma

Undelete post[edit]

Deleted posts by moderators are thrown in the deleted table. It is a hassle to grab stuff, but its not gone forever.

  1. Get mysql workbench and login
  2. type in the command SELECT * FROM asagi.a_deleted;
  3. Click that lightning button
  4. The results are the posts. Observe if they are the posts you want.

These commands can be run in mysql console or the mysql workbench

  • Single posts: INSERT INTO `asagi`.`<board>` (SELECT * FROM `asagi`.`<board>_deleted` WHERE doc_id = <doc_id>);
  • Entire thread: INSERT INTO `asagi`.`<board>` (SELECT * FROM `asagi`.`<board>_deleted` WHERE thread_num = <thread_num>);

Delete Ghost Posts by search query[edit]

  • modify /home/atc/delete-by-search-query.php
  • Under the profiler:
    • 27 Start: SphinxQL: SELECT id, board, tnum FROM a_ancient, a_main, a_delta WHERE MATCH('(@comment mado mami)') AND is_internal = 1 ORDER BY timestamp DESC LIMIT 0, 25 OPTION max_matches = 5000, reverse_scan = 1
    • you have no idea how angry it has made us to see the words "mado mami" and their accomplices be spammed on our ghostposts
  • Replace $querymatch with the highlighted portion
    • You can also include AND if there is more to filter by

Deleting by ghost posts by IP range[edit]

Example: 148.74.* (first IP: 148.74.0.0, last IP 148.74.255.255)

  • Search for 1st IP in range in FF - Look at query in Profiler
    • Take the `pip` out
      • Example for 148.74.0.0 - WHERE pip = 2487877632
  • Search for last IP in range
    • Take the `pip` out
      • Example for 148.74.255.255 - WHERE pip = 2487943167
  • Edit /home/atc/delete-by-search-query.php
  • Set $dry = true; to test
  • Comment the line after NORMAL QUERY
  • Uncomment line after IP RANGE
    • Edit PIP numbers. First IP is first, Last IP goes second
  • Test with php /home/atc/delete-by-search-query.php
  • If it looks good, set $dry = false; and run again

Deleting all ghostposts in a thread[edit]

In delete-by-search-query.php:

   $use_specificboard = true;                                                                                                                                   
   $specificboard = 'a';}}
   $querymatch = "tnum = 1234141"; // Delete by thread num

Then run:

   php /home/atc/delete-by-search-query.php


Purging Files[edit]

Local files on the frontend/dumper server are automatically purged on image ban & image delete inside the web console.

Files on CDN2 require more work as they are on a separate server.

Manual Procedure (CDN2)[edit]

   sudo shred /desuzfs/media/desu/k/image/0000/00/0000000000.jpg
   sudo shred /desuzfs/media/desu/k/thumb/0000/00/0000000000s.jpg # note the s, and thumbs are always jpg
   sudo rm /desuzfs/media/desu/k/thumb/0000/00/0000000000s.jpg


(Files on the frontend server are located in /srv/foolfuuka/boards/)


(Purge CloudFlare Cache)

 curl -X DELETE \
   https://api.cloudflare.com/client/v4/zones/YOUR_API_KEY_HERE/purge_cache \
   -H 'cache-control: no-cache' \
   -H 'X-Auth-Email: YOUR_AUTH_EMAIL_HERE' \
   -H 'X-Auth-Key: YOUR_KEY_HERE'\
   -H 'content-type: application/json' \
   --data '{"files":["https://yourdomain.org/k/thumb/0000/00/0000000000s.jpg"]}'

Finally, use automatic purge to clear CloudFlare Cache and there is 24 hours to do this

NEVER CLICK THE IMAGE URL. be very careful of posting it also

only share it in the following form: k/thumb/0000/00/0000000000s.jpg

Frontend Sync Banned Images from FoolFuuka[edit]

There’s a script nas-rem-img.php that lives on the dumper /var/www/foolfuuka

  • Login to CDN2.
  • Run php /home/atc/test.php
  • This will delete banned files from the NAS

This is cron’d to run daily.

Automatic Procedure[edit]

We have a purge.php that not only deletes both thumb and image, but also purges the cloudflare cache.

  • Adding users to purge script: sudo htpasswd /etc/nginx/ssl/htpasswd <username>