• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Daily Thread Actions 2016-05-10

No permission to download
Do stuff to threads, eg. closing based on age, moving based on OP group, and many more
#1
sheel submitted a new resource:

Daily Thread Actions - Do stuff to threads, eg. closing based on age, moving based on OP group, and many more

Purpose

Based on one or more custom textual rules, this plugin searches threads by criteria like
  • Forum ID
  • Locked/open state
  • Sticky state
  • Soft-deletion state
  • Thread prefix
  • Age of last post in days
  • OP user groups
  • OP user ID
  • and/or arbitrary combinations
and then, once a day,
  • moves them to another forum
  • lock/unlock them
  • stick/unstick them
  • soft-delete/undelete them
  • assigns another prefix to them
  • and/or arbitrary...
Read more about this resource...
 

otto

Well-known member
#2
Hello,

nice idea - but I think it would be great when you code a log to easy redo wrong going changes. Or a automatic DB backup of the changed tables every time bevore the tool run?
 
#5
@otto
Doing DB backups from an XF Plugin with PHP would introduce a boatload of problems. Storage engine and DB locks, File permissions, DB permissions, PHP timeouts, etc.etc.etc. Sorry, I can't spend years to reimplement eg. PHPmyAdmin. (And, to start with, any sane admin should make proper backups (with existing tools) anyways.)
 
#6
This sounds very interesting for use in "For Sale Forums" where we have posting permissions based on usergroups and paid subscriptions - if someone's subscription expires, their posting is locked / deleted. Automated locking of old posts in those forums.
 

ENF

Well-known member
#7
Hello,

I was taking a look at this as an option to manage some forums on a time basis. However, no matter what rule I put in place, the log file during testing always has the same result. I used your sample code as well as tried to write a few of my own, but this is the same result below each time..

Code:
Thu, 24 Nov 16 15:51:26 +0000

RULES

Array
(
)


ACTIONS

ERROR IN LINE 1
Any thoughts?
 

ENF

Well-known member
#9
Could you show your current rules?
Thanks for your reply.

The below rule is the one that I've been working on to get working:

Code:
32 # >7 # 42
The way I read your examples, that should move any threads from forum #32 to #42 if the last post was greater than 7 days ago.
There doesn't need to be any action such as stick, lock or prefixes in this case.

Thanks!
 

ENF

Well-known member
#11
Hm. And node 32 and 42 really exist?
Absolutely. We actually have nodes 1 to 55 that are all valid.
The target nodes are normal, public nodes that don't require any special permission. (except a valid forum account)

If it matters.. we're on 1.5.11.. and actually, I will try this again later tonight on a fresh copy of our main site to make sure there weren't any possible conflicts. (first install was done on a test site with identical content of the main site)
 
#14
If you want, try the attached file instead of the original RuleAction.php. When it runs (start the cronjob in XF manually) it creates a file problem.log with some additional informations Post this here then.
 

Attachments

ENF

Well-known member
#15
If you want, try the attached file instead of the original RuleAction.php. When it runs (start the cronjob in XF manually) it creates a file problem.log with some additional informations Post this here then.
Thank you, will give a shot.
 

ENF

Well-known member
#16
If you want, try the attached file instead of the original RuleAction.php. When it runs (start the cronjob in XF manually) it creates a file problem.log with some additional informations Post this here then.
Just quickly ran this and the problem.log file has this content:

Code:
mark1
32 # >7 # 42
mark2
mark3
mark4
mark5
I will have more results from my own conflict tests a little later today.
 

ENF

Well-known member
#18
Thanks... ran that and this what the output was in the problem.log:

Code:
mark6
mark7 53 
mark8
forid array (
  0 => 37,
  1 => 38,
  2 => 35,
  3 => 34,
  4 => 30,
  5 => 33,
  6 => 39,
  7 => 40,
  8 => 51,
  9 => 52,
  10 => 49,
  11 => 48,
  12 => 43,
  13 => 47,
  14 => 29,
  15 => 28,
  16 => 13,
  17 => 14,
  18 => 12,
  19 => 8,
  20 => 3,
  21 => 6,
  22 => 15,
  23 => 18,
  24 => 25,
  25 => 26,
  26 => 24,
  27 => 23,
  28 => 19,
  29 => 21,
  30 => 2,
)prefid array (
  0 => 0,
  1 => 29,
  2 => 30,
  3 => 31,
  4 => 32,
  5 => 28,
  6 => 27,
  7 => 23,
  8 => 24,
  9 => 25,
  10 => 26,
  11 => 33,
  12 => 34,
  13 => 40,
  14 => 41,
  15 => 42,
  16 => 15,
  17 => 39,
  18 => 38,
  19 => 35,
  20 => 36,
  21 => 37,
  22 => 22,
  23 => 21,
  24 => 4,
  25 => 5,
  26 => 6,
  27 => 8,
  28 => 3,
  29 => 44,
  30 => 7,
  31 => 43,
  32 => 2,
  33 => 9,
  34 => 10,
  35 => 17,
  36 => 18,
  37 => 19,
  38 => 20,
  39 => 16,
  40 => 14,
  41 => 11,
  42 => 12,
  43 => 13,
  44 => 1,
)
I tried a different set that time:

Rules:
29 # >7 # 53
 
#19
As you said before, the old rule "32 # >7 # 42" moves the selected thread to forum 42.
Similar to that, the new rule moves to 53.

But you have no forum 42 and/or 53...

See the "forid array" part in the output. The numbers on the right side (37, 38, 35, ...) are all forum IDs you have.

( :D )

...

About cleaning up: I suggest using the original unmodifed RuleAction.php again. In theory, it's no problem to keep the current one, it's just that each time it runs it will add more lines to problem.log