Home  >  Article  >  Backend Development  >  How to patch php

How to patch php

(*-*)浩
(*-*)浩Original
2019-10-15 10:38:396347browse

Usually when a system is developed, it must be upgraded frequently. Upgrading means modifying the code or data structure. Of course, under normal circumstances, a system should be developed with as few modifications to the data structure as possible.

How to patch php

So, when others are not currently using the latest version, how should we provide update patches for users to upgrade? (Recommended study: PHP video tutorial)

First, there is no doubt that every time a version is released for download, there should be a corresponding version number for differentiation. In this way, if the current user's version is inconsistent with the latest released version, it means that he should update.

Second, how to provide update patches. The first method: only provide modified files, and the modified files should be packaged according to the system directory. For example, if the index.php file in the admin folder in the system directory is modified, then indxe.php cannot be stored directly in the patch. Instead, a new admin folder must be created, and the modified index.php file must be saved there. Package the admin directory. Second method: Package the system as a whole regardless of how many files have been modified. The patch package should come with detailed update instructions and update methods.

Third, how to let users update. For both methods, the user is required to download the patch and then overwrite the original file. Of course, for insurance reasons, the user should be prompted to back up the original file. You can let users download update packages individually or provide online updates.

Fourth, update of data structure. This is different from updating the code, it's a little bit special. Because there may already be data in the database, you definitely cannot delete the original database and generate a new database. So what should we do? We can only operate on specific tables through modification statements, such as adding or deleting fields, adding a new table or deleting a table, etc.

Fifth, how to upgrade when the version span is large. Some users may be using a very old version, and there are multiple versions between them and the latest version. How to upgrade?

The safest way is to install patches one by one; what if you want to install them all at once? Then you must make different installation packages according to different versions, because only one file may be changed from version 1 to version 2, and only one file may be changed from version 2 to version 3, but from version 1 to version 3 3 only changed 2 files, so it is necessary and necessary to create different installation packages according to different versions.

In short, The most important point in providing update patches is to be able to accurately determine the difference between the current version and the latest version, and then download the corresponding patch. You should be cautious when making changes to the data structure. Generally, new additions (tables or fields) can be made, but deletions should be avoided as much as possible.

The above is the detailed content of How to patch php. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn