Crontab Command Word
Check and Process User Main Role Expiration
Perform a user's main role expiration time check every 10 minutes
php
\FresnsCmdWord::plugin('Fresns')->checkUserRoleExpired()- Filter the
user_rolestable for records withtype=2+expired_at less than the current time(less than the current time indicates it has already expired).
- Filter the
- Check if the
restore_role_idfield of the record has a value.
- 2.1. If it has a value, check if the value is already associated with the user:
- 2.1.1. If it is associated: delete the expired record and change the
typefield value of the associated record to2 - 2.1.2. If not associated: delete the expired record, create a new record with the
restore_role_idfield value (role ID), and set thetypefield value to2
- 2.1.1. If it is associated: delete the expired record and change the
- 2.2. If it has no value: terminate the task and do not perform any actions for now.
- Check if the
Check and Handle Account Deletion
Perform a user deletion task every 6 hours
php
\FresnsCmdWord::plugin('Fresns')->checkDeleteAccount()Logical Deletion: Do not delete data, only mark the status
- Add the
deleted#YmdHis#prefix before the existing content of thephone and emailfields in theaccountstable, whereYmdHisis the current time when the task is executed; - Physically delete associated information in the
account_connectstable; - To avoid omissions, the scheduled task checks all users with a value in
accounts->deleted_atin the database each time. If thephone and emailprefix hasdeleted#, it means the task has been executed and will be skipped; otherwise, the task will be executed. - The
delete_account_todokey value in the configuration table specifies the time within which no processing should be performed; for example, if the current task execution time is set to 7 days, do not search (or process) records within 7 days.
Physical Deletion: Physically delete data (actual deletion)
- Delete all records of the user from the following tables
accountsaccount_connectsaccount_walletsaccount_wallet_logssession_tokenssession_logsplugin_badgesusersuser_statsuser_extcredits_logsuser_rolesuser_likesuser_followsuser_blocksfilesAvatarfile_usagesnotificationsseopostspost_logscommentscomment_logs
- To avoid omissions, the scheduled task checks all users with a value in
accounts->deleted_atin the database each time. If they exist, perform physical deletion. - The
delete_account_todokey value in the configuration table specifies the time within which no processing should be performed; for example, if the current task execution time is set to 7 days, do not search (or process) records within 7 days.
Check and Update Version Information
- Perform a backend main program and extension version check every 8 hours to see if there are any new versions available.
php
\FresnsCmdWord::plugin('Fresns')->checkPluginsVersions()- Send the list of installed plugins to the Fresns official, and the interface will return the latest version for the plugins on the list.
- Compare the plugins table version, and if they are different, update the version
is_upgrade = 1upgrade_version = Version returned by the API