• Resolved minterrors

    (@minterrors)


    Hello, I am trying to use updraftplus to back up a server which has worked fine prior to 28Sep24. Now, during the backup, the file Table wp_wffilemods looks like it has stalled the backup process. I like using WordFence, but I need to figure this out. Is there a MYSQL command to check or clear data on this Table wp_wffilemods if it is safe to do so?

    I have another website with the same plugins and that website is backing up fine each week.

    Here is info when the back up is attempted:

    Table wp_wffilemods: Total expected rows (approximate): 132553

    • This topic was modified 1 month ago by minterrors.

    The page I need help with: [log in to see the link]

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Support wfmargaret

    (@wfmargaret)

    Hi @minterrors,

    Thanks for reaching out.

    Check the permissions in your?Wordfence > Tools > Diagnostics?page under “MySQL” which might point to Wordfence having issues running commands during scans or after your Live Traffic’s “Amount of Live Traffic data to store (number of rows)” has been reached.

    You can safely clear tables like?wfknownfilelist?and?wffilemods?as these should be truncated anyway by default whenever a scan starts.

    There’s no set amount of database resources we know Wordfence will use as every use-case is different in terms of users, site pages, installed plugins, etc. The table’s size depends on the number of files on the site. If there are other sites in subdirectories that are also running Wordfence, you can exclude them from this site’s scan to reduce the number of files, which will subsequently reduce the number of rows in the table.

    Thanks,
    Margaret

    Thread Starter minterrors

    (@minterrors)

    @wfmargaret

    Thank you for the reply.

    The only other installation of WordFence is on another domain which is not on a subdirectory, its in a separate folder on the same hard drive.

    Later today I will check the permissions.

    I did see the WordFence IP was being blocked by the local antivirus and that has been fixed.

    What is the MYSQL command to safely clear the wfknownfilelist?and?wffilemods tables? Or is there an option within WordFence iteself?

    Thread Starter minterrors

    (@minterrors)

    The Database permission area was all green.

    A backup warning came up as I attempt another backup. I lowered the amount of rows to keep data to 500(vice 2000) and the number of days to keep to 15 (vice 30 days).

    The warning was:

    Thu, October 17, 2024 15:39

    • Warning: Table wp_wffilemods has very many rows (177180) – we hope your web hosting company gives you enough resources to dump out that table in the backup. If not, you will need to either remove data from this table, or contact your hosting company to request more resources.
    • This reply was modified 1 month ago by minterrors.
    Plugin Support wfmargaret

    (@wfmargaret)

    Hi @minterrors,

    Thanks for following up. Thanks for checking the database permissions. As a temporary fix, if you need to delete the entries from the table before making a backup, a standard MySQL delete query would suffice. If you’re not familiar with removing entries in a database, please reach out to your host for assistance.

    The wffilemods table tracks files on the site and is regenerated when a new scan happens. Rather than clearing out the table every time you take a backup, I recommend reviewing your site’s file structure and excluding any files that don’t need to be scanned. For example, if you use a caching plugin that caches thousands of pages, you might consider excluding the cache from the scan. Once excluded, those files would no longer be tracked in wffilemods, reducing the number of rows in the table.

    You can exclude files in Worfence > Scan > Scan Options and Scheduling > Advanced Scan Options Exclude files from scan that match these wildcard patterns (one per line). You can use wildcards to exclude entire folders, for example, wp-content/cache/*. We have more information on this setting here: https://www.wordfence.com/help/scan/options/#advanced-options

    Once you’ve excluded files, please start a new scan. Once it’s completed, please double-check the number of rows in the table and try taking a backup again. Let me know how it goes!

    Thanks,
    Margaret

    Thread Starter minterrors

    (@minterrors)

    The server is mine and it sits close to my location.

    I am not well versed on MYSQL commands, so I like to make sure what I read on the web is true and accurate.

    so I can Truncate the table and it should do the trick?

    To empty a table file in MySQL, you can use the TRUNCATE TABLE command:

    1. Open your MySQL client
    2. Select the database that contains the table you want to empty:
      • USE database_name;
    3. Truncate the table:
      • TRUNCATE TABLE table_name;
    4. Press Enter to execute the command 

    You can also use the MySQL Command Line Interface (MySQL CLI) to truncate a table:

    1. Open a command prompt or terminal window
    2. Connect to your MySQL server:
      • mysql.exe -u[username] -p
    3. Select the database that contains the table you want to truncate:
      • USE db_name
    4. Truncate the table:
      • TRUNCATE TABLE table_name;
    5. Press Enter to execute the command 
    • This reply was modified 1 month ago by minterrors.
    • This reply was modified 1 month ago by minterrors.
    Plugin Support wfmargaret

    (@wfmargaret)

    Hi @minterrors,

    The TRUNCATE TABLE command would do the trick, as it empties the table completely without removing it. Since you’re not familiar with MySQL, I urge you to make a backup of your database before doing anything, as removing data can cause errors if done incorrectly.

    Please keep in mind this table is regenerated when a scan occurs, and removing the table will prevent Wordfence from properly checking for modified files between scans. If it’s not possible to reduce the amount of scanned files, please check to see if there’s a way to exclude this table’s data from the backup rather than removing it entirely.

    Please let me know if you have any other questions or concerns!

    Thanks,
    Margaret

    Thread Starter minterrors

    (@minterrors)

    @wfmargaret ,

    Thank you very much for all your knowledge and help.

    Apologize for the delay. Its been pretty busy around here with other projects.

    I truncated the two tables, wffilemods and wfknownfilelist. These were over 200K in rows on each table. they grow in size of each Wordfence scan. The backup would then complete without any time out errors. You are correct, the tables have to be cleared prior to each backup.

    Do the wffilemods and wfknownfilelist tables have an approximate maximum size? That seems like a lot of rows…. OR,

    Is there a setting within Wordfence to limit or remove the huge amount of rows via a setting in Wordfence after a scan is complete?

    I will read your advanced options URL above. I hope that helps. It may take me a bit to get that done.

    I do have a caching app on the wordpress environment, but this site isn’t very large.

    I added wp-content/cache/* to the exclusion list. I will also say the path to the exclusion list on this version of windows was under the “all settings” vice Wordfence > Scan > Scan Options and Scheduling > Advanced Scan Options Exclude files from scan.

    I will admit, its pretty easy to truncate these tables prior to a backup but, I am concerned about the number of rows. Over time, this may slow down the server. I moved the backup from weekly to monthly.

    I don’t want to remove WordFence, it does off another layer of protection but if there isn’t a good solution to this, I sadly may have to consider it.

    Plugin Support wfmargaret

    (@wfmargaret)

    Hi @minterrors,

    Thanks for following up. Since your MySQL permissions are normal, the table shouldn’t grow in size after each scan. Please try a few scans in a row to double-check this, and let me know if you see the size doubling each scan or if it remains roughly the same.

    These two tables track the files that are scanned to check for modified files. Please check over your site to see what folders contain a large number of files. It’s possible your cache plugin stores cached files somewhere else, or that the backup plugin may be storing the backup files inside of the site. The easiest way to check this depends on your host, but if you have access to a tool such as phpMyAdmin, you could check the tables themselves to see what files are being tracked.

    Because servers and sites can vary a lot, there is no hard maximum on these tables, as they’re tracking any files that are scanned. I recommend reviewing your site’s structure closely to see what files on the site are being scanned.

    Let me know if you have any questions!

    Thanks,
    Margaret

    Thread Starter minterrors

    (@minterrors)

    @wfmargaret

    Hope your weekend was long and relaxing.

    I have left the server be for a few days busy with other projects.

    I did see the following in the PHP error log:

    PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 2521808 bytes) in (redacted path)\wp-content\wflogs\rules.php on line 5211.

    Plugin Support wfmargaret

    (@wfmargaret)

    Hi @minterrors,

    Thanks, I hope your weekend was long and relaxing as well!

    Regarding the memory error, this error means that the site needed more memory than the maximum amount of memory the site is currently allowed. Please try setting memory_limit to at least 256M in php.ini or .user.ini. Next, ensure WP_MEMORY_LIMIT in wp-config.php is at least 256M to mirror the other change, as similar issues can be caused by timeouts or memory being maxed out during scans or periods of heavy activity on your site.

    Thanks,
    Margaret

Viewing 10 replies - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.