DragonPrime - LoGD Resource Community
Welcome Guest
  • Good morning, Guest.
    Please log in, or register.
  • July 25, 2017, 09:30:55 AM
Home Forums News Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Login
 
 
Resource Pages
Search

Pages: [1]   Go Down
  Print  
Author Topic: Deletion of characters  (Read 3410 times)
0 Members and 1 Guest are viewing this topic.
Aeolus
Mod God
*****
Offline Offline

Posts: 1758


You're welcome.


View Profile WWW
« on: May 22, 2016, 11:07:13 PM »

I'm not sure if there's been a post about this before, but concerning the deletion of characters (specifically those that haven't been logged into), the code doesn't do this properly. It deletes based on one's experience being less than ten, not on whether they've logged into or not. For example, from the expanded SQL commands:

Deleting based on never reaching level 2: (laston < "2016-05-23 00:57:18" AND level=1 AND dragonkills=0)
Deleting based on never logging in: (laston < "2016-05-23 00:57:18" AND level=1 AND experience < 10 AND dragonkills=0)
« Last Edit: May 22, 2016, 11:13:15 PM by Aeolus » Logged

Stephen.Kise
Codemeister
****
Offline Offline

Posts: 359


So meme'd up.


View Profile
« Reply #1 on: May 22, 2016, 11:59:31 PM »

I'm not sure if there's been a post about this before, but concerning the deletion of characters (specifically those that haven't been logged into), the code doesn't do this properly. It deletes based on one's experience being less than ten, not on whether they've logged into or not. For example, from the expanded SQL commands:

Deleting based on never reaching level 2: (laston < "2016-05-23 00:57:18" AND level=1 AND dragonkills=0)
Deleting based on never logging in: (laston < "2016-05-23 00:57:18" AND level=1 AND experience < 10 AND dragonkills=0)

To add clarification this is in lib/expired_chars.php with the $sql1 variable.

 The dates here seem odd, but it is through your settings. I am on mobile, but theoretically the times should be different. The new accounts by default delete after ten days of inactivity, and trash accounts (never logged in) delete after one. Unfortunately whoever wrote that SQL command never thought that people would just make an account to roleplay, and not fight in the forest.

I forget if laston even changes when a character is made, or if it equals the registration date. If the latter is true, that is possibly  the best way to rewrite this issue.
Logged

Currently revamping the core for 7 and bringing back an open source wiki.
Aeolus
Mod God
*****
Offline Offline

Posts: 1758


You're welcome.


View Profile WWW
« Reply #2 on: May 23, 2016, 12:07:28 AM »

To add clarification this is in lib/expired_chars.php with the $sql1 variable.

 The dates here seem odd, but it is through your settings. I am on mobile, but theoretically the times should be different. The new accounts by default delete after ten days of inactivity, and trash accounts (never logged in) delete after one. Unfortunately whoever wrote that SQL command never thought that people would just make an account to roleplay, and not fight in the forest.

I forget if laston even changes when a character is made, or if it equals the registration date. If the latter is true, that is possibly  the best way to rewrite this issue.

Oh, that was just me substituting the occurrences of date() with actual dates, and making them equivalent for comparison between the two parts of the SQL command. Never mind that part. When a character is made, the "laston" value is set to one day before the current time.
« Last Edit: May 23, 2016, 12:12:57 AM by Aeolus » Logged

Stephen.Kise
Codemeister
****
Offline Offline

Posts: 359


So meme'd up.


View Profile
« Reply #3 on: May 23, 2016, 02:56:02 AM »

To add clarification this is in lib/expired_chars.php with the $sql1 variable.

 The dates here seem odd, but it is through your settings. I am on mobile, but theoretically the times should be different. The new accounts by default delete after ten days of inactivity, and trash accounts (never logged in) delete after one. Unfortunately whoever wrote that SQL command never thought that people would just make an account to roleplay, and not fight in the forest.

I forget if laston even changes when a character is made, or if it equals the registration date. If the latter is true, that is possibly  the best way to rewrite this issue.
When a character is made, the "laston" value is set to one day before the current time.

Then we should compare laston to regdate. 'Trash' accounts are those never logged in, so it would make sense to just purge only those specific accounts, after the setting specified date. Below is the proper revision.
OR (laston < \"".date("Y-m-d H:i:s",strtotime("-".($trash+1)." days"))."\" AND laston < regdate)
« Last Edit: May 23, 2016, 02:58:51 AM by Stephen.Kise » Logged

Currently revamping the core for 7 and bringing back an open source wiki.
Aeolus
Mod God
*****
Offline Offline

Posts: 1758


You're welcome.


View Profile WWW
« Reply #4 on: May 23, 2016, 07:15:05 AM »

Then we should compare laston to regdate. 'Trash' accounts are those never logged in, so it would make sense to just purge only those specific accounts, after the setting specified date. Below is the proper revision.
OR (laston < \"".date("Y-m-d H:i:s",strtotime("-".($trash+1)." days"))."\" AND laston < regdate)

Or even simply: OR (regdate < date_add(NOW(),interval -".$trash." day) AND laston < regdate)
Or to match yours: OR (laston < date_add(NOW(),interval -".($trash+1)." day) AND laston < regdate)

There's a MySQL function for adding/subtracting dates, just as PHP has one.
Logged

Pages: [1]   Go Up
  Print  
 
Jump to:  


*
DragonPrime Notices
Please take the time to read the FAQ and browse the DragonPedia

Support Us
No funds raised yet this year
Your help is greatly appreciated!
Recent Topics
DragonPrime LoGD
Who's Online
23 Guests, 0 Users
Home Forums News Downloads Login Register Advanced Search