Feature preview

Feature Introduction

After supporting two-level wildcard search in the background file search, how to define the scope before batch modification

Since version 3.6.5, the Anqi CMS background file search supports double-layer wildcard, which expands the search range while also increasing the area of misfire. This article provides the process of defining the scope before batch modification: first list the hit list according to wildcard, then narrow down the matching range to the actual directory to be modified, perform single test modification and batch execution through the site-wide replacement tool, and explain what records to keep before and after the modification for rollback

Template Files Background operation

Feature Introduction

Since version v3.6.5, AnQiCMS's backend file search supports **double wildcard, which can search for the target files in the entire directory tree at once. The wider range on the other hand is the increased area of误伤: before making bulk changes to templates or static files, you need to define the scope in a fixed order - first use wildcard to list all matching files, then narrow down the matching conditions to the actual directory to be changed, and finally use the site-wide replacement tool to execute bulk changes; make a backup before starting, leaving a reversible record for yourself.

What does single-level wildcard and double-level wildcard search for?

Single level wildcard matches only within a directory level, same-named files in subdirectories are not included in the results; ** will recursively enter subdirectories of any depth, viewing the entire template tree at once. The search method may differ, resulting in a list size that may differ by an order of magnitude.

Writing form Matching range When to use
Single level wildcard with suffix Only specify files within a single directory level Only want to see the top-level templates
Double level wildcard with suffix Files of the same type within subdirectories of any depth Inventory the entire template tree, estimate the impact of changes
Prefix with double wildcard The directory and all its subdirectories Encircle a whole sub-module

Why list first and then modify

The hit set of ** includes content you can't see: old templates left by historical backups, files uncompressed into the template directory by third-party extensions, and materials with similar names but different uses. Replacing directly on this list means handing over the scope of changes to the wildcard. The value of listing first is to 'look but not touch': confirm whether each hit file belongs to the current change intention, exclude paths that should not appear from the matching conditions, or conversely confirm that they should be changed together.

The three-step process for batch replacement

AnQiCMS's website replacement tool is suitable for batch keyword replacement or link replacement, and whether it works well or not depends on the order. First step, according to the list in the previous section, determine the matching conditions and replacement content, and write down 'which files, what to replace, how many expected hits'. Second step, single-side test modification: first, only execute on one file, open the rendering result to check if the display is normal and the quantity is as expected. Third step, batch execute the remaining files on the list, immediately check the homepage, list page, detail page, and search results page after the modification. Single-side test modification is most likely to be skipped in the three steps, but it is also the most effective in preventing large-scale accidents.

Changes before and after should keep what kind of records

Before the change, leave a record of the backup and recovery in the background: AnQiCMS supports backing up data along with static files, and template files are a separate layer in the recovery granularity, leaving one before and after the change, so that in case of an accident, it can be determined whether to 'return to the change before' or 'return to the change after'. After the change, record this time's matching conditions, hit list, trial modification files, and inspection conclusions in the update log or work order. When performing batch operations next time, this record will be the basis for judgment. The rollback plan should be written specifically: which backup version, and which generated items need to be re-run after recovery, rather than just writing a sentence like 'can be recovered'.

Common questions

How to deal with too many files searched by wildcard?First narrow down instead of stubbornly modifying: add directory prefix to limit the subtree or filter by suffix twice. If you can find but not change it, it means this is not a qualified batch modification range.

How to quickly go back after finding that a template rendering is abnormal?Restore the corresponding content with the backup before the modification, and then re-run the template generation process. Check each item on the page after recovery to confirm that there is no impact on other files.

Will double wildcard search bring up data files that should not be seen?The background file search is aimed at template and static file directories, and the data itself goes through the data layer management. If temporary files are mixed in the directory planning, clean up the directory structure first and then rely on the wildcard results.

Related functions

Preview

The form on the station receives human verification, without popping up images, only deciding whether to check the checkbox based on risk, and the backend still needs to verify what

Human verification shifts from selecting images to risk-based clearance, Cloudflare Turnstile provides hosted, non-interactive, and invisible three forms, the checkbox only appears when the risk is high. The token handed over to the backend does not mean security, the server still needs to verify the source, grade the form scenario, and provide a return that can be processed in case of verification failure.

Preview

Chinese characters in the file name are garbled when downloading attachments, why do the two file name parameters in the response header need to be written together

When downloading attachments, the Chinese file name is garbled, mostly because only filename or only filename* was written in the response header. The specification document states that both should be written together: parameters with an asterisk should be encoded in UTF-8 percentage encoding and have higher priority, while those without an asterisk should retain ASCII form for compatibility with old clients. This article also explains why the directory separator needs to be replaced.

Preview

Before modifying the template, consider leaving a rollback. Where should the template backup cover to?

A feasible method to leave rollback records before modifying the template is to do layered backups: template files, data, and static resources cover different recovery granularity. Anqi CMS supports backing up data along with static files, and since version 3.6.5, template backups have entered an independent background record. This article provides the three things that may be damaged by modifying the template, a layered table of backup objects, and the minimum rollback process before and after modification.