Detailed Description
In order to make the technical problems, technical solutions and advantages of the present invention more apparent, the following detailed description is given with reference to the accompanying drawings and specific embodiments.
As shown in fig. 1, an embodiment of the present invention provides a software upgrading method, including the following steps:
step S101, if an upgrading instruction is received, determining a change file corresponding to the patch according to a file in the patch and a file in the target software.
In the embodiment of the present invention, the upgrade instruction is used to indicate that software upgrade operation needs to be performed, the target software may be any software that needs to be upgraded, and the change file may be a delete file and/or a modify file, where the delete file may include a file that does not exist in the patch and exists in the target software. The modified files may include files that are present in the patch file and that are not present in the target software. Optionally, the embodiment of the present invention may search, based on the file in the patch, whether a file with the same name and the same directory hierarchy as the file in the patch exists in the file in the target software.
Step S102, establishing a backup file model of the patch according to the changed file corresponding to the patch, wherein the backup file model is a tree structure generated according to the directory hierarchy of the changed file corresponding to the patch.
In the embodiment of the present invention, the backup file model is a tree structure generated according to the directory hierarchy of the changed files, and specifically, a tree node may be generated based on the directory hierarchy of each changed file. After the tree nodes corresponding to the changed files are obtained, the tree nodes corresponding to the changed files can be combined to obtain a backup file model.
And step S103, carrying out file backup according to the node corresponding to the changed file in the backup file model to obtain a backup file.
In the embodiment of the invention, the file backup is carried out according to the node corresponding to the changed file, so that only the changed file is backed up, and the number of backup files can be reduced.
And step S104, executing upgrading operation based on the patch.
If an upgrading instruction is received, determining a change file corresponding to a patch according to a file in the patch and a file in target software; establishing a backup file model of the patch according to the changed files corresponding to the patch, wherein the backup file model is a tree structure generated according to the directory hierarchy of the changed files corresponding to the patch; performing file backup according to the node corresponding to the changed file in the backup file model to obtain a backup file; and executing upgrading operation based on the patch. According to the embodiment of the invention, only the changed files are backed up based on the backup file model during software upgrading, compared with the prior art that full software version backup is carried out, the number of the backup files is reduced, the time consumption during software patch upgrading is saved, and the upgrading efficiency is improved.
As shown in fig. 2, an embodiment of the present invention further provides a software upgrading method, including the following steps:
step S201, if an upgrade instruction is received, determining a newly added file and a modified file corresponding to the patch according to the file in the patch and the file in the target software.
In the embodiment of the present invention, the newly added file may include a file that exists in the patch and does not exist in the target software.
Step S202, establishing a backup file model of the patch according to the newly added file and the changed file corresponding to the patch.
In the embodiment of the invention, the backup file model is a tree structure generated according to the directory hierarchy of the newly added files and the changed files. Specifically, the embodiments of the present invention may generate tree nodes according to the directory hierarchy of each newly added file and each changed file, and perform attribute identification on each tree node, for example, for a newly added file, a node corresponding to the newly added file may be identified as a new addition, and for a deleted file, a node corresponding to the deleted file may be identified as a deletion, and the like. And combining the tree nodes to obtain a backup file model.
Step S203, carrying out file backup according to the node corresponding to the changed file in the backup file model to obtain a backup file.
In the embodiment of the invention, the file backup is carried out according to the node corresponding to the changed file, so that only the changed file is backed up, and the number of the backed-up files can be reduced.
And step S204, executing upgrading operation based on the patch.
Optionally, after performing an upgrade operation based on the patch, the method further includes: and if a rollback instruction is received, executing rollback operation according to the backup file model and the backup file.
Optionally, in the embodiment of the present invention, files corresponding to each node of the backup file model may be directly deleted from the upgraded target software, and the backup files are added to the target software, so that the target software is quickly rolled back to the version before upgrading.
Optionally, the determining, by the patch, a new file and a changed file corresponding to the patch according to a file in the patch and a file in the target software includes: determining a newly added file and a changed file corresponding to the first patch according to the file in the first patch and the file in the target software, and determining a newly added file and a changed file corresponding to the second patch according to the file in the second patch and the file in the target software;
the establishing of the backup file model of the patch according to the newly added file and the changed file corresponding to the patch comprises the following steps: establishing a first backup file model of the first patch according to the newly added file and the changed file corresponding to the first patch, and establishing a second backup file model of the second patch according to the newly added file and the changed file corresponding to the second patch; merging each node in the first backup file model and the second backup file model to obtain a merged backup file model;
the performing file backup according to the node corresponding to the changed file in the backup file model to obtain a backup file includes: and carrying out file backup according to the node corresponding to the changed file in the merged backup file model to obtain the backup file.
In the embodiment of the invention, when the number of the patches is multiple, the backup file model of each patch is established according to the newly added file and the changed file corresponding to each patch, nodes in the backup file model of each patch are merged, and the file backup is carried out based on the merged backup file model. The following embodiments of the present invention will be described with reference to the first patch and the second patch as examples.
In the embodiment of the invention, the first backup file model is a tree structure established according to the directory hierarchy of each newly added file and each changed file of the first patch, the second backup file model is a tree structure established according to the directory hierarchy of each newly added file and each changed file of the second patch, and as the same newly added file and changed file may exist in the first patch and the second patch, in order to avoid redundancy of backup files, each node in the first backup file model and each node in the second backup file model are merged, wherein only one node is reserved after merging. Specifically, in the embodiment of the present invention, each node of the backup file model of the second patch may be traversed based on the backup file model of the first patch, and a node of the backup file model of the second patch, which is different from the backup file model of the first patch, is added to the backup file model of the first patch, so as to obtain the merged backup file model. Therefore, when the file backup is carried out on the basis of the node corresponding to the changed file in the merged backup file model, the redundancy of the backup file caused by the fact that the same file among different patches is backed up for multiple times can be avoided.
Optionally, after the upgrading order of the first patch is located before the second patch, and after a first backup file model of the first patch is established according to the newly added file and the changed file corresponding to the first patch, and a second backup file model of the second patch is established according to the newly added file and the changed file corresponding to the second patch, the method further includes: performing file backup according to the node corresponding to the changed file in the first backup file model to obtain a backup file corresponding to the first patch; deleting the same node in the second backup file model as the first backup file model to obtain an updated second backup file model, and performing file backup according to the node corresponding to the changed file in the updated second backup file model to obtain a backup file corresponding to the second patch.
In practical cases, when the number of patches is multiple, the upgrade is usually performed sequentially according to each patch of the multiple patches. In an embodiment of the invention, the first patch is upgraded before the second patch. After the first backup file model is obtained, the file backup is carried out based on the first backup file model, and the backup file corresponding to the first patch is obtained. Specifically, the backup file corresponding to the first patch is a file that needs to be changed based on the target software when the first patch is upgraded. After the second backup file model is obtained, the node in the second backup file model, which is the same as the node in the first backup file model, may be deleted to obtain an updated second backup file model, so as to perform file backup according to the updated second backup file model to obtain a backup file corresponding to the second patch, where the backup file corresponding to the second patch is a file that needs to be changed based on the target software when the second patch is upgraded.
Optionally, in the embodiment of the present invention, a corresponding relationship may be respectively established between each restore point and each backup file model and each backup file, so that the target software may be quickly rolled back to the restore point according to the backup file model and the backup file corresponding to a certain restore point.
Optionally, the determining, by the file in the patch and the file in the target software, a new file and a changed file corresponding to the patch according to the upgrading order of the first patch being before the second patch includes: determining a newly added file and a changed file corresponding to the first patch according to the file in the first patch and the file in the target software;
the establishing of the backup file model of the patch according to the newly added file and the changed file corresponding to the patch includes: establishing a first backup file model of the first patch according to the newly added file and the changed file corresponding to the first patch;
the file backup according to the node corresponding to the changed file in the backup file model includes: performing file backup according to the node corresponding to the changed file in the first backup file model to obtain a backup file corresponding to the first patch;
the executing of the upgrade operation based on the patch includes: performing an upgrade operation based on the first patch;
after performing an upgrade operation based on the first patch, the method further comprises: if the first patch is upgraded successfully, determining a newly added file and a changed file corresponding to the second patch according to a file in the second patch and a file in the target software; establishing a second backup file model of the second patch according to the newly added file and the changed file corresponding to the second patch; deleting the nodes in the second backup file model, which are the same as the backup file model of the first patch, to obtain an updated second backup file model; performing file backup according to the node corresponding to the changed file in the updated second backup file model to obtain a backup file corresponding to the second patch; performing an upgrade operation based on the second patch.
In the embodiment of the invention, file backup and upgrade of each patch are executed in series, specifically, a newly added file and a changed file corresponding to a first patch are determined according to a file in the first patch and a file in the target software; establishing a first backup file model of the first patch according to the newly added file and the changed file corresponding to the first patch; performing file backup according to the node corresponding to the changed file in the first backup file model to obtain a backup file corresponding to the first patch; and performing an upgrade operation based on the first patch. If the first patch is upgraded successfully, determining a newly added file and a changed file corresponding to the second patch according to a file in the second patch and a file in the target software; establishing a second backup file model of the second patch according to the newly added file and the changed file corresponding to the second patch; deleting the nodes in the second backup file model, which are the same as the backup file model of the first patch, to obtain an updated second backup file model; performing file backup according to the node corresponding to the changed file in the updated second backup file model to obtain a backup file corresponding to the second patch; performing an upgrade operation based on the second patch.
Optionally, in the embodiment of the present invention, after the second backup file model is obtained, the second backup file model may be merged with the first backup file model to obtain a merged backup file model.
Optionally, in the embodiment of the present invention, a corresponding relationship may be respectively established between each restore point and each backup file model and each backup file, so that the target software may be quickly rolled back to the restore point according to the backup file model and the backup file corresponding to a certain restore point.
Optionally, after performing an upgrade operation based on the patch, the method further includes: if a rollback instruction is received, acquiring a backup file model and a backup file corresponding to a target restoration point according to the target restoration point in the rollback instruction; and performing rollback operation on the upgraded target software according to the backup file model and the backup file corresponding to the target restoring point.
In the embodiment of the present invention, the rollback instruction is used to indicate that a rollback operation needs to be performed, for example, when upgrading fails through a certain patch. Optionally, the user may be prompted through a pop-up window whether to perform a rollback operation and input a target restore point, and after receiving the target restore point input by the user, a backup file model and a backup file corresponding to the target restore point are obtained.
Optionally, the performing a rollback operation on the upgraded target software according to the backup file model and the backup file corresponding to the target restoring point includes: and deleting files corresponding to each node in the backup file model corresponding to the target restoring point from the upgraded target software, and adding the backup files corresponding to the target restoring point into the target software.
Optionally, if the file in the patch includes an empty directory, before the backup file model of the patch is established according to the newly added file, the deleted file, and the modified file corresponding to the patch, the method further includes: and adding a description file in the empty directory.
The description file may be any format file, such as a WORD file, a TXT file, and the like. After the description file is added into the empty directory, the tree node can be established according to the directory hierarchy of the description file. The whole backup file model can be simplified by converting the empty directory into an instruction file contained under the empty directory, and the whole backup file model is finally classified into the operation of a plurality of independent files, so that the files are used as the minimum operation unit, and the condition that the files are newly added to the recorded empty directory can not occur when a plurality of patches are upgraded successively.
If an upgrading instruction is received, determining a newly added file and a modified file corresponding to a patch according to a file in the patch and a file in target software; establishing a backup file model of the patch according to the newly added file and the changed file corresponding to the patch; performing file backup according to the node corresponding to the changed file in the backup file model to obtain a backup file; and executing upgrading operation based on the patch. Compared with the prior art in which full-software version backup is carried out, the number of backup files is reduced, time consumption in software patch upgrade is saved, and upgrade efficiency is improved. Moreover, the target software can be conveniently and quickly rolled back to the version before upgrading on the basis of the backup file model and the backup file.
As shown in fig. 3, an embodiment of the present invention provides a software upgrading method, including the following steps:
step S301, with the files in the patch as reference, scanning files with the same name in the target software one by one, and setting corresponding identification bits.
Specifically, for a file in the patch, if the file exists in the target software, the file is identified as modified; if the file does not exist in the target software, the file is marked as new; if the file needs to be deleted, the file is identified as deleted.
And step S302, establishing a backup file model of the patch.
Specifically, referring to fig. 4, the backup file model building process is as follows:
if the file is a new file (namely, a new file), a tree node is established according to the directory hierarchy of the file and is marked as new, wherein if the new file is an empty directory, an instruction file, such as ignore.
The embodiment of the invention can simplify the whole backup file model by converting the new increase of the empty directory into the new increase of one instruction file in the empty directory, and finally belongs to the operation of a plurality of independent files, so that the files are used as the minimum operation unit, and the situation that the files are newly added to the recorded empty directory when a plurality of patches are upgraded successively can be avoided.
If the file is deleted (namely, the file is deleted), a tree node is established according to the directory hierarchy of the file, and the node is marked as deleted, wherein if the deleted file is an empty directory, a description, for example, ignore.
If the file is a modified file (i.e., a modified file), the modification can be a combination of deletion and addition. By the method, the types of file operations can be further simplified, and all the operations on the files are simplified into addition and deletion. And converting the modified file into a combination of the deleted file and the newly added file, and establishing tree nodes according to the directory hierarchy of the deleted file and the newly added file respectively.
And merging the tree nodes established according to the rules into the same tree structure to obtain a backup file model.
And step S303, carrying out file backup according to the backup file model of the patch, and executing upgrading operation based on the patch.
In the embodiment of the invention, the nodes marked as deleted in the backup file model are sequentially backed up to a fixed directory during file backup, and only the nodes marked as newly added are recorded and not processed.
The current backup file model can also be saved before the patch upgrade, so that when a certain patch upgrade fails or manual rollback is carried out, the rollback can be selected to reach the restoring point.
And step S304, judging whether the upgrade is successful.
If the upgrade is successful, go to step S305, and if the upgrade is unsuccessful, go to step S309.
Step S305, judging whether other patches exist.
In the embodiment of the present invention, the other patches refer to patches that need to be upgraded currently, except for the upgraded patches. If there is another patch, step S306 is executed, and if there is no other patch, step S308 is executed.
And S306, continuing to establish a backup file model for the subsequent patch, and merging the backup file model of the patch into the previous backup file model to obtain a merged backup file model.
In the embodiment of the invention, the subsequent patch refers to a patch with the upgrading sequence being positioned after the current upgraded patch, and the previous backup file model refers to the backup file model of the patch upgraded before.
In the embodiment of the invention, the process of establishing the backup file model of the subsequent patch is as follows:
if the file is a newly added file, establishing new files according to the directory hierarchy of the file to obtain the tree node of the merged backup file model, if the node exists in the previous backup file model, not processing the node, and if the node does not exist, adding the node into the previous backup file model and marking the node as newly added.
If the file is deleted, establishing a new tree node according to the directory hierarchy of the file, and if the node exists in the previous backup file model, not processing the node; if the node does not exist, the node is added to the previous backup file model and identified as deleted.
The embodiment of the invention firstly judges the existence of the newly added and deleted tree nodes, aims to record the first operation for the same file, and does not process any operation or operation for a plurality of times no matter what kind of operation is carried out on the file during the subsequent patch upgrading, thereby reducing the complexity of the software upgrading method of the embodiment of the invention.
And step S307, carrying out backup again according to the merged backup file model, and then carrying out patch upgrading.
After the patch upgrade, the execution returns to step S305. Specifically, the embodiment of the present invention may repeatedly execute steps S305 to S307 until all patches are upgraded.
It should be noted that, in the embodiment of the present invention, step S304 to step S307 may be repeatedly executed until all patches are upgraded.
Step S308, whether a rollback version is needed.
If the rollback (i.e., rollback) version is required, step S309 is executed, and if the rollback version is not required, the process is terminated. In practical situations, if some patch upgrade fails or is successful but the service is abnormal, the upgraded target software generally needs to be backed to the version before the upgrade.
And step S309, performing software rollback according to the backup file model.
Specifically, the software rollback flow may be as follows: traversing nodes in the merged backup file model, and deleting files corresponding to each node in the merged backup file model from the target software; the backup file is overwritten into the target software.
It should be noted that deletion here refers to deletion of all nodes, and includes not only the node identified as being newly added, but also the node identified as being deleted, because the node identified as being deleted is recorded when the node is operated for the first time, the node may be newly created, modified during subsequent operations, or even other files are placed under the directory, and deletion will thoroughly clean up these files, so that it is ensured that the state of the software version after the backup file is overlaid into the target and the current state are completely consistent.
Compared with the existing full-version backup scheme during software upgrading, the software upgrading method provided by the embodiment of the invention has the advantages that the number of backed-up files is greatly reduced; meanwhile, redundant backup of the same files among the patches is removed, the number of files needing to be backed up is further reduced, time consumption during software patch upgrading is saved, and upgrading efficiency is improved.
The following examples illustrate embodiments of the invention:
the patch set patch includes patch1 and patch2. Patch1 includes: adding a file FileAdd1, adding an empty directory DirAdd1, deleting a file FileDel1, deleting an empty directory DirDE 2, deleting a directory DirDE 3 and modifying a file FileModify; patch2 includes: deleting files FileAdd1 and FileDel4, and adding FileAdd2 and DirDE 2.
Step a, with a file in the patch1 as a reference, scanning files with the same name in target software one by one, and setting corresponding identifiers, wherein specifically, fileAdd1 and DirAdd1 do not exist in a software version and are set as new; fileDel1, dirDE 2 and DirDE 3 exist in target software but need to be deleted, and are set as deletion; fileModify exists in both the software version and patch1, set as modified.
And b, establishing a patch1 backup file model.
Specifically, tree nodes are established according to the directory hierarchy of the FileAdd1 and marked as new. Because DirAdd1 is a newly added empty directory, an instruction file, for example, ignore.txt, is newly added in DirAdd1, and a tree node is established according to the directory hierarchy of the ignore.txt and is marked as being newly added.
The tree nodes are built according to the directory hierarchy of FileDel1 and marked as deleted. Since DirDel2 is an empty directory to be deleted, a description file, for example, ignore.txt, is newly added to DirDel2, and a tree node is established according to the directory hierarchy of the ignore.txt and is marked as deleted.
Since DirDE 3 is a deleted non-empty directory, tree nodes are created according to the directory hierarchy of each file in DirDE 3 and identified as deleted. FileModify is a modified file, and a tree node is established according to the directory hierarchy of FileModify and is marked as deleted.
And c, performing file backup according to the backup file model of the patch1, and then upgrading based on the patch 1.
When the files are backed up, only the files marked as deletion are backed up, such as all leaf node files under FileDel1, dirDE 2/erasure.txt and DirDE 3, and FileModify.
And d, establishing a patch2 backup file model, and merging the patch backup file model into the previous backup file model.
FileAdd1 and DirDel2 are recorded in patch1, and only FileDel4 and FileAdd2 need to be merged without being merged into the previous backup file model.
And e, performing file backup according to the backup file model of the merged patch, and then upgrading the patch2.
Specifically, only FileDel4 and FileAdd2 in the backup file model need to be backed up.
Step f, if the patch1 and the patch2 fail to be upgraded or need to rollback the version after the patch is successfully upgraded, executing the following operations: deleting all nodes in the merged backup file model in the upgraded target software; all backed up files are overwritten into the target software.
The rollback of the full version of the target software can be realized through the operation, namely the target software returns to the version before the target software is upgraded.
As shown in fig. 5, an embodiment of the present invention provides a software upgrading apparatus, where thesoftware upgrading apparatus 50 includes:
a determiningmodule 51, configured to determine, if an upgrade instruction is received, a change file corresponding to a patch according to a file in the patch and a file in target software;
an establishingmodule 52, configured to establish a backup file model of the patch according to the changed file corresponding to the patch, where the backup file model is a tree structure generated according to a directory hierarchy of the changed file corresponding to the patch;
thefirst backup module 53 is configured to perform file backup according to the node corresponding to the changed file in the backup file model to obtain a backup file;
and anupgrade module 54 configured to perform an upgrade operation based on the patch.
Optionally, the determiningmodule 51 is further configured to: if an upgrading instruction is received, determining a newly added file corresponding to the patch according to the file in the patch and the file in the target software; the establishing module is specifically configured to: and establishing a backup file model of the patch according to the newly added file and the changed file corresponding to the patch.
Optionally, the patches include a first patch and a second patch, and the determiningmodule 51 is specifically configured to: determining a newly added file and a changed file corresponding to the first patch according to the file in the first patch and the file in the target software, and determining a newly added file and a changed file corresponding to the second patch according to the file in the second patch and the file in the target software; the establishingmodule 52 is specifically configured to: establishing a first backup file model of the first patch according to the newly added file and the changed file corresponding to the first patch, and establishing a second backup file model of the second patch according to the newly added file and the changed file corresponding to the second patch; merging each node in the first backup file model and the second backup file model to obtain a merged backup file model; the first backup module is specifically configured to: and carrying out file backup according to the node corresponding to the changed file in the merged backup file model to obtain the backup file.
Optionally, the upgrade order of the first patch is before the second patch, and the apparatus further includes: the second backup module is used for establishing a first backup file model of the first patch according to the newly added file and the changed file corresponding to the first patch, and performing file backup according to a node corresponding to the changed file in the first backup file model after establishing a second backup file model of the second patch according to the newly added file and the changed file corresponding to the second patch to obtain a backup file corresponding to the first patch; and the third backup module is used for deleting the nodes in the second backup file model, which are the same as the nodes in the first backup file model, to obtain an updated second backup file model, and performing file backup according to the nodes corresponding to the changed files in the updated second backup file model to obtain the backup files corresponding to the second patch.
Optionally, the patches include a first patch and a second patch, an upgrade order of the first patch is located before the second patch, and the determiningmodule 51 is specifically configured to: determining a newly added file and a changed file corresponding to the first patch according to the file in the first patch and the file in the target software; the establishingmodule 52 has means for: establishing a first backup file model of the first patch according to the newly added file and the changed file corresponding to the first patch; thebackup module 53 is specifically configured to: performing file backup according to the node corresponding to the changed file in the first backup file model to obtain a backup file corresponding to the first patch; theupgrade module 54 is specifically configured to: performing an upgrade operation based on the first patch;
the determiningmodule 51 is further configured to: after the upgrading operation is executed based on the first patch, if the upgrading is successful according to the first patch, determining a newly added file and a changed file corresponding to the second patch according to a file in the second patch and a file in the target software; the establishingmodule 52 is further configured to: establishing a second backup file model of the second patch according to the newly added file and the changed file corresponding to the second patch; deleting the nodes in the second backup file model, which are the same as the backup file model of the first patch, to obtain an updated second backup file model; thebackup module 53 is further configured to: performing file backup according to the node corresponding to the changed file in the updated second backup file model to obtain a backup file corresponding to the second patch; theupgrade module 54 is further configured to: performing an upgrade operation based on the second patch.
Optionally, the apparatus further comprises: and the rollback module is used for executing rollback operation according to the backup file model and the backup file if a rollback instruction is received after the upgrade operation is executed based on the patch.
In the embodiment of the present invention, if the determiningmodule 51 receives the upgrade instruction, the change file corresponding to the patch is determined according to the file in the patch and the file in the target software; the establishingmodule 52 establishes a backup file model of the patch according to the changed file corresponding to the patch, wherein the backup file model is a tree structure generated according to a directory hierarchy of the changed file corresponding to the patch; thefirst backup module 53 performs file backup according to the node corresponding to the changed file in the backup file model to obtain a backup file; upgrademodule 54 performs an upgrade operation based on the patch. According to the embodiment of the invention, only the changed files are backed up based on the backup file model during software upgrading, compared with the prior art that full software version backup is carried out, the number of the backed-up files is reduced, the time consumption during software patch upgrading is saved, and the upgrading efficiency is improved.
It should be noted that, the software upgrading apparatus in the embodiment of the present invention may be a user terminal in any implementation manner in the method embodiment of the present invention, and any implementation manner of the user terminal in the method embodiment of the present invention may be implemented by the software upgrading apparatus in this embodiment, and the same beneficial effects are achieved, and details are not described here.
Those skilled in the art will appreciate that all or part of the steps of the method of the above embodiments may be implemented by hardware associated with program instructions, and the program may be stored in a computer readable medium, and when executed, the program includes the following steps: if an upgrading instruction is received, determining a change file corresponding to the patch according to a file in the patch and a file in the target software; establishing a backup file model of the patch according to the changed files corresponding to the patch, wherein the backup file model is a tree structure generated according to the directory hierarchy of the changed files corresponding to the patch; performing file backup according to the node corresponding to the changed file in the backup file model to obtain a backup file; and executing upgrading operation based on the patch.
Optionally, if an upgrade instruction is received, the program further includes, when executed: determining a newly added file corresponding to the patch according to the file in the patch and the file in the target software; the establishing of the backup file model of the patch according to the changed file corresponding to the patch comprises: and establishing a backup file model of the patch according to the newly-added file and the changed file corresponding to the patch.
Optionally, the determining, by the patch including a first patch and a second patch, a new file and a changed file corresponding to the patch according to a file in the patch and a file in the target software includes: determining a newly added file and a changed file corresponding to the first patch according to the file in the first patch and the file in the target software, and determining a newly added file and a changed file corresponding to the second patch according to the file in the second patch and the file in the target software; the establishing of the backup file model of the patch according to the newly added file and the changed file corresponding to the patch comprises the following steps: establishing a first backup file model of the first patch according to the newly added file and the changed file corresponding to the first patch, and establishing a second backup file model of the second patch according to the newly added file and the changed file corresponding to the second patch; merging each node in the first backup file model and the second backup file model to obtain a merged backup file model; the performing file backup according to the node corresponding to the changed file in the backup file model to obtain a backup file includes: and carrying out file backup according to the node corresponding to the changed file in the merged backup file model to obtain the backup file.
Optionally, the determining, by the file in the patch and the file in the target software, a new file and a changed file corresponding to the patch according to the upgrading order of the first patch being before the second patch includes: determining a newly added file and a changed file corresponding to the first patch according to the file in the first patch and the file in the target software; the establishing of the backup file model of the patch according to the newly added file and the changed file corresponding to the patch includes: establishing a first backup file model of the first patch according to the newly added file and the changed file corresponding to the first patch; the file backup according to the node corresponding to the changed file in the backup file model includes: performing file backup according to the node corresponding to the changed file in the first backup file model to obtain a backup file corresponding to the first patch; the executing of the upgrade operation based on the patch includes: performing an upgrade operation based on the first patch; after performing an upgrade operation based on the first patch, the program, when executed, further includes the steps of: if the upgrading is successful according to the first patch, determining a newly added file and a changed file corresponding to the second patch according to a file in the second patch and a file in the target software; establishing a second backup file model of the second patch according to the newly added file and the changed file corresponding to the second patch; deleting the nodes in the second backup file model, which are the same as the backup file model of the first patch, to obtain an updated second backup file model; performing file backup according to the node corresponding to the changed file in the updated second backup file model to obtain a backup file corresponding to the second patch; performing an upgrade operation based on the second patch.
Optionally, after performing the upgrade operation based on the patch, the program further includes, when executed: and if a rollback instruction is received, executing rollback operation according to the backup file model and the backup file.
The storage medium may be a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk.
While the foregoing is directed to the preferred embodiment of the present invention, it will be understood by those skilled in the art that various changes and modifications may be made without departing from the spirit and scope of the invention as defined in the appended claims.