2024年04月04日 建站教程
// 自动备份插件 function automatic_backup() { // Backup database $backup_database_command = 'mysqldump -u username -ppassword database_name > backup.sql'; exec($backup_database_command); // Backup files $backup_files_command = 'tar -czf backup_files.tar.gz /var/www/html'; exec($backup_files_command); } // 每日备份 if ( ! wp_next_scheduled( 'automatic_backup_event' ) ) { wp_schedule_event( time(), 'daily', 'automatic_backup_event' ); } add_action( 'automatic_backup_event', 'automatic_backup' );
本文链接:http://so.lmcjl.com/news/1105/