diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..f288702
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ Copyright (C)
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+.
diff --git a/README.md b/README.md
deleted file mode 100644
index e69de29..0000000
diff --git a/changelog.txt b/changelog.txt
new file mode 100644
index 0000000..c9f98e4
--- /dev/null
+++ b/changelog.txt
@@ -0,0 +1,51 @@
+== Changelog ==
+
+= 1.0.0 =
+
+_Release date: 2026-02-27_
+
+**Highlights**
+
+* First production release. Complete six-step migration wizard from MultilingualPress 2 to MultilingualPress 5.
+
+**Added**
+
+* Table preparation step: renames MLP2 tables (`{prefix}mlp_*` → `{prefix}mlp2bak_*`) so MLP5 can activate cleanly. Fully reversible.
+* Wizard Step 1 — Preflight Checks: verifies backup tables exist and MLP5 is network-active before allowing migration to proceed.
+* Wizard Step 2 — Analysis: scans MLP2 backup tables, counts records, detects orphaned sites/posts/terms and duplicate rows, validates MLP5 schema compatibility.
+* Wizard Step 3 — Site Relations: migrates all site connections from MLP2 backup tables to MLP5. Idempotent (safe to re-run).
+* Wizard Step 4 — Content Relations: migrates post and term relationships in AJAX batches with a real-time progress bar, pause/resume support, and orphan filtering.
+* Wizard Step 5 — Verification: compares expected totals with log counts by category; offers full CSV export of the migration log.
+* Wizard Step 6 — Cleanup (optional): network-deactivates MLP2, drops backup tables, and removes MLP2 sitemeta entries. Requires explicit `DELETE` confirmation.
+* Migration log table (`{prefix}mlp_migrator_log`) with structured entries (type, context, source/target IDs, message).
+* MLP5 schema detector: identifies `mlp_site_relations`, `mlp_content_relations`, and `mlp_relationships` tables and validates column presence.
+* MLP2 detector: locates MLP2 plugin file, reads version, detects backup tables. Supports `mlp_relationships`, `mlp_content_relations`, and `multilingual_linked` as content relations table candidates.
+* Auto-update integration via `Robotstxt_Updater` (Gitea-based update server).
+* Spanish (es_ES) translation.
+
+**Compatibility**
+
+* WordPress: 6.7 – 6.9
+* PHP: 8.2 – 8.5
+
+= 0.1.0 =
+
+_Release date: 2026-02-27_
+
+**Highlights**
+
+* Initial plugin scaffold.
+
+**Added**
+
+* Main plugin file with required WordPress headers and Multisite-only guard.
+* Plugin bootstrap class with activation, deactivation, and i18n hooks.
+* Uninstall handler stub.
+* PHPCS configuration targeting WordPress Coding Standards and PHPCompatibilityWP for PHP 8.2–8.5.
+* Deploy script to generate a distributable ZIP.
+* Auto-update integration via Robotstxt_Updater.
+
+**Compatibility**
+
+* WordPress: 6.7 – 6.9
+* PHP: 8.2 – 8.5
diff --git a/includes/class-robotstxt-mlp2-mlp5-admin-page.php b/includes/class-robotstxt-mlp2-mlp5-admin-page.php
new file mode 100644
index 0000000..a844f83
--- /dev/null
+++ b/includes/class-robotstxt-mlp2-mlp5-admin-page.php
@@ -0,0 +1,583 @@
+ Settings and
+ * orchestrates the full migration wizard. Handles all POST actions for:
+ * - Table rename / restore (preparation)
+ * - Wizard step navigation (steps 1–6)
+ * - Wizard reset
+ * - CSV log export
+ *
+ * Network Admin only. Uses exclusively:
+ * network_admin_menu, network_admin_init.
+ *
+ * @package Robotstxt_Mlp2_Mlp5
+ */
+
+if ( ! defined( 'ABSPATH' ) ) {
+ exit;
+}
+
+/**
+ * Class Robotstxt_Mlp2_Mlp5_Admin_Page
+ */
+class Robotstxt_Mlp2_Mlp5_Admin_Page {
+
+ /**
+ * Menu slug for the plugin settings page.
+ *
+ * @var string
+ */
+ const MENU_SLUG = 'robotstxt-mlp2-mlp5';
+
+ /**
+ * Required capability to access the plugin page.
+ *
+ * The manage_network capability is the standard for Network Admin settings.
+ *
+ * @var string
+ */
+ const CAPABILITY = 'manage_network';
+
+ /**
+ * Register the Network Admin page and all POST/GET handlers.
+ */
+ public static function init(): void {
+ add_action( 'network_admin_menu', array( static::class, 'register_menu' ) );
+ add_action( 'admin_post_mlp_migrator_rename_tables', array( static::class, 'handle_rename_action' ) );
+ add_action( 'admin_post_mlp_migrator_restore_tables', array( static::class, 'handle_restore_action' ) );
+ add_action( 'admin_post_mlp_migrator_step', array( static::class, 'handle_step_actions' ) );
+ add_action( 'admin_post_mlp_migrator_reset_wizard', array( static::class, 'handle_reset_action' ) );
+ add_action( 'admin_post_mlp_migrator_export_log', array( 'Robotstxt_Mlp2_Mlp5_Step_Verification', 'maybe_export_csv' ) );
+ }
+
+ /**
+ * Add the settings page under Network Admin > Settings.
+ */
+ public static function register_menu(): void {
+ add_submenu_page(
+ 'settings.php',
+ __( 'MLP2 to MLP5 Migrator', 'robotstxt-mlp2-mlp5' ),
+ __( 'MLP Migrator', 'robotstxt-mlp2-mlp5' ),
+ self::CAPABILITY,
+ self::MENU_SLUG,
+ array( static::class, 'render' )
+ );
+ }
+
+ /**
+ * Return the URL to this plugin's Network Admin page.
+ *
+ * @param array $extra Optional extra query args.
+ * @return string Absolute URL.
+ */
+ public static function page_url( array $extra = array() ): string {
+ $args = array_merge( array( 'page' => self::MENU_SLUG ), $extra );
+ return network_admin_url( 'settings.php?' . http_build_query( $args ) );
+ }
+
+ // -------------------------------------------------------------------------
+ // POST handlers (preparation)
+ // -------------------------------------------------------------------------
+
+ /**
+ * Handle the "Rename MLP2 tables" POST action.
+ */
+ public static function handle_rename_action(): void {
+ check_admin_referer( 'mlp_migrator_rename', 'mlp_migrator_nonce' );
+ if ( ! current_user_can( self::CAPABILITY ) ) {
+ wp_die( esc_html__( 'You do not have permission to perform this action.', 'robotstxt-mlp2-mlp5' ) );
+ }
+ $result = Robotstxt_Mlp2_Mlp5_Table_Preparer::rename_to_backup();
+ $args = array( 'renamed' => count( $result['renamed'] ) );
+ if ( ! empty( $result['errors'] ) ) {
+ $args['rename_errors'] = count( $result['errors'] );
+ }
+ wp_safe_redirect( self::page_url( $args ) );
+ exit;
+ }
+
+ /**
+ * Handle the "Restore original table names" POST action.
+ */
+ public static function handle_restore_action(): void {
+ check_admin_referer( 'mlp_migrator_restore', 'mlp_migrator_nonce' );
+ if ( ! current_user_can( self::CAPABILITY ) ) {
+ wp_die( esc_html__( 'You do not have permission to perform this action.', 'robotstxt-mlp2-mlp5' ) );
+ }
+ $result = Robotstxt_Mlp2_Mlp5_Table_Preparer::restore_from_backup();
+ $args = array( 'restored' => count( $result['restored'] ) );
+ if ( ! empty( $result['errors'] ) ) {
+ $args['restore_errors'] = count( $result['errors'] );
+ }
+ wp_safe_redirect( self::page_url( $args ) );
+ exit;
+ }
+
+ // -------------------------------------------------------------------------
+ // POST handlers (wizard steps)
+ // -------------------------------------------------------------------------
+
+ /**
+ * Route all wizard step POST actions.
+ */
+ public static function handle_step_actions(): void {
+ // phpcs:ignore WordPress.Security.NonceVerification.Missing
+ if ( ! isset( $_POST['mlp_migrator_step_action'] ) ) {
+ return;
+ }
+ if ( ! current_user_can( self::CAPABILITY ) ) {
+ wp_die( esc_html__( 'You do not have permission to perform this action.', 'robotstxt-mlp2-mlp5' ) );
+ }
+
+ // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
+ $action = sanitize_key( wp_unslash( $_POST['mlp_migrator_step_action'] ) );
+
+ switch ( $action ) {
+ case '1':
+ self::handle_step_1_next();
+ break;
+ case '2_run':
+ self::handle_step_2_run();
+ break;
+ case '2':
+ self::handle_step_next( 2, 3, 'mlp_migrator_step_2' );
+ break;
+ case '3_run':
+ self::handle_step_3_run();
+ break;
+ case '3':
+ self::handle_step_next( 3, 4, 'mlp_migrator_step_3' );
+ break;
+ case '4':
+ self::handle_step_next( 4, 5, 'mlp_migrator_step_4' );
+ break;
+ case '5':
+ self::handle_step_next( 5, 6, 'mlp_migrator_step_5' );
+ break;
+ case '6_cleanup':
+ self::handle_step_6_cleanup();
+ break;
+ }
+ }
+
+ /**
+ * Handle "Next" from Step 1 (Preflight).
+ */
+ private static function handle_step_1_next(): void {
+ check_admin_referer( 'mlp_migrator_step_1', 'mlp_migrator_nonce' );
+ $checks = Robotstxt_Mlp2_Mlp5_Step_Preflight::run();
+ if ( $checks['can_proceed'] ) {
+ Robotstxt_Mlp2_Mlp5_Wizard_State::mark_step_complete( 1 );
+ Robotstxt_Mlp2_Mlp5_Wizard_State::set_step( 2 );
+ }
+ wp_safe_redirect( self::page_url() );
+ exit;
+ }
+
+ /**
+ * Handle "Run Analysis" from Step 2.
+ */
+ private static function handle_step_2_run(): void {
+ check_admin_referer( 'mlp_migrator_analysis', 'mlp_migrator_nonce' );
+ $result = Robotstxt_Mlp2_Mlp5_Step_Analysis::run();
+ Robotstxt_Mlp2_Mlp5_Wizard_State::set_step_data( 2, $result );
+ wp_safe_redirect( self::page_url() );
+ exit;
+ }
+
+ /**
+ * Handle "Start" from Step 3 (Site Relations).
+ */
+ private static function handle_step_3_run(): void {
+ check_admin_referer( 'mlp_migrator_site_relations', 'mlp_migrator_nonce' );
+ $result = Robotstxt_Mlp2_Mlp5_Step_Site_Relations::run();
+ Robotstxt_Mlp2_Mlp5_Wizard_State::set_step_data( 3, $result );
+ wp_safe_redirect( self::page_url() );
+ exit;
+ }
+
+ /**
+ * Handle "Next" for a standard step (advance to next, mark complete).
+ *
+ * @param int $current_step Current step number.
+ * @param int $next_step Next step number.
+ * @param string $nonce_action Nonce action string.
+ */
+ private static function handle_step_next( int $current_step, int $next_step, string $nonce_action ): void {
+ check_admin_referer( $nonce_action, 'mlp_migrator_nonce' );
+ Robotstxt_Mlp2_Mlp5_Wizard_State::mark_step_complete( $current_step );
+ Robotstxt_Mlp2_Mlp5_Wizard_State::set_step( $next_step );
+ wp_safe_redirect( self::page_url() );
+ exit;
+ }
+
+ /**
+ * Handle the cleanup POST from Step 6.
+ */
+ private static function handle_step_6_cleanup(): void {
+ check_admin_referer( 'mlp_migrator_cleanup', 'mlp_migrator_nonce' );
+
+ // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
+ $confirm = isset( $_POST['cleanup_confirm'] ) ? wp_unslash( $_POST['cleanup_confirm'] ) : '';
+ if ( 'DELETE' !== $confirm ) {
+ wp_safe_redirect( self::page_url( array( 'cleanup_error' => '1' ) ) );
+ exit;
+ }
+
+ $deactivate = ! empty( $_POST['cleanup_deactivate'] );
+ $drop_tables = ! empty( $_POST['cleanup_drop_tables'] ) && $deactivate;
+ $sitemeta = ! empty( $_POST['cleanup_sitemeta'] );
+
+ if ( $deactivate ) {
+ Robotstxt_Mlp2_Mlp5_Step_Cleanup::deactivate_mlp2();
+ }
+ if ( $drop_tables ) {
+ Robotstxt_Mlp2_Mlp5_Step_Cleanup::drop_backup_tables();
+ }
+ if ( $sitemeta ) {
+ Robotstxt_Mlp2_Mlp5_Step_Cleanup::remove_mlp2_sitemeta();
+ }
+
+ Robotstxt_Mlp2_Mlp5_Wizard_State::mark_step_complete( 6 );
+ wp_safe_redirect( self::page_url( array( 'cleanup_done' => '1' ) ) );
+ exit;
+ }
+
+ /**
+ * Handle the wizard reset POST action.
+ */
+ public static function handle_reset_action(): void {
+ check_admin_referer( 'mlp_migrator_reset', 'mlp_migrator_nonce' );
+ if ( ! current_user_can( self::CAPABILITY ) ) {
+ wp_die( esc_html__( 'You do not have permission to perform this action.', 'robotstxt-mlp2-mlp5' ) );
+ }
+ Robotstxt_Mlp2_Mlp5_Wizard_State::reset();
+ Robotstxt_Mlp2_Mlp5_Logger::clear();
+ wp_safe_redirect( self::page_url( array( 'reset' => '1' ) ) );
+ exit;
+ }
+
+ // -------------------------------------------------------------------------
+ // Rendering
+ // -------------------------------------------------------------------------
+
+ /**
+ * Render the full page.
+ */
+ public static function render(): void {
+ if ( ! current_user_can( self::CAPABILITY ) ) {
+ wp_die( esc_html__( 'You do not have permission to access this page.', 'robotstxt-mlp2-mlp5' ) );
+ }
+
+ $has_original = Robotstxt_Mlp2_Mlp5_Table_Preparer::has_original_tables();
+ $has_backup = Robotstxt_Mlp2_Mlp5_Table_Preparer::has_backup_tables();
+ $mlp5 = new Robotstxt_Mlp2_Mlp5_Detector_Mlp5();
+ $mlp5_active = $mlp5->is_active();
+
+ // Once MLP5 is active its own tables match the mlp_* pattern.
+ // They are not leftover MLP2 tables, so suppress the "must be renamed" signal.
+ if ( $mlp5_active ) {
+ $has_original = false;
+ }
+
+ // Migration is complete when wizard step 6 is marked done.
+ $wizard_done = Robotstxt_Mlp2_Mlp5_Wizard_State::is_step_complete( Robotstxt_Mlp2_Mlp5_Wizard_State::TOTAL_STEPS );
+ $ready = ( $has_backup && $mlp5_active ) || ( $wizard_done && $mlp5_active );
+ ?>
+
+
+
+ base_prefix . self::ORIGINAL_FRAGMENT;
+
+ if ( ! str_starts_with( $original_table, $orig_prefix ) ) {
+ return '';
+ }
+
+ return $wpdb->base_prefix . self::BACKUP_FRAGMENT . substr( $original_table, strlen( $orig_prefix ) );
+ }
+
+ /**
+ * Return the original table name for a given backup table.
+ *
+ * @param string $backup_table Full backup table name (including base_prefix).
+ * @return string Original table name, or empty string if not a backup table.
+ */
+ public static function original_name( string $backup_table ): string {
+ global $wpdb;
+
+ $bak_prefix = $wpdb->base_prefix . self::BACKUP_FRAGMENT;
+
+ if ( ! str_starts_with( $backup_table, $bak_prefix ) ) {
+ return '';
+ }
+
+ return $wpdb->base_prefix . self::ORIGINAL_FRAGMENT . substr( $backup_table, strlen( $bak_prefix ) );
+ }
+
+ /**
+ * Return all tables in the database with the original MLP2 prefix.
+ *
+ * @return string[] Array of full table names.
+ */
+ public static function get_original_tables(): array {
+ global $wpdb;
+
+ $like = $wpdb->esc_like( $wpdb->base_prefix . self::ORIGINAL_FRAGMENT ) . '%';
+
+ // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
+ $tables = $wpdb->get_col( $wpdb->prepare( 'SHOW TABLES LIKE %s', $like ) );
+
+ return is_array( $tables ) ? $tables : array();
+ }
+
+ /**
+ * Return all tables in the database with the backup prefix.
+ *
+ * @return string[] Array of full table names.
+ */
+ public static function get_backup_tables(): array {
+ global $wpdb;
+
+ $like = $wpdb->esc_like( $wpdb->base_prefix . self::BACKUP_FRAGMENT ) . '%';
+
+ // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
+ $tables = $wpdb->get_col( $wpdb->prepare( 'SHOW TABLES LIKE %s', $like ) );
+
+ return is_array( $tables ) ? $tables : array();
+ }
+
+ /**
+ * Whether any original MLP2 tables exist in the database.
+ *
+ * @return bool
+ */
+ public static function has_original_tables(): bool {
+ return count( self::get_original_tables() ) > 0;
+ }
+
+ /**
+ * Whether any backup (renamed) MLP2 tables exist in the database.
+ *
+ * @return bool
+ */
+ public static function has_backup_tables(): bool {
+ return count( self::get_backup_tables() ) > 0;
+ }
+
+ /**
+ * Rename all original MLP2 tables to their backup equivalents.
+ *
+ * Tables that already have a backup copy are skipped. Tables that cannot
+ * be converted to a valid backup name are recorded as errors.
+ *
+ * @return array {
+ * @type string[] $renamed Tables successfully renamed.
+ * @type string[] $skipped Tables skipped (backup name already exists).
+ * @type string[] $errors Tables that could not be renamed.
+ * }
+ */
+ public static function rename_to_backup(): array {
+ global $wpdb;
+
+ $result = array(
+ 'renamed' => array(),
+ 'skipped' => array(),
+ 'errors' => array(),
+ );
+
+ foreach ( self::get_original_tables() as $table ) {
+ $backup = self::backup_name( $table );
+
+ if ( '' === $backup ) {
+ $result['errors'][] = $table;
+ continue;
+ }
+
+ // Skip tables that belong to this plugin.
+ $suffix = substr( $table, strlen( $wpdb->base_prefix . self::ORIGINAL_FRAGMENT ) );
+ if ( in_array( $suffix, self::PLUGIN_TABLE_SUFFIXES, true ) ) {
+ $result['skipped'][] = $table;
+ continue;
+ }
+
+ if ( self::table_exists( $backup ) ) {
+ $result['skipped'][] = $table;
+ continue;
+ }
+
+ // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.SchemaChange, WordPress.DB.PreparedSQL.InterpolatedNotPrepared
+ $renamed = $wpdb->query( "RENAME TABLE `{$table}` TO `{$backup}`" );
+
+ if ( false === $renamed ) {
+ $result['errors'][] = $table;
+ } else {
+ $result['renamed'][] = $table;
+ }
+ }
+
+ return $result;
+ }
+
+ /**
+ * Restore backup tables to their original names.
+ *
+ * Intended as a recovery mechanism if the rename needs to be undone before
+ * MLP5 has been activated. Tables whose original name already exists in the
+ * database are skipped.
+ *
+ * @return array {
+ * @type string[] $restored Tables successfully restored.
+ * @type string[] $skipped Tables skipped (original name already exists).
+ * @type string[] $errors Tables that could not be restored.
+ * }
+ */
+ public static function restore_from_backup(): array {
+ global $wpdb;
+
+ $result = array(
+ 'restored' => array(),
+ 'skipped' => array(),
+ 'errors' => array(),
+ );
+
+ foreach ( self::get_backup_tables() as $table ) {
+ $original = self::original_name( $table );
+
+ if ( '' === $original ) {
+ $result['errors'][] = $table;
+ continue;
+ }
+
+ if ( self::table_exists( $original ) ) {
+ $result['skipped'][] = $table;
+ continue;
+ }
+
+ // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.SchemaChange, WordPress.DB.PreparedSQL.InterpolatedNotPrepared
+ $restored = $wpdb->query( "RENAME TABLE `{$table}` TO `{$original}`" );
+
+ if ( false === $restored ) {
+ $result['errors'][] = $table;
+ } else {
+ $result['restored'][] = $table;
+ }
+ }
+
+ return $result;
+ }
+
+ /**
+ * Check whether a table exists in the database.
+ *
+ * @param string $table Full table name.
+ * @return bool
+ */
+ private static function table_exists( string $table ): bool {
+ global $wpdb;
+
+ // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
+ return (string) $wpdb->get_var( $wpdb->prepare( 'SHOW TABLES LIKE %s', $table ) ) === $table;
+ }
+}
diff --git a/includes/class-robotstxt-mlp2-mlp5-wizard-state.php b/includes/class-robotstxt-mlp2-mlp5-wizard-state.php
new file mode 100644
index 0000000..a044373
--- /dev/null
+++ b/includes/class-robotstxt-mlp2-mlp5-wizard-state.php
@@ -0,0 +1,151 @@
+get_content_relations_table();
+
+ if ( '' === $table ) {
+ return false;
+ }
+
+ // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
+ $found = (int) $wpdb->get_var(
+ $wpdb->prepare(
+ // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared
+ "SELECT COUNT(*) FROM `{$table}` WHERE site_id = %d AND content_id = %d",
+ $site_id,
+ $content_id
+ )
+ );
+
+ return $found > 0;
+ }
+
+ /**
+ * Create a relationship group in MLP5 for the given members.
+ *
+ * Inserts one row into mlp_relationships and one row per member into
+ * mlp_content_relations. Wrapped in a transaction for atomicity.
+ *
+ * @param string $type WordPress content type: post type slug or taxonomy name.
+ * Pass 'post' for standard posts, 'term' for terms.
+ * @param array[] $members Array of ['site_id' => int, 'element_id' => int].
+ * @return bool True on success, false on any DB error.
+ */
+ public static function create_group( string $type, array $members ): bool {
+ global $wpdb;
+
+ $mlp5 = new Robotstxt_Mlp2_Mlp5_Detector_Mlp5();
+ $rel_table = $mlp5->get_relationships_table();
+ $cont_table = $mlp5->get_content_relations_table();
+
+ if ( '' === $rel_table || '' === $cont_table ) {
+ return false;
+ }
+
+ // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
+ $wpdb->query( 'START TRANSACTION' );
+
+ // Insert relationship group.
+ // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
+ $inserted = $wpdb->insert(
+ $rel_table,
+ array( 'type' => $type ),
+ array( '%s' )
+ );
+
+ if ( false === $inserted ) {
+ // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
+ $wpdb->query( 'ROLLBACK' );
+ return false;
+ }
+
+ $relationship_id = (int) $wpdb->insert_id;
+
+ // Insert each member.
+ foreach ( $members as $member ) {
+ // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
+ $ok = $wpdb->insert(
+ $cont_table,
+ array(
+ 'relationship_id' => $relationship_id,
+ 'site_id' => (int) $member['site_id'],
+ 'content_id' => (int) $member['element_id'],
+ ),
+ array( '%d', '%d', '%d' )
+ );
+
+ if ( false === $ok ) {
+ // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
+ $wpdb->query( 'ROLLBACK' );
+ return false;
+ }
+ }
+
+ // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
+ $wpdb->query( 'COMMIT' );
+ return true;
+ }
+}
diff --git a/includes/class-robotstxt-mlp2-mlp5-writer-site-relations.php b/includes/class-robotstxt-mlp2-mlp5-writer-site-relations.php
new file mode 100644
index 0000000..6ae84d6
--- /dev/null
+++ b/includes/class-robotstxt-mlp2-mlp5-writer-site-relations.php
@@ -0,0 +1,96 @@
+get_site_relations_table();
+
+ if ( '' === $table ) {
+ return false;
+ }
+
+ // Normalise: site_1 must be the lower value.
+ if ( $site_1 > $site_2 ) {
+ list( $site_1, $site_2 ) = array( $site_2, $site_1 );
+ }
+
+ // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
+ $found = $wpdb->get_var(
+ $wpdb->prepare(
+ // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared
+ "SELECT COUNT(*) FROM `{$table}` WHERE site_1 = %d AND site_2 = %d",
+ $site_1,
+ $site_2
+ )
+ );
+
+ return (int) $found > 0;
+ }
+
+ /**
+ * Write a site relation to MLP5.
+ *
+ * Normalises site IDs (smaller value in site_1) before inserting.
+ * Returns false if the target table does not exist.
+ *
+ * @param int $site_1 First site ID.
+ * @param int $site_2 Second site ID.
+ * @return bool True on success, false on failure.
+ */
+ public static function write_relation( int $site_1, int $site_2 ): bool {
+ global $wpdb;
+
+ $mlp5 = new Robotstxt_Mlp2_Mlp5_Detector_Mlp5();
+ $table = $mlp5->get_site_relations_table();
+
+ if ( '' === $table ) {
+ return false;
+ }
+
+ // Normalise.
+ if ( $site_1 > $site_2 ) {
+ list( $site_1, $site_2 ) = array( $site_2, $site_1 );
+ }
+
+ // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
+ $result = $wpdb->insert(
+ $table,
+ array(
+ 'site_1' => $site_1,
+ 'site_2' => $site_2,
+ ),
+ array( '%d', '%d' )
+ );
+
+ return false !== $result;
+ }
+}
diff --git a/includes/class-robotstxt-mlp2-mlp5.php b/includes/class-robotstxt-mlp2-mlp5.php
new file mode 100644
index 0000000..801a0f0
--- /dev/null
+++ b/includes/class-robotstxt-mlp2-mlp5.php
@@ -0,0 +1,115 @@
+register_hooks();
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param string $plugin_file Absolute path to the main plugin file.
+ */
+ private function __construct( string $plugin_file ) {
+ $this->plugin_file = $plugin_file;
+ }
+
+ /**
+ * Register WordPress hooks.
+ */
+ private function register_hooks(): void {
+ register_activation_hook( $this->plugin_file, array( $this, 'activate' ) );
+ register_deactivation_hook( $this->plugin_file, array( $this, 'deactivate' ) );
+ add_action( 'admin_notices', array( $this, 'multisite_notice' ) );
+ add_action( 'plugins_loaded', array( $this, 'load_textdomain' ) );
+ // Run pending DB upgrades on every request after a plugin update.
+ add_action( 'plugins_loaded', array( 'Robotstxt_Mlp2_Mlp5_Db_Upgrader', 'maybe_upgrade' ) );
+ // Register AJAX handlers for the batch migration runner.
+ Robotstxt_Mlp2_Mlp5_Ajax::register();
+ // Register the Network Admin page (network_admin_menu hook fires inside).
+ Robotstxt_Mlp2_Mlp5_Admin_Page::init();
+ }
+
+ /**
+ * Plugin activation callback.
+ *
+ * Prevents activation on non-Multisite installations. On Multisite,
+ * creates the migration log table.
+ */
+ public function activate(): void {
+ if ( ! is_multisite() ) {
+ deactivate_plugins( plugin_basename( $this->plugin_file ), true );
+ wp_die(
+ esc_html__( 'MLP2 to MLP5 Migrator requires a WordPress Multisite installation.', 'robotstxt-mlp2-mlp5' ),
+ esc_html__( 'Plugin Activation Error', 'robotstxt-mlp2-mlp5' ),
+ array( 'back_link' => true )
+ );
+ }
+
+ Robotstxt_Mlp2_Mlp5_Db_Upgrader::maybe_upgrade();
+ }
+
+ /**
+ * Plugin deactivation callback.
+ */
+ public function deactivate(): void {
+ // Reserved for future cleanup on deactivation.
+ }
+
+ /**
+ * Display an admin notice when the plugin is loaded on a non-Multisite installation.
+ *
+ * Belt-and-suspenders guard in case the plugin ends up loaded outside of
+ * the network activation flow.
+ */
+ public function multisite_notice(): void {
+ if ( is_multisite() ) {
+ return;
+ }
+
+ printf(
+ '
%s
',
+ esc_html__( 'MLP2 to MLP5 Migrator requires a WordPress Multisite installation and has been deactivated.', 'robotstxt-mlp2-mlp5' )
+ );
+ }
+
+ /**
+ * Load the plugin text domain for internationalization.
+ */
+ public function load_textdomain(): void {
+ load_plugin_textdomain(
+ 'robotstxt-mlp2-mlp5',
+ false,
+ dirname( plugin_basename( $this->plugin_file ) ) . '/languages'
+ );
+ }
+}
diff --git a/languages/robotstxt-mlp2-mlp5-es_ES.mo b/languages/robotstxt-mlp2-mlp5-es_ES.mo
new file mode 100644
index 0000000..06d4530
Binary files /dev/null and b/languages/robotstxt-mlp2-mlp5-es_ES.mo differ
diff --git a/languages/robotstxt-mlp2-mlp5-es_ES.po b/languages/robotstxt-mlp2-mlp5-es_ES.po
new file mode 100644
index 0000000..cd7e0ff
--- /dev/null
+++ b/languages/robotstxt-mlp2-mlp5-es_ES.po
@@ -0,0 +1,474 @@
+# Spanish (Spain) translation for MLP2 to MLP5 (by ROBOTSTXT)
+# Copyright (C) 2026 ROBOTSTXT
+# This file is distributed under the GPL-3.0-or-later.
+msgid ""
+msgstr ""
+"Project-Id-Version: MLP2 to MLP5 (by ROBOTSTXT) 1.0.0\n"
+"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/robotstxt-mlp2-mlp5\n"
+"POT-Creation-Date: 2026-02-27T09:58:57+00:00\n"
+"PO-Revision-Date: 2026-02-27 10:00+0000\n"
+"Last-Translator: ROBOTSTXT \n"
+"Language-Team: Spanish (Spain) \n"
+"Language: es_ES\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+"X-Generator: Manual\n"
+"X-Domain: robotstxt-mlp2-mlp5\n"
+
+#. Plugin Name of the plugin
+msgid "MLP2 to MLP5 Migrator"
+msgstr "MLP2 to MLP5 (by ROBOTSTXT)"
+
+#. Plugin URI of the plugin
+msgid "https://git.robotstxt.es/ROBOTSTXT/robotstxt-mlp2-mlp5"
+msgstr "https://git.robotstxt.es/ROBOTSTXT/robotstxt-mlp2-mlp5"
+
+#. Description of the plugin
+msgid "Guided, safe, and reversible migration from MultilingualPress 2 to MultilingualPress 5."
+msgstr "Migración guiada, segura y reversible de MultilingualPress 2 a MultilingualPress 5."
+
+#. Author of the plugin
+msgid "ROBOTSTXT"
+msgstr "ROBOTSTXT"
+
+#. Author URI of the plugin
+msgid "https://git.robotstxt.es/ROBOTSTXT"
+msgstr "https://git.robotstxt.es/ROBOTSTXT"
+
+msgid "MLP Migrator"
+msgstr "MLP Migrator"
+
+msgid "You do not have permission to perform this action."
+msgstr "No tienes permiso para realizar esta acción."
+
+msgid "You do not have permission to access this page."
+msgstr "No tienes permiso para acceder a esta página."
+
+msgid "You do not have permission to export the log."
+msgstr "No tienes permiso para exportar el registro."
+
+msgid "Preflight"
+msgstr "Comprobaciones previas"
+
+msgid "Analysis"
+msgstr "Análisis"
+
+msgid "Site Relations"
+msgstr "Relaciones de sitios"
+
+msgid "Content Relations"
+msgstr "Relaciones de contenido"
+
+msgid "Verification"
+msgstr "Verificación"
+
+msgid "Cleanup"
+msgstr "Limpieza"
+
+msgid "Reset migration (start over)"
+msgstr "Reiniciar migración (empezar de nuevo)"
+
+msgid "This will reset the wizard to Step 1 and clear the migration log. It does not modify MLP5 data."
+msgstr "Esto restablecerá el asistente al Paso 1 y borrará el registro de migración. No modifica los datos de MLP5."
+
+msgid "Reset wizard"
+msgstr "Reiniciar asistente"
+
+msgid "System status"
+msgstr "Estado del sistema"
+
+#, php-format
+msgid "%d table renamed successfully."
+msgid_plural "%d tables renamed successfully."
+msgstr[0] "%d tabla renombrada correctamente."
+msgstr[1] "%d tablas renombradas correctamente."
+
+#, php-format
+msgid "%d table could not be renamed. Check database permissions."
+msgid_plural "%d tables could not be renamed. Check database permissions."
+msgstr[0] "%d tabla no pudo renombrarse. Comprueba los permisos de la base de datos."
+msgstr[1] "%d tablas no pudieron renombrarse. Comprueba los permisos de la base de datos."
+
+#, php-format
+msgid "%d table restored to original name."
+msgid_plural "%d tables restored to original names."
+msgstr[0] "%d tabla restaurada a su nombre original."
+msgstr[1] "%d tablas restauradas a sus nombres originales."
+
+#, php-format
+msgid "%d table could not be restored. Check database permissions."
+msgid_plural "%d tables could not be restored. Check database permissions."
+msgstr[0] "%d tabla no pudo restaurarse. Comprueba los permisos de la base de datos."
+msgstr[1] "%d tablas no pudieron restaurarse. Comprueba los permisos de la base de datos."
+
+msgid "Wizard reset. You can start the migration from Step 1."
+msgstr "Asistente reiniciado. Puedes iniciar la migración desde el Paso 1."
+
+msgid "Cleanup completed."
+msgstr "Limpieza completada."
+
+msgid "Cleanup confirmation invalid. Type DELETE exactly."
+msgstr "Confirmación de limpieza inválida. Escribe DELETE exactamente."
+
+msgid "Action required: MLP2 tables must be renamed before MultilingualPress 5 can be activated."
+msgstr "Acción requerida: las tablas de MLP2 deben renombrarse antes de activar MultilingualPress 5."
+
+msgid "MLP2 tables renamed. Now go to Network Admin > Plugins and activate MultilingualPress 5."
+msgstr "Tablas de MLP2 renombradas. Ve a Administración de red > Plugins y activa MultilingualPress 5."
+
+msgid "Warning: both original and backup MLP2 tables were found. Investigate before proceeding."
+msgstr "Advertencia: se encontraron tanto las tablas originales como las de copia de seguridad de MLP2. Investiga antes de continuar."
+
+msgid "No MLP2 tables found. Migration cannot proceed. Restore your database from a backup."
+msgstr "No se encontraron tablas de MLP2. La migración no puede continuar. Restaura tu base de datos desde una copia de seguridad."
+
+msgid "System Status"
+msgstr "Estado del sistema"
+
+msgid "MLP2 tables (original names)"
+msgstr "Tablas de MLP2 (nombres originales)"
+
+#, php-format
+msgid "%d table — must be renamed"
+msgid_plural "%d tables — must be renamed"
+msgstr[0] "%d tabla — debe renombrarse"
+msgstr[1] "%d tablas — deben renombrarse"
+
+msgid "None"
+msgstr "Ninguna"
+
+msgid "MLP2 tables (backup copies)"
+msgstr "Tablas de MLP2 (copias de seguridad)"
+
+#, php-format
+msgid "%d backup table ready"
+msgid_plural "%d backup tables ready"
+msgstr[0] "%d tabla de copia de seguridad lista"
+msgstr[1] "%d tablas de copia de seguridad listas"
+
+msgid "Not yet renamed"
+msgstr "Aún no renombradas"
+
+msgid "MultilingualPress 5 (network-active)"
+msgstr "MultilingualPress 5 (activo en red)"
+
+#, php-format
+msgid "Active (v%s)"
+msgstr "Activo (v%s)"
+
+msgid "Not active"
+msgstr "No activo"
+
+msgid "Step 1 — Rename MLP2 Tables"
+msgstr "Paso 1 — Renombrar tablas de MLP2"
+
+msgid "MultilingualPress 5 cannot activate while the original MLP2 table names are present. Click below to rename them to temporary backup copies ({prefix}mlp2bak_*). This is safe and fully reversible."
+msgstr "MultilingualPress 5 no puede activarse mientras existan los nombres originales de las tablas de MLP2. Haz clic abajo para renombrarlas a copias de seguridad temporales ({prefix}mlp2bak_*). Esta operación es segura y totalmente reversible."
+
+msgid "Rename MLP2 tables (prepare for MLP5 activation)"
+msgstr "Renombrar tablas de MLP2 (preparar para activar MLP5)"
+
+msgid "Step 2 — Activate MultilingualPress 5"
+msgstr "Paso 2 — Activar MultilingualPress 5"
+
+msgid "MLP2 tables have been renamed. MultilingualPress 5 can now be activated without the old-version compatibility error."
+msgstr "Las tablas de MLP2 han sido renombradas. MultilingualPress 5 ya puede activarse sin el error de compatibilidad de versión antigua."
+
+msgid "Go to Network Admin › Plugins"
+msgstr "Ir a Administración de red › Plugins"
+
+msgid "Emergency: restore original MLP2 table names"
+msgstr "Emergencia: restaurar nombres originales de tablas MLP2"
+
+msgid "This renames backup tables back to their original MLP2 names. Only use this before MLP5 has been activated."
+msgstr "Esto restaura las tablas de copia de seguridad a sus nombres originales de MLP2. Úsalo solo antes de que MLP5 haya sido activado."
+
+msgid "Restore original table names"
+msgstr "Restaurar nombres de tabla originales"
+
+msgid "Step 2 — Analysis"
+msgstr "Paso 2 — Análisis"
+
+msgid "Click \"Run Analysis\" to scan the MLP2 backup database and validate MLP5 schema compatibility before migrating."
+msgstr "Haz clic en «Ejecutar análisis» para analizar la base de datos de copia de seguridad de MLP2 y validar la compatibilidad del esquema de MLP5 antes de migrar."
+
+msgid "Run Analysis"
+msgstr "Ejecutar análisis"
+
+msgid "MLP5 schema incompatibility detected:"
+msgstr "Incompatibilidad de esquema MLP5 detectada:"
+
+msgid "Category"
+msgstr "Categoría"
+
+msgid "Records found"
+msgstr "Registros encontrados"
+
+msgid "Site relations"
+msgstr "Relaciones de sitios"
+
+msgid "Post relation groups"
+msgstr "Grupos de relaciones de entradas"
+
+msgid "Term relation groups"
+msgstr "Grupos de relaciones de términos"
+
+msgid "Conflicts (will be skipped and logged)"
+msgstr "Conflictos (se omitirán y registrarán)"
+
+msgid "Orphaned sites"
+msgstr "Sitios huérfanos"
+
+msgid "Orphaned post references"
+msgstr "Referencias de entradas huérfanas"
+
+msgid "Orphaned term references"
+msgstr "Referencias de términos huérfanas"
+
+msgid "Duplicate relation rows"
+msgstr "Filas de relaciones duplicadas"
+
+msgid "Re-run Analysis"
+msgstr "Volver a ejecutar análisis"
+
+msgid "Next: Migrate Site Relations"
+msgstr "Siguiente: migrar relaciones de sitios"
+
+msgid "MLP5 tables not found. Ensure MultilingualPress 5 is active and has been initialized."
+msgstr "No se encontraron las tablas de MLP5. Asegúrate de que MultilingualPress 5 está activo e inicializado."
+
+#, php-format
+msgid "Table %s does not have expected columns (site_1, site_2)."
+msgstr "La tabla %s no tiene las columnas esperadas (site_1, site_2)."
+
+#, php-format
+msgid "Table %s does not have expected columns (relationship_id, site_id, content_id)."
+msgstr "La tabla %s no tiene las columnas esperadas (relationship_id, site_id, content_id)."
+
+#, php-format
+msgid "Table %s does not have expected columns (id, type)."
+msgstr "La tabla %s no tiene las columnas esperadas (id, type)."
+
+#, php-format
+msgid "MLP2 backup table %2$s is missing expected column \"%1$s\". Schema may differ from expected."
+msgstr "La tabla de copia de seguridad de MLP2 %2$s no tiene la columna esperada «%1$s». El esquema puede diferir del esperado."
+
+msgid "MLP2 deactivation: plugin is already inactive."
+msgstr "Desactivación de MLP2: el plugin ya estaba inactivo."
+
+msgid "MLP2 plugin deactivated network-wide."
+msgstr "Plugin MLP2 desactivado en toda la red."
+
+#, php-format
+msgid "Failed to drop backup table: %s"
+msgstr "Error al eliminar la tabla de copia de seguridad: %s"
+
+#, php-format
+msgid "Backup table dropped: %s"
+msgstr "Tabla de copia de seguridad eliminada: %s"
+
+#, php-format
+msgid "Removed %d MLP2 sitemeta entries."
+msgstr "Se eliminaron %d entradas de sitemeta de MLP2."
+
+msgid "Step 6 — Cleanup (Optional)"
+msgstr "Paso 6 — Limpieza (opcional)"
+
+msgid "Migration complete!"
+msgstr "¡Migración completada!"
+
+msgid "MultilingualPress 5 is now configured with your migrated data. Verify that everything works before performing the optional cleanup below."
+msgstr "MultilingualPress 5 está ahora configurado con tus datos migrados. Verifica que todo funciona antes de realizar la limpieza opcional a continuación."
+
+msgid "The cleanup actions below are optional and irreversible. MultilingualPress 5 will work correctly whether or not you perform them."
+msgstr "Las acciones de limpieza a continuación son opcionales e irreversibles. MultilingualPress 5 funcionará correctamente tanto si las realizas como si no."
+
+msgid "Deactivate MultilingualPress 2 (network-wide)"
+msgstr "Desactivar MultilingualPress 2 (en toda la red)"
+
+msgid "Deactivate MultilingualPress 2"
+msgstr "Desactivar MultilingualPress 2"
+
+msgid "already inactive"
+msgstr "ya inactivo"
+
+msgid "Delete MLP2 backup database tables"
+msgstr "Eliminar tablas de copia de seguridad de MLP2"
+
+#, php-format
+msgid "%d table"
+msgid_plural "%d tables"
+msgstr[0] "%d tabla"
+msgstr[1] "%d tablas"
+
+msgid "Irreversible. Only do this after verifying the migration in MLP5."
+msgstr "Irreversible. Hazlo solo tras verificar la migración en MLP5."
+
+msgid "Delete MLP2 network settings from wp_sitemeta"
+msgstr "Eliminar configuración de red de MLP2 de wp_sitemeta"
+
+msgid "Type DELETE to confirm:"
+msgstr "Escribe DELETE para confirmar:"
+
+msgid "Proceed with cleanup"
+msgstr "Proceder con la limpieza"
+
+msgid "Step 4 — Content Relations"
+msgstr "Paso 4 — Relaciones de contenido"
+
+msgid "This step migrates all post and term relationships in batches. On large sites this can take several minutes. You can pause and resume at any time."
+msgstr "Este paso migra todas las relaciones de entradas y términos en lotes. En sitios grandes puede tardar varios minutos. Puedes pausar y reanudar en cualquier momento."
+
+#, php-format
+msgid "Processed %1$s of %2$s groups"
+msgstr "Procesados %1$s de %2$s grupos"
+
+msgid "Migrated"
+msgstr "Migrados"
+
+msgid "Skipped"
+msgstr "Omitidos"
+
+msgid "Errors"
+msgstr "Errores"
+
+msgid "Content relations migration complete."
+msgstr "Migración de relaciones de contenido completada."
+
+msgid "Resume"
+msgstr "Reanudar"
+
+msgid "Start"
+msgstr "Iniciar"
+
+msgid "Pause"
+msgstr "Pausar"
+
+msgid "Next: Verification"
+msgstr "Siguiente: verificación"
+
+msgid "Error during migration."
+msgstr "Error durante la migración."
+
+msgid "Done! Reload the page to continue."
+msgstr "¡Completado! Recarga la página para continuar."
+
+msgid "Network error. Click Resume to continue."
+msgstr "Error de red. Haz clic en Reanudar para continuar."
+
+msgid "Running…"
+msgstr "Ejecutando…"
+
+msgid "Paused."
+msgstr "Pausado."
+
+msgid "Relation already exists in MLP5 (idempotent skip)."
+msgstr "La relación ya existe en MLP5 (omisión idempotente)."
+
+msgid "Fewer than 2 valid members after orphan check. Skipped."
+msgstr "Menos de 2 miembros válidos tras la comprobación de huérfanos. Omitido."
+
+#, php-format
+msgid "Group migrated with %d members."
+msgstr "Grupo migrado con %d miembros."
+
+msgid "Failed to write group to MLP5."
+msgstr "Error al escribir el grupo en MLP5."
+
+msgid "MLP2 tables have not been renamed yet. Go back to the plugin status page and click \"Rename MLP2 tables\"."
+msgstr "Las tablas de MLP2 aún no se han renombrado. Vuelve a la página de estado del plugin y haz clic en «Renombrar tablas de MLP2»."
+
+msgid "No MLP2 tables found (neither original nor backup). Restore your database from a backup before proceeding."
+msgstr "No se encontraron tablas de MLP2 (ni originales ni de copia de seguridad). Restaura tu base de datos desde una copia de seguridad antes de continuar."
+
+msgid "MultilingualPress 5 is not network-active. Activate it before running the migration."
+msgstr "MultilingualPress 5 no está activo en red. Actívalo antes de ejecutar la migración."
+
+msgid "Step 1 — Preflight Checks"
+msgstr "Paso 1 — Comprobaciones previas"
+
+msgid "MLP2 backup tables (preparation done)"
+msgstr "Tablas de copia de seguridad de MLP2 (preparación completada)"
+
+#, php-format
+msgid "%d table ready"
+msgid_plural "%d tables ready"
+msgstr[0] "%d tabla lista"
+msgstr[1] "%d tablas listas"
+
+msgid "Original tables still present — rename step not done"
+msgstr "Tablas originales aún presentes — paso de renombrado no completado"
+
+msgid "No MLP2 tables found"
+msgstr "No se encontraron tablas de MLP2"
+
+msgid "MLP2 plugin (active — informational only)"
+msgstr "Plugin MLP2 (activo — solo informativo)"
+
+msgid "Active — consider deactivating before proceeding"
+msgstr "Activo — considera desactivarlo antes de continuar"
+
+msgid "Inactive (expected)"
+msgstr "Inactivo (esperado)"
+
+msgid "Next: Run Analysis"
+msgstr "Siguiente: ejecutar análisis"
+
+msgid "Resolve the issues above before continuing."
+msgstr "Resuelve los problemas anteriores antes de continuar."
+
+msgid "One or both sites no longer exist in the network."
+msgstr "Uno o ambos sitios ya no existen en la red."
+
+msgid "Site relation migrated successfully."
+msgstr "Relación de sitios migrada correctamente."
+
+msgid "Failed to write site relation to MLP5."
+msgstr "Error al escribir la relación de sitios en MLP5."
+
+msgid "Step 3 — Site Relations"
+msgstr "Paso 3 — Relaciones de sitios"
+
+msgid "This step migrates site connections and language assignments from MLP2 to MLP5. It usually completes in seconds."
+msgstr "Este paso migra las conexiones de sitios y las asignaciones de idioma de MLP2 a MLP5. Suele completarse en segundos."
+
+msgid "Re-run Site Relations"
+msgstr "Volver a ejecutar relaciones de sitios"
+
+msgid "Start Site Relations Migration"
+msgstr "Iniciar migración de relaciones de sitios"
+
+msgid "Next: Content Relations"
+msgstr "Siguiente: relaciones de contenido"
+
+msgid "Post Relations"
+msgstr "Relaciones de entradas"
+
+msgid "Term Relations"
+msgstr "Relaciones de términos"
+
+msgid "Step 5 — Verification"
+msgstr "Paso 5 — Verificación"
+
+msgid "Compare expected totals (from the Analysis step) with actual migration results. Download the full log before proceeding to cleanup."
+msgstr "Compara los totales esperados (del paso de Análisis) con los resultados reales de la migración. Descarga el registro completo antes de proceder a la limpieza."
+
+msgid "Expected"
+msgstr "Esperados"
+
+msgid "Download log (CSV)"
+msgstr "Descargar registro (CSV)"
+
+msgid "Next: Cleanup"
+msgstr "Siguiente: limpieza"
+
+msgid "MLP2 to MLP5 Migrator requires a WordPress Multisite installation."
+msgstr "MLP2 to MLP5 (by ROBOTSTXT) requiere una instalación de WordPress Multisitio."
+
+msgid "Plugin Activation Error"
+msgstr "Error de activación del plugin"
+
+msgid "MLP2 to MLP5 Migrator requires a WordPress Multisite installation and has been deactivated."
+msgstr "MLP2 to MLP5 (by ROBOTSTXT) requiere una instalación de WordPress Multisitio y ha sido desactivado."
diff --git a/languages/robotstxt-mlp2-mlp5.pot b/languages/robotstxt-mlp2-mlp5.pot
new file mode 100644
index 0000000..19bf9b3
--- /dev/null
+++ b/languages/robotstxt-mlp2-mlp5.pot
@@ -0,0 +1,649 @@
+# Copyright (C) 2026 ROBOTSTXT
+# This file is distributed under the GPL-3.0-or-later.
+msgid ""
+msgstr ""
+"Project-Id-Version: MLP2 to MLP5 (by ROBOTSTXT) 1.0.0\n"
+"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/robotstxt-mlp2-mlp5\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"POT-Creation-Date: 2026-02-27T10:21:22+00:00\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"X-Generator: WP-CLI 2.12.0\n"
+"X-Domain: robotstxt-mlp2-mlp5\n"
+
+#. Plugin Name of the plugin
+#: robotstxt-mlp2-mlp5.php
+msgid "MLP2 to MLP5 (by ROBOTSTXT)"
+msgstr ""
+
+#. Plugin URI of the plugin
+#: robotstxt-mlp2-mlp5.php
+msgid "https://git.robotstxt.es/ROBOTSTXT/robotstxt-mlp2-mlp5"
+msgstr ""
+
+#. Description of the plugin
+#: robotstxt-mlp2-mlp5.php
+msgid "Guided, safe, and reversible migration from MultilingualPress 2 to MultilingualPress 5."
+msgstr ""
+
+#. Author of the plugin
+#: robotstxt-mlp2-mlp5.php
+msgid "ROBOTSTXT"
+msgstr ""
+
+#. Author URI of the plugin
+#: robotstxt-mlp2-mlp5.php
+msgid "https://git.robotstxt.es/ROBOTSTXT"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-admin-page.php:61
+#: includes/class-robotstxt-mlp2-mlp5-admin-page.php:290
+msgid "MLP2 to MLP5 Migrator"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-admin-page.php:62
+msgid "MLP Migrator"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-admin-page.php:90
+#: includes/class-robotstxt-mlp2-mlp5-admin-page.php:107
+#: includes/class-robotstxt-mlp2-mlp5-admin-page.php:131
+#: includes/class-robotstxt-mlp2-mlp5-admin-page.php:254
+msgid "You do not have permission to perform this action."
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-admin-page.php:271
+msgid "You do not have permission to access this page."
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-admin-page.php:321
+msgid "Preflight"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-admin-page.php:322
+msgid "Analysis"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-admin-page.php:323
+#: includes/class-robotstxt-mlp2-mlp5-step-verification.php:30
+msgid "Site Relations"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-admin-page.php:324
+msgid "Content Relations"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-admin-page.php:325
+msgid "Verification"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-admin-page.php:326
+msgid "Cleanup"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-admin-page.php:383
+msgid "Reset migration (start over)"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-admin-page.php:385
+msgid "This will reset the wizard to Step 1 and clear the migration log. It does not modify MLP5 data."
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-admin-page.php:389
+msgid "Reset wizard"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-admin-page.php:398
+msgid "System status"
+msgstr ""
+
+#. translators: %d: number of renamed tables
+#: includes/class-robotstxt-mlp2-mlp5-admin-page.php:419
+#, php-format
+msgid "%d table renamed successfully."
+msgid_plural "%d tables renamed successfully."
+msgstr[0] ""
+msgstr[1] ""
+
+#. translators: %d: number of tables that could not be renamed
+#: includes/class-robotstxt-mlp2-mlp5-admin-page.php:424
+#, php-format
+msgid "%d table could not be renamed. Check database permissions."
+msgid_plural "%d tables could not be renamed. Check database permissions."
+msgstr[0] ""
+msgstr[1] ""
+
+#. translators: %d: number of restored tables
+#: includes/class-robotstxt-mlp2-mlp5-admin-page.php:429
+#, php-format
+msgid "%d table restored to original name."
+msgid_plural "%d tables restored to original names."
+msgstr[0] ""
+msgstr[1] ""
+
+#. translators: %d: number of tables that could not be restored
+#: includes/class-robotstxt-mlp2-mlp5-admin-page.php:434
+#, php-format
+msgid "%d table could not be restored. Check database permissions."
+msgid_plural "%d tables could not be restored. Check database permissions."
+msgstr[0] ""
+msgstr[1] ""
+
+#: includes/class-robotstxt-mlp2-mlp5-admin-page.php:437
+msgid "Wizard reset. You can start the migration from Step 1."
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-admin-page.php:440
+msgid "Cleanup completed."
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-admin-page.php:443
+msgid "Cleanup confirmation invalid. Type DELETE exactly."
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-admin-page.php:458
+msgid "Action required: MLP2 tables must be renamed before MultilingualPress 5 can be activated."
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-admin-page.php:461
+msgid "MLP2 tables renamed. Now go to Network Admin > Plugins and activate MultilingualPress 5."
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-admin-page.php:464
+msgid "Warning: both original and backup MLP2 tables were found. Investigate before proceeding."
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-admin-page.php:467
+msgid "No MLP2 tables found. Migration cannot proceed. Restore your database from a backup."
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-admin-page.php:494
+msgid "System Status"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-admin-page.php:498
+msgid "MLP2 tables (original names)"
+msgstr ""
+
+#. translators: %d: number of tables
+#: includes/class-robotstxt-mlp2-mlp5-admin-page.php:501
+#, php-format
+msgid "%d table — must be renamed"
+msgid_plural "%d tables — must be renamed"
+msgstr[0] ""
+msgstr[1] ""
+
+#: includes/class-robotstxt-mlp2-mlp5-admin-page.php:503
+msgid "None"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-admin-page.php:508
+msgid "MLP2 tables (backup copies)"
+msgstr ""
+
+#. translators: %d: number of backup tables
+#: includes/class-robotstxt-mlp2-mlp5-admin-page.php:511
+#, php-format
+msgid "%d backup table ready"
+msgid_plural "%d backup tables ready"
+msgstr[0] ""
+msgstr[1] ""
+
+#: includes/class-robotstxt-mlp2-mlp5-admin-page.php:513
+msgid "Not yet renamed"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-admin-page.php:518
+#: includes/class-robotstxt-mlp2-mlp5-step-preflight.php:105
+msgid "MultilingualPress 5 (network-active)"
+msgstr ""
+
+#. translators: %s: version
+#: includes/class-robotstxt-mlp2-mlp5-admin-page.php:521
+#: includes/class-robotstxt-mlp2-mlp5-step-preflight.php:108
+#, php-format
+msgid "Active (v%s)"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-admin-page.php:523
+#: includes/class-robotstxt-mlp2-mlp5-step-preflight.php:110
+msgid "Not active"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-admin-page.php:544
+msgid "Step 1 — Rename MLP2 Tables"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-admin-page.php:545
+msgid "MultilingualPress 5 cannot activate while the original MLP2 table names are present. Click below to rename them to temporary backup copies ({prefix}mlp2bak_*). This is safe and fully reversible."
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-admin-page.php:549
+msgid "Rename MLP2 tables (prepare for MLP5 activation)"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-admin-page.php:558
+msgid "Step 2 — Activate MultilingualPress 5"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-admin-page.php:559
+msgid "MLP2 tables have been renamed. MultilingualPress 5 can now be activated without the old-version compatibility error."
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-admin-page.php:560
+msgid "Go to Network Admin › Plugins"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-admin-page.php:569
+msgid "Emergency: restore original MLP2 table names"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-admin-page.php:571
+msgid "This renames backup tables back to their original MLP2 names. Only use this before MLP5 has been activated."
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-admin-page.php:575
+msgid "Restore original table names"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-analysis.php:112
+msgid "Step 2 — Analysis"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-analysis.php:115
+msgid "Click \"Run Analysis\" to scan the MLP2 backup database and validate MLP5 schema compatibility before migrating."
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-analysis.php:120
+msgid "Run Analysis"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-analysis.php:126
+msgid "MLP5 schema incompatibility detected:"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-analysis.php:131
+#: includes/class-robotstxt-mlp2-mlp5-step-verification.php:111
+msgid "Category"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-analysis.php:131
+msgid "Records found"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-analysis.php:133
+msgid "Site relations"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-analysis.php:134
+msgid "Post relation groups"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-analysis.php:135
+msgid "Term relation groups"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-analysis.php:140
+msgid "Conflicts (will be skipped and logged)"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-analysis.php:144
+msgid "Orphaned sites"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-analysis.php:147
+msgid "Orphaned post references"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-analysis.php:150
+msgid "Orphaned term references"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-analysis.php:153
+msgid "Duplicate relation rows"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-analysis.php:164
+msgid "Re-run Analysis"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-analysis.php:171
+msgid "Next: Migrate Site Relations"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-analysis.php:320
+msgid "MLP5 tables not found. Ensure MultilingualPress 5 is active and has been initialized."
+msgstr ""
+
+#. translators: %s: table name
+#: includes/class-robotstxt-mlp2-mlp5-step-analysis.php:326
+#, php-format
+msgid "Table %s does not have expected columns (site_1, site_2)."
+msgstr ""
+
+#. translators: %s: table name
+#: includes/class-robotstxt-mlp2-mlp5-step-analysis.php:332
+#, php-format
+msgid "Table %s does not have expected columns (relationship_id, site_id, content_id)."
+msgstr ""
+
+#. translators: %s: table name
+#: includes/class-robotstxt-mlp2-mlp5-step-analysis.php:339
+#, php-format
+msgid "Table %s does not have expected columns (id, type)."
+msgstr ""
+
+#. translators: 1: column name, 2: table name
+#: includes/class-robotstxt-mlp2-mlp5-step-analysis.php:349
+#, php-format
+msgid "MLP2 backup table %2$s is missing expected column \"%1$s\". Schema may differ from expected."
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-cleanup.php:34
+msgid "MLP2 deactivation: plugin is already inactive."
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-cleanup.php:43
+msgid "MLP2 plugin deactivated network-wide."
+msgstr ""
+
+#. translators: %s: table name
+#: includes/class-robotstxt-mlp2-mlp5-step-cleanup.php:66
+#, php-format
+msgid "Failed to drop backup table: %s"
+msgstr ""
+
+#. translators: %s: table name
+#: includes/class-robotstxt-mlp2-mlp5-step-cleanup.php:69
+#, php-format
+msgid "Backup table dropped: %s"
+msgstr ""
+
+#. translators: %d: key count
+#: includes/class-robotstxt-mlp2-mlp5-step-cleanup.php:108
+#, php-format
+msgid "Removed %d MLP2 sitemeta entries."
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-cleanup.php:119
+msgid "Step 6 — Cleanup (Optional)"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-cleanup.php:122
+msgid "Migration complete!"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-cleanup.php:122
+msgid "MultilingualPress 5 is now configured with your migrated data. Verify that everything works before performing the optional cleanup below."
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-cleanup.php:125
+msgid "The cleanup actions below are optional and irreversible. MultilingualPress 5 will work correctly whether or not you perform them."
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-cleanup.php:138
+msgid "Deactivate MultilingualPress 2 (network-wide)"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-cleanup.php:140
+msgid "Deactivate MultilingualPress 2"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-cleanup.php:141
+msgid "already inactive"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-cleanup.php:148
+msgid "Delete MLP2 backup database tables"
+msgstr ""
+
+#. translators: %d: table count
+#: includes/class-robotstxt-mlp2-mlp5-step-cleanup.php:149
+#, php-format
+msgid "%d table"
+msgid_plural "%d tables"
+msgstr[0] ""
+msgstr[1] ""
+
+#. translators: %d: table count
+#: includes/class-robotstxt-mlp2-mlp5-step-cleanup.php:150
+msgid "Irreversible. Only do this after verifying the migration in MLP5."
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-cleanup.php:156
+msgid "Delete MLP2 network settings from wp_sitemeta"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-cleanup.php:163
+msgid "Type DELETE to confirm:"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-cleanup.php:169
+msgid "Proceed with cleanup"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-content-relations.php:109
+msgid "Step 4 — Content Relations"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-content-relations.php:110
+msgid "This step migrates all post and term relationships in batches. On large sites this can take several minutes. You can pause and resume at any time."
+msgstr ""
+
+#. translators: 1: processed count, 2: total count
+#: includes/class-robotstxt-mlp2-mlp5-step-content-relations.php:117
+#, php-format
+msgid "Processed %1$s of %2$s groups"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-content-relations.php:126
+#: includes/class-robotstxt-mlp2-mlp5-step-site-relations.php:85
+#: includes/class-robotstxt-mlp2-mlp5-step-verification.php:113
+msgid "Migrated"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-content-relations.php:127
+#: includes/class-robotstxt-mlp2-mlp5-step-site-relations.php:86
+#: includes/class-robotstxt-mlp2-mlp5-step-verification.php:114
+msgid "Skipped"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-content-relations.php:128
+#: includes/class-robotstxt-mlp2-mlp5-step-site-relations.php:87
+#: includes/class-robotstxt-mlp2-mlp5-step-verification.php:115
+msgid "Errors"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-content-relations.php:134
+msgid "Content relations migration complete."
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-content-relations.php:137
+msgid "Resume"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-content-relations.php:137
+msgid "Start"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-content-relations.php:138
+msgid "Pause"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-content-relations.php:148
+msgid "Next: Verification"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-content-relations.php:175
+msgid "Error during migration."
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-content-relations.php:184
+msgid "Done! Reload the page to continue."
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-content-relations.php:193
+msgid "Network error. Click Resume to continue."
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-content-relations.php:209
+msgid "Running…"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-content-relations.php:219
+msgid "Paused."
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-content-relations.php:249
+#: includes/class-robotstxt-mlp2-mlp5-step-site-relations.php:50
+msgid "Relation already exists in MLP5 (idempotent skip)."
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-content-relations.php:278
+msgid "Fewer than 2 valid members after orphan check. Skipped."
+msgstr ""
+
+#. translators: %d: member count
+#: includes/class-robotstxt-mlp2-mlp5-step-content-relations.php:288
+#, php-format
+msgid "Group migrated with %d members."
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-content-relations.php:290
+msgid "Failed to write group to MLP5."
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-preflight.php:48
+msgid "MLP2 tables have not been renamed yet. Go back to the plugin status page and click \"Rename MLP2 tables\"."
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-preflight.php:50
+msgid "No MLP2 tables found (neither original nor backup). Restore your database from a backup before proceeding."
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-preflight.php:55
+msgid "MultilingualPress 5 is not network-active. Activate it before running the migration."
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-preflight.php:78
+msgid "Step 1 — Preflight Checks"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-preflight.php:83
+msgid "MLP2 backup tables (preparation done)"
+msgstr ""
+
+#. translators: %d: table count
+#: includes/class-robotstxt-mlp2-mlp5-step-preflight.php:86
+#, php-format
+msgid "%d table ready"
+msgid_plural "%d tables ready"
+msgstr[0] ""
+msgstr[1] ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-preflight.php:88
+msgid "Original tables still present — rename step not done"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-preflight.php:90
+msgid "No MLP2 tables found"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-preflight.php:95
+msgid "MLP2 plugin (active — informational only)"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-preflight.php:98
+msgid "Active — consider deactivating before proceeding"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-preflight.php:100
+msgid "Inactive (expected)"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-preflight.php:133
+msgid "Next: Run Analysis"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-preflight.php:136
+msgid "Resolve the issues above before continuing."
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-site-relations.php:43
+msgid "One or both sites no longer exist in the network."
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-site-relations.php:57
+msgid "Site relation migrated successfully."
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-site-relations.php:60
+msgid "Failed to write site relation to MLP5."
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-site-relations.php:79
+msgid "Step 3 — Site Relations"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-site-relations.php:80
+msgid "This step migrates site connections and language assignments from MLP2 to MLP5. It usually completes in seconds."
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-site-relations.php:98
+msgid "Re-run Site Relations"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-site-relations.php:98
+msgid "Start Site Relations Migration"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-site-relations.php:107
+msgid "Next: Content Relations"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-verification.php:34
+msgid "Post Relations"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-verification.php:38
+msgid "Term Relations"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-verification.php:81
+msgid "You do not have permission to export the log."
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-verification.php:105
+msgid "Step 5 — Verification"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-verification.php:106
+msgid "Compare expected totals (from the Analysis step) with actual migration results. Download the full log before proceeding to cleanup."
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-verification.php:112
+msgid "Expected"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-verification.php:142
+msgid "Download log (CSV)"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5-step-verification.php:150
+msgid "Next: Cleanup"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5.php:72
+msgid "MLP2 to MLP5 Migrator requires a WordPress Multisite installation."
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5.php:73
+msgid "Plugin Activation Error"
+msgstr ""
+
+#: includes/class-robotstxt-mlp2-mlp5.php:101
+msgid "MLP2 to MLP5 Migrator requires a WordPress Multisite installation and has been deactivated."
+msgstr ""
diff --git a/readme.txt b/readme.txt
new file mode 100644
index 0000000..62953cf
--- /dev/null
+++ b/readme.txt
@@ -0,0 +1,397 @@
+=== MLP2 to MLP5 (by ROBOTSTXT) ===
+Contributors: javiercasares, robotstxt
+Tags: multisite, multilingual, multilingualpress, migration, mlp
+Requires at least: 6.7
+Tested up to: 6.9
+Stable tag: 1.0.0
+Requires PHP: 8.2
+Version: 1.0.0
+License: GPL-3.0-or-later
+License URI: https://www.gnu.org/licenses/gpl-3.0.txt
+Network: true
+
+Guided, safe, and reversible migration from MultilingualPress 2 to MultilingualPress 5 for WordPress Multisite.
+
+== Description ==
+
+MLP2 to MLP5 (by ROBOTSTXT) provides a guided, safe, and reversible migration path from MultilingualPress 2 (free) to MultilingualPress 5 (premium) on WordPress Multisite.
+
+MultilingualPress 5 has a completely different architecture from version 2, making a direct upgrade impossible without losing all site connections and content relationships. This plugin bridges that gap with a preparation step and a six-step wizard that migrates your data without modifying or deleting the original MLP2 data at any point during the process.
+
+**What this plugin migrates:**
+
+* Site connections (which network sites are linked to each other)
+* Language assignments (which language/locale is assigned to each site)
+* Post relationships (pages, posts, and custom post types linked across sites)
+* Term relationships (categories, tags, and custom taxonomy terms linked across sites)
+
+**Key features:**
+
+* Works with MultilingualPress 2 deactivated — only its database tables need to exist
+* Safely renames MLP2 tables so that MultilingualPress 5 can activate without errors
+* Fully idempotent — safe to pause and resume without creating duplicates
+* Complete migration log with CSV export
+* Optional cleanup step to remove MLP2 backup tables and network settings after a successful migration
+
+== Before You Begin ==
+
+Read this section carefully before starting the migration. Skipping steps or performing them out of order will result in a failed migration.
+
+=== Why the Order Matters ===
+
+MultilingualPress 5 **refuses to activate** if it detects tables with the original MLP2 naming pattern (`{prefix}mlp_*`) in the database. It shows a blocking error and does not activate. You cannot dismiss this error by ignoring it.
+
+The correct sequence is:
+
+1. Install this migrator plugin first (while MLP2 tables still exist under their original names).
+2. Use the migrator to rename the MLP2 tables to temporary backup copies.
+3. Only then install and activate MultilingualPress 5.
+4. Run the migration wizard.
+
+This plugin exists precisely to manage this sequence safely.
+
+=== Requirements ===
+
+* WordPress Multisite 6.7 or higher
+* PHP 8.2 – 8.5
+* MultilingualPress 5 installed and network-activated (after the preparation step below)
+* MultilingualPress 2 database tables present in the database (the plugin itself may be deactivated or uninstalled)
+
+=== Critical Rules ===
+
+1. **Never install MLP5 before running the table-rename step in this plugin.** MLP5 will refuse to activate.
+2. **Do not delete MLP2 tables before running the migration.** The migrator reads directly from those tables.
+3. **Do not run any MLP5 database reset or cleanup.** Let the migrator handle the transition.
+4. **Always create a full backup before starting.** The migration is non-destructive, but a backup is mandatory.
+
+== Installation ==
+
+This plugin is not distributed via the WordPress Plugin Directory. Install it manually.
+
+=== Manual Installation ===
+
+1. Download the plugin ZIP file.
+2. In your WordPress Network Admin, go to **Plugins > Add New > Upload Plugin**.
+3. Upload the ZIP file and click **Install Now**.
+4. Click **Network Activate**.
+
+Do not activate this plugin on a per-site basis. It must be network-activated.
+
+== Using the Plugin ==
+
+=== Complete Step-by-Step Migration Guide ===
+
+Follow these steps in exact order. Do not skip any step, and do not proceed to the next step until the current one is complete.
+
+**This guide covers the primary scenario: MultilingualPress 2 was deactivated (for example, due to PHP 8.4 incompatibility) and its database tables remain in the database.**
+
+---
+
+= Step 0 — Create a Full Backup (Mandatory) =
+
+Before doing anything else, create a complete backup of your WordPress database and all files.
+
+Using WP-CLI:
+
+ wp db export backup-before-mlp-migration.sql --add-drop-table
+
+Using a backup plugin (e.g., UpdraftPlus, BackWPup) or your hosting control panel are also valid options.
+
+**Do not proceed without a backup. This step is not optional.**
+
+---
+
+= Step 1 — Deactivate MultilingualPress 2 =
+
+If MultilingualPress 2 is still active on your network:
+
+1. Go to **Network Admin > Plugins**.
+2. Find MultilingualPress 2 in the list.
+3. Click **Network Deactivate**.
+
+**Do not click "Delete".** The plugin files may be removed later, but the database tables must remain intact for the migration. Deleting the plugin only removes PHP files — the tables are preserved.
+
+If MultilingualPress 2 was already deactivated (for example, because it is incompatible with your current PHP version), skip this step. The database tables remain in place regardless.
+
+---
+
+= Step 2 — Install and Activate MLP2 to MLP5 Migrator =
+
+Install this plugin before installing MultilingualPress 5.
+
+1. Download the MLP2 to MLP5 Migrator ZIP.
+2. Go to **Network Admin > Plugins > Add New > Upload Plugin**.
+3. Upload the ZIP and click **Install Now**.
+4. Click **Network Activate**.
+
+---
+
+= Step 3 — Rename MLP2 Tables =
+
+This step makes it possible for MultilingualPress 5 to activate. Without it, MLP5 will show a blocking error and refuse to start.
+
+1. Go to **Network Admin > Settings > MLP Migrator**.
+2. The page will detect your MLP2 tables and show the current system state.
+3. Click **"Rename MLP2 tables (prepare for MLP5 activation)"**.
+4. The plugin renames all `{prefix}mlp_*` tables to `{prefix}mlp2bak_*` backup copies.
+5. The page reloads and shows: *"MLP2 tables renamed. Now go to Network Admin > Plugins and activate MultilingualPress 5."*
+
+Your data is safe. The tables have been renamed, not deleted. Nothing has been modified.
+
+If you need to undo this step (for example, if you decide not to proceed), use the **"Restore original table names"** link at the bottom of the page.
+
+---
+
+= Step 4 — Install and Activate MultilingualPress 5 =
+
+Now that the MLP2 tables have been renamed, MultilingualPress 5 can activate without errors.
+
+1. Obtain the MultilingualPress 5 ZIP from your license provider.
+2. Go to **Network Admin > Plugins > Add New > Upload Plugin**.
+3. Upload the MultilingualPress 5 ZIP file and click **Install Now**.
+4. Click **Network Activate**.
+
+MultilingualPress 5 should activate cleanly. If it still shows a compatibility error, return to **Network Admin > Settings > MLP Migrator** to verify that the rename step completed successfully.
+
+If MLP5 was already installed and network-activated (not possible if MLP2 tables were in their original state — see above), skip this step.
+
+---
+
+= Step 5 — Run the Migration Wizard =
+
+Go to **Network Admin > Settings > MLP Migrator**.
+
+The page will confirm that the system is ready (backup tables found + MLP5 active). The wizard has six steps. Each step must be completed before the next one becomes available.
+
+---
+
+= Wizard Step 1 — Preflight Checks =
+
+The wizard automatically checks:
+
+* **MLP2 backup tables detected** — verifies that the renamed MLP2 tables exist. This is the primary requirement.
+* **MultilingualPress 5 active** — verifies that MLP5 is network-activated.
+
+**If backup tables are not found:** Return to Step 3 and run the rename step. If original MLP2 tables are no longer present either, the tables may have been deleted — restore from your backup.
+
+**If MLP5 is not active:** Activate it first (see Step 4).
+
+**If MLP2 is still active:** An amber warning is shown recommending you deactivate it before continuing (see Step 1). The wizard still allows you to proceed.
+
+A backup reminder is displayed. Confirm that you completed Step 0 before clicking **Next**.
+
+Click **Next** to proceed to Step 2.
+
+---
+
+= Wizard Step 2 — Analysis =
+
+Click **Run Analysis** to scan the MLP2 backup database.
+
+The wizard will display:
+
+* Number of site connections found in MLP2
+* Number of post relationships found in MLP2
+* Number of term relationships found in MLP2
+* Detected conflicts:
+ * **Orphaned sites** — sites referenced in MLP2 that no longer exist in the network
+ * **Orphaned posts** — posts referenced in MLP2 that no longer exist on their site
+ * **Orphaned terms** — terms referenced in MLP2 that no longer exist on their site
+ * **Duplicate relations** — duplicate rows in MLP2 tables
+
+Conflicts are not blocking. They will be automatically skipped and logged during the migration with a clear explanation in the migration log.
+
+Review the summary to understand what will be migrated. Click **Next** to proceed to Step 3.
+
+---
+
+= Wizard Step 3 — Site Relations =
+
+Click **Start** to migrate site connections and language assignments.
+
+The wizard reads all site connections from the MLP2 backup tables and writes them to MultilingualPress 5 in the correct format. Language/locale assignments for each site are also migrated.
+
+This step usually completes in seconds. Results are displayed as:
+
+* **Migrated** — successfully written to MLP5
+* **Skipped** — already existed in MLP5, or referenced a site that no longer exists
+* **Errors** — failed to write; check the migration log for details
+
+Errors at this step are rare. If you see errors, download the log at Step 5 and review before continuing.
+
+Click **Next** to proceed to Step 4.
+
+---
+
+= Wizard Step 4 — Content Relations =
+
+This step migrates all post and term relationships. On large sites with thousands of relationships, this step can take several minutes.
+
+Click **Start** to begin. A progress bar updates in real time showing:
+
+* Total relationships to process
+* Migrated (successfully written to MLP5)
+* Skipped (orphaned content, duplicates, or already migrated)
+* Errors
+
+**If you need to pause:**
+
+1. Click **Pause** — the current position is saved automatically.
+2. You can close the browser or leave the page.
+3. Return to **Network Admin > Settings > MLP Migrator** at any time.
+4. Click **Resume** to continue from exactly where you stopped.
+
+No data will be duplicated if you pause and resume. The migration is fully idempotent.
+
+Wait for the progress bar to reach 100% before continuing. Click **Next** to proceed to Step 5.
+
+---
+
+= Wizard Step 5 — Verification =
+
+The wizard displays a comparison report showing, for each category (site relations, post relations, term relations):
+
+* **Expected** — count from the analysis in Step 2
+* **Migrated** — successfully written to MLP5
+* **Skipped** — omitted with a reason (see log)
+* **Errors** — failed operations
+
+Color coding:
+
+* Green — migrated count matches expected and errors are zero
+* Amber — some errors occurred; review the log
+* Red — nothing was migrated despite records being expected; action may be required
+
+Click **Download log (CSV)** to save the full migration log to your computer. **Save this file.** It is the only permanent record of what happened during the migration.
+
+Review the report carefully. If the error count is unexpectedly high, stop here and investigate before proceeding to cleanup.
+
+Click **Next** to proceed to Step 6.
+
+---
+
+= Wizard Step 6 — Cleanup (Optional) =
+
+This step is optional. MultilingualPress 5 will work correctly whether or not you perform the cleanup.
+
+Three independent cleanup actions are offered:
+
+1. **Deactivate MultilingualPress 2 (network-wide)** — if MLP2 is still active, this deactivates it.
+
+2. **Delete MLP2 backup database tables** — permanently drops all `{prefix}mlp2bak_*` tables from the database. **This action is irreversible.** Only proceed if:
+ * You have verified that the migration completed successfully in Step 5
+ * You have a backup from Step 0
+ * You have downloaded the migration log
+
+3. **Delete MultilingualPress 2 network settings** — removes MLP2-related entries from `wp_sitemeta`.
+
+**To proceed with cleanup:**
+
+1. Select the checkboxes for the actions you want to perform.
+2. Note: option 2 (delete tables) is only available if option 1 (deactivate) is also selected.
+3. Type `DELETE` (exactly, in uppercase) in the confirmation field.
+4. Click **Proceed with cleanup**.
+
+If you do not type `DELETE` exactly, the button remains disabled and no action will be taken.
+
+---
+
+= Step 6 — Verify MultilingualPress 5 =
+
+After the wizard completes:
+
+1. Browse your multisite network and verify that content is properly linked across sites in MultilingualPress 5.
+2. Go to **Network Admin > Sites** and check each site's language assignment in MLP5.
+3. Visit the frontend and confirm that the language switcher works correctly.
+4. Check a few posts and verify that their translations are correctly linked in MLP5.
+
+If something looks wrong, compare against the migration log (Wizard Step 5). Do not delete the backup tables until you are satisfied with the result.
+
+---
+
+= Step 7 — Deactivate the Migrator Plugin (Optional) =
+
+Once you have confirmed that MLP5 is fully working:
+
+1. Go to **Network Admin > Plugins**.
+2. Find "MLP2 to MLP5 Migrator" and click **Network Deactivate**.
+3. Click **Delete** to remove the plugin files.
+
+The migration log table is preserved in the database unless you have enabled the "Delete migration log on uninstall" option in the plugin settings.
+
+== Frequently Asked Questions ==
+
+= Does MultilingualPress 2 need to be active during migration? =
+
+No. MultilingualPress 2 only needs its database tables to still be present in the database. The plugin itself can be deactivated or even uninstalled. This is the primary expected scenario — for example, when MLP2 was deactivated because it is incompatible with PHP 8.4.
+
+= Why does MultilingualPress 5 show a blocking error and refuse to activate? =
+
+MLP5 detects the presence of tables named `{prefix}mlp_*` and refuses to activate, showing the message: *"It seems that an old version of MultilingualPress is installed in this website."* This is a hard block, not a warning. Use the **Rename MLP2 tables** action in this plugin (Step 3 above) before attempting to activate MLP5.
+
+= Can I pause and resume the migration? =
+
+Yes. The content relations step (Wizard Step 4) supports pause and resume. If the browser is closed or the server times out, return to the wizard and click Resume. No data will be duplicated — the migration is fully idempotent.
+
+= What does "Skipped" mean in the results? =
+
+Skipped records are normal and expected. Common reasons:
+
+* The relationship already exists in MLP5 (idempotency)
+* The post or term no longer exists on one of the linked sites
+* The site was deleted from the network after the MLP2 data was created
+* A locale string used in MLP2 is not recognized by MLP5
+
+All skipped records are logged with a specific reason. Download the CSV log from Wizard Step 5 to review them.
+
+= Is it safe to run the migration more than once? =
+
+Yes. Running the migration multiple times will not create duplicate data in MLP5. Records already migrated are detected and logged as "Skipped".
+
+= What are the {prefix}mlp2bak_* tables? =
+
+These are the renamed copies of your original MLP2 tables. This plugin renames them from `{prefix}mlp_*` to `{prefix}mlp2bak_*` during Step 3. The data is untouched — only the table names change. These backup tables are what the migration wizard reads from. You can safely delete them after a successful migration using Wizard Step 6.
+
+= What data is modified or deleted during migration? =
+
+None during the migration itself. The preparation step (Step 3) renames tables but does not modify any data. The optional cleanup in Wizard Step 6 is the only action that deletes data, and it requires explicit confirmation by typing "DELETE".
+
+= Can I use this plugin without MultilingualPress 5 installed? =
+
+You can install this plugin and run the table-rename step (Step 3) without MLP5 present. However, MLP5 must be installed and network-activated before running the migration wizard. The wizard will not allow you to proceed to Step 2 without it.
+
+= What PHP versions are supported? =
+
+PHP 8.2 through 8.5. Note that MultilingualPress 2 is not compatible with PHP 8.4 or higher, which is the most common reason to use this migrator.
+
+== Compatibility ==
+
+* WordPress: 6.7 – 6.9
+* PHP: 8.2 – 8.5
+* Requires: MultilingualPress 5 (premium, any recent version)
+* Compatible with: MultilingualPress 2 (latest release from WordPress.org)
+
+== Changelog ==
+
+= 1.0.0 =
+
+_Release date: 2026-02-27_
+
+* First production release. Complete six-step migration wizard.
+* Table preparation, preflight checks, analysis, site relations, content relations (AJAX batch), verification with CSV export, and optional cleanup.
+* Supports `multilingual_linked` as alternative MLP2 content relations table.
+* Spanish (es_ES) translation included.
+
+= Previous versions =
+
+See the full changelog at changelog.txt.
+
+== Compliance ==
+
+This plugin adheres to the following security measures and review protocols for each version:
+
+* [WordPress Plugin Handbook](https://developer.wordpress.org/plugins/)
+* [WordPress Plugin Security](https://developer.wordpress.org/plugins/wordpress-org/plugin-security/)
+* [WordPress APIs Security](https://developer.wordpress.org/apis/security/)
+* [WordPress Coding Standards](https://github.com/WordPress/WordPress-Coding-Standards)
+* [Plugin Check (PCP)](https://wordpress.org/plugins/plugin-check/)
diff --git a/robotstxt-mlp2-mlp5.php b/robotstxt-mlp2-mlp5.php
new file mode 100644
index 0000000..8473b03
--- /dev/null
+++ b/robotstxt-mlp2-mlp5.php
@@ -0,0 +1,59 @@
+register();
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param string $plugin_file_path Absolute path to the main plugin file.
+ */
+ private function __construct( string $plugin_file_path ) {
+ $this->plugin_file_path = $plugin_file_path;
+ $this->plugin_basename = plugin_basename( $plugin_file_path );
+ $this->plugin_slug = dirname( $this->plugin_basename );
+ $this->plugin_data = $this->get_plugin_data();
+ $this->json_url = $this->build_json_url();
+ $this->cache_key = 'robotstxt_updater_' . md5( $this->plugin_basename );
+ }
+
+ /**
+ * Register WordPress hooks.
+ */
+ private function register(): void {
+ add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'inject_update_info' ) );
+ add_filter( 'plugins_api', array( $this, 'provide_plugin_details' ), 10, 3 );
+ add_action( 'admin_init', array( $this, 'handle_cache_clear' ) );
+ add_action( 'robotstxt_updater_clear_cache', array( $this, 'clear_cache' ) );
+ }
+
+ /**
+ * Get plugin headers.
+ *
+ * @return array Plugin data.
+ */
+ private function get_plugin_data(): array {
+ if ( ! function_exists( 'get_plugin_data' ) ) {
+ require_once ABSPATH . 'wp-admin/includes/plugin.php';
+ }
+
+ return get_plugin_data( $this->plugin_file_path, false, false );
+ }
+
+ /**
+ * Build JSON URL from plugin headers.
+ *
+ * Tries to use "Gitea Plugin URI" header to construct the URL.
+ * Falls back to Plugin URI if Gitea URI is not available.
+ *
+ * @return string JSON URL.
+ */
+ private function build_json_url(): string {
+ // Try Gitea Plugin URI (format: "OWNER/REPO" or full URL).
+ if ( ! empty( $this->plugin_data['Gitea Plugin URI'] ) ) {
+ $gitea_uri = $this->plugin_data['Gitea Plugin URI'];
+
+ // If it's already a full URL, use it.
+ if ( str_starts_with( $gitea_uri, 'http' ) ) {
+ // Extract base URL and construct JSON path.
+ return rtrim( $gitea_uri, '/' ) . '/raw/branch/main/update.json';
+ }
+
+ // If it's in format "OWNER/REPO", construct full URL.
+ if ( preg_match( '#^[^/]+/[^/]+$#', $gitea_uri ) ) {
+ return "https://git.robotstxt.es/{$gitea_uri}/raw/branch/main/update.json";
+ }
+ }
+
+ // Fallback: try to extract from Plugin URI.
+ if ( ! empty( $this->plugin_data['PluginURI'] ) ) {
+ $plugin_uri = $this->plugin_data['PluginURI'];
+ if ( str_contains( $plugin_uri, 'git.robotstxt.es' ) ) {
+ return rtrim( $plugin_uri, '/' ) . '/raw/branch/main/update.json';
+ }
+ }
+
+ // Last resort: construct from plugin slug.
+ return "https://git.robotstxt.es/ROBOTSTXT/{$this->plugin_slug}/raw/branch/main/update.json";
+ }
+
+ /**
+ * Inject update info into WP's plugin update transient.
+ *
+ * @param object|mixed $transient The update_plugins transient.
+ *
+ * @return object The modified transient.
+ */
+ public function inject_update_info( $transient ) {
+ if ( ! is_object( $transient ) ) {
+ $transient = new stdClass();
+ }
+
+ if ( empty( $transient->checked ) || ! is_array( $transient->checked ) ) {
+ return $transient;
+ }
+
+ if ( empty( $transient->checked[ $this->plugin_basename ] ) ) {
+ return $transient;
+ }
+
+ $current_version = $transient->checked[ $this->plugin_basename ];
+ $remote = $this->get_remote_data();
+
+ if ( empty( $remote['version'] ) || empty( $remote['download_url'] ) ) {
+ return $transient;
+ }
+
+ if ( ! $this->is_compatible( $remote ) ) {
+ return $transient;
+ }
+
+ if ( version_compare( $remote['version'], $current_version, '>' ) ) {
+ $update = (object) array(
+ 'slug' => $remote['slug'] ?? $this->plugin_slug,
+ 'plugin' => $this->plugin_basename,
+ 'new_version' => $remote['version'],
+ 'url' => $remote['homepage'] ?? $this->plugin_data['PluginURI'] ?? '',
+ 'package' => $remote['download_url'],
+ 'tested' => $remote['tested'] ?? '',
+ 'requires' => $remote['requires'] ?? '',
+ 'requires_php' => $remote['requires_php'] ?? '',
+ );
+
+ $transient->response[ $this->plugin_basename ] = $update;
+ }
+
+ return $transient;
+ }
+
+ /**
+ * Provide "View details" modal content.
+ *
+ * @param false|object|array $result The result object or array.
+ * @param string $action The type of information being requested.
+ * @param object $args Plugin API arguments.
+ *
+ * @return false|object The plugin information object or false.
+ */
+ public function provide_plugin_details( $result, string $action, object $args ) {
+ if ( 'plugin_information' !== $action ) {
+ return $result;
+ }
+
+ if ( empty( $args->slug ) || $args->slug !== $this->plugin_slug ) {
+ return $result;
+ }
+
+ $remote = $this->get_remote_data();
+
+ if ( empty( $remote['version'] ) ) {
+ return $result;
+ }
+
+ return (object) array(
+ 'name' => $remote['name'] ?? $this->plugin_data['Name'] ?? $this->plugin_slug,
+ 'slug' => $remote['slug'] ?? $this->plugin_slug,
+ 'version' => $remote['version'],
+ 'author' => $remote['author'] ?? $this->plugin_data['Author'] ?? '',
+ 'homepage' => $remote['homepage'] ?? $this->plugin_data['PluginURI'] ?? '',
+ 'requires' => $remote['requires'] ?? '',
+ 'tested' => $remote['tested'] ?? '',
+ 'requires_php' => $remote['requires_php'] ?? '',
+ 'sections' => array(
+ 'description' => $remote['description'] ?? $this->plugin_data['Description'] ?? '',
+ 'changelog' => $remote['changelog'] ?? '',
+ ),
+ 'download_link' => $remote['download_url'] ?? '',
+ );
+ }
+
+ /**
+ * Get remote data with caching and HMAC signature verification.
+ *
+ * @return array Remote data.
+ */
+ private function get_remote_data(): array {
+ $cached = get_site_transient( $this->cache_key );
+
+ // Verify HMAC signature if AUTH_SALT is defined and cache has signature.
+ if ( false !== $cached && defined( 'AUTH_SALT' ) && '' !== AUTH_SALT ) {
+ if ( is_array( $cached ) && isset( $cached['signature'], $cached['data'] ) ) {
+ $expected_sig = hash_hmac( 'sha256', $this->cache_key . serialize( $cached['data'] ), AUTH_SALT );
+
+ if ( hash_equals( $expected_sig, $cached['signature'] ) ) {
+ // Signature valid, return data.
+ return is_array( $cached['data'] ) ? $cached['data'] : array();
+ }
+
+ // Signature invalid, delete corrupted cache.
+ delete_site_transient( $this->cache_key );
+ $cached = false;
+ }
+ }
+
+ // If no valid cache, fetch fresh data.
+ if ( false === $cached ) {
+ $remote = $this->fetch_json();
+
+ // Store with HMAC signature if AUTH_SALT is available.
+ if ( defined( 'AUTH_SALT' ) && '' !== AUTH_SALT ) {
+ $payload = array(
+ 'data' => $remote ?: array(),
+ 'timestamp' => time(),
+ 'signature' => hash_hmac( 'sha256', $this->cache_key . serialize( $remote ?: array() ), AUTH_SALT ),
+ );
+ set_site_transient( $this->cache_key, $payload, 6 * HOUR_IN_SECONDS );
+ } else {
+ // Fallback to standard caching.
+ set_site_transient( $this->cache_key, $remote ?: array(), 6 * HOUR_IN_SECONDS );
+ }
+
+ return is_array( $remote ) ? $remote : array();
+ }
+
+ // Legacy cache format without signature (backward compatibility).
+ return is_array( $cached ) ? $cached : array();
+ }
+
+ /**
+ * Fetch JSON from remote URL.
+ *
+ * @return array Decoded JSON data.
+ */
+ private function fetch_json(): array {
+ $response = wp_remote_get(
+ $this->json_url,
+ array(
+ 'timeout' => 10,
+ 'headers' => array(
+ 'Accept' => 'application/json',
+ ),
+ )
+ );
+
+ if ( is_wp_error( $response ) ) {
+ return array();
+ }
+
+ $code = (int) wp_remote_retrieve_response_code( $response );
+ if ( $code < 200 || $code >= 300 ) {
+ return array();
+ }
+
+ $body = wp_remote_retrieve_body( $response );
+ $data = json_decode( $body, true );
+
+ return is_array( $data ) ? $data : array();
+ }
+
+ /**
+ * Check compatibility.
+ *
+ * @param array $remote Remote data.
+ *
+ * @return bool True if compatible.
+ */
+ private function is_compatible( array $remote ): bool {
+ if ( ! empty( $remote['requires_php'] ) ) {
+ if ( version_compare( PHP_VERSION, $remote['requires_php'], '<' ) ) {
+ return false;
+ }
+ }
+
+ if ( ! empty( $remote['requires'] ) ) {
+ if ( version_compare( get_bloginfo( 'version' ), $remote['requires'], '<' ) ) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * Handle manual cache clear via URL parameter.
+ */
+ public function handle_cache_clear(): void {
+ // Check if this is a cache clear request first.
+ $clear_cache = filter_input( INPUT_GET, 'robotstxt_clear_update_cache', FILTER_UNSAFE_RAW );
+ if ( null === $clear_cache ) {
+ return;
+ }
+
+ // This is a cache clear request - now verify nonce.
+ $nonce_raw = filter_input( INPUT_GET, '_wpnonce', FILTER_UNSAFE_RAW );
+ $nonce = $nonce_raw ? sanitize_text_field( wp_unslash( $nonce_raw ) ) : '';
+
+ if ( ! wp_verify_nonce( $nonce, 'robotstxt_clear_update_cache' ) ) {
+ wp_die( esc_html__( 'Security check failed', 'robotstxt-smtp' ) );
+ }
+
+ // Check permissions.
+ if ( ! current_user_can( 'update_plugins' ) ) {
+ wp_die( esc_html__( 'You do not have sufficient permissions to access this page.', 'robotstxt-smtp' ) );
+ }
+
+ $this->clear_cache();
+ wp_safe_redirect( remove_query_arg( array( 'robotstxt_clear_update_cache', '_wpnonce' ) ) );
+ exit;
+ }
+
+ /**
+ * Clear update cache.
+ */
+ public function clear_cache(): void {
+ delete_site_transient( $this->cache_key );
+ delete_site_transient( 'update_plugins' );
+ }
+ }
+}
diff --git a/uninstall.php b/uninstall.php
new file mode 100644
index 0000000..e70907d
--- /dev/null
+++ b/uninstall.php
@@ -0,0 +1,24 @@
+