Sometimes we have to alter Wordpress plugins slightly to fit our needs. If an update comes up I would like to still be able to update the plugin and merge it with our changes. What is the best to structure my code so this process is not a catastrophe? We are using SVN to store our wordpress plugins. And we are using tortoiseSVN as our SVN client.
Specifically, I altered qa-lite to take out voting options. A newer version of qa-lite came out and I want the new features that it has. Other than downloading the new version and combing through to make the changes by hand, is there, specifically, a better way to do it?
The only things that comes to mind right now is to consider public release of the plugin as head and your modified version as a branch. So, you'd keep them separated and perform a merge from head to branch in order to get new features. Manually.
Or create a patch from the diff between head and your changes. Then use the patch over the new public version.
Related
I am making a woocommerce website and I was wondering what is the best way to update plugins (details) and still be able to update the plugin.
For example, I have two plugins that I just want to change the content in them like the currencies in woocommerce writes د.ب which is in Arabic Bahraini Dinar and I wanted it to be BHD.
Also another example I wanted to change in the wc-vendor plugin the namings instead of calling them vendors I want to call them artists.
I been reading articles about the best methods to update a plugin but I am not sure if they are also valid if I just wanted to change the "Naming" not "functionality"
https://www.seedprod.com/customizing-wordpress-plugins/
Summary:
I appreciate if you can tell me how to change plugin content and still be able to update it.
Thanks!
If you're using plugins developed by others, you may have more problem again in the future if the plugins update. Ask the developer or create an issue regarding the problem. Unless you're writing it of your own, you can play the changes locally or create an staging environment. If sound no problem, that's the time you need to replace code in plugins directory.
I assume, upstream developers are not able or willing to provide hooks for your need.
If you really must modify a plugin, put the plugin source code in a version control system (Git, Mercurial, ...). Make a branch for your changes, and each time a new upstream version comes up, import the upstream version and forward merge your modifications.
First of all I am asking the question here because I did not get an answer in the wordpress forum.
I have a working blog based on wordpress 3.8, which is a pretty old version.
I would like to start everything from scratch and to use the existing DB with all the data (which is very very big, 300+ thousands of tables, it is multisite).
I am afraid to upgrade it because I suspect that the core files were modified in the past (before me).
I would like to install the most recent version of wordpress and make sure everything is compatible and working. What is the best method to do so?
I can install the most recent version and connect it to a clone of the old db instance. Can it break something?
I can install a clean version 3.8 and perform an upgrade. Is it a smart thing to do?
Other methods?
Step 1: backup your database.
Step 2: backup your code base.
Step 3: In a non-production installation, upgrade the WordPress installation. This will trigger a database upgrade as WP needs.
At this point, you have a backup of the old data, you have a versioned copy of the data, and you have a copy of the code that may have been modified, as well as a version that is "current / correct". You are in a position of strength to test functionality, ensure nothing has been lost, etc.
If everything looks good, you could then upgrade the production installation (keeping a copy of backups of both the database and the code base).
Lastly, if I were in your shoes, I would visit the Release Archive and download the specific version you are currently on (3.8.?), then run a comparison between the known good / unaltered files and the files that you have in place. In this way, you can prove whether core files had been altered, and you can see the alterations. This would provide you with the information you might need to re-implement those "features" that were incorrectly implemented in the core code.
We(small group) have a SocialEngine based project and we made lots and lots of changes in 4.6.0 version including core modules, now we struggle to update to 4.8.0 which is a pain in the ass so question:
Which logic to implement in new version of social engine where will be stored our modified code that will help for future update?
We are trying using Decorator Pattern, creating another folder(modules2) for example there creating clones of modules and using only modified files(which is currently unsuccessfully).
You can to compare your files with the latest upgrade package files with Softwares like WinMerge and copy new changes in SocialEngine core to your modified files. Don't forget the database queries in application/MODULE_NAME/settings/my-upgrade sql file of each module. It's gonna take time but I don't think there's any easier solutions.
See, thats where git or subversion comes handy , you exactly know where the code is changed .
I'm updating an existing wordpress site making significant modifications the the theme and site structure, as well as making updates to plugins which in turn store their data into mysql database.
As far as I'm aware there are 2 (3?) possible strategies here:
'Dump-and-load' MySQL database from DEV to LIVE and replace wp-content folder with latest updates.
Import changes via WP-importer and replace wp-content folder with latest updates.
Make database changes manually via WP admin interface and replace wp-content folder with latest updates (this is useful only for minor changes).
While I am developing in my own separate environment this is for an existing website which is currently live and will continue to receive updates from the public such as comments and entries into contact forms, hence I expect the database to be different now from when I release my changes.
Given this the options above provide the following problems.
1. DUMP AND LOAD
The 'dump-and-load' strategy seems to be out of the question as my data is being updated behind the scenes (this would have been my preferred approach as this is easily rolled back).
Result: requires synchronising databases post release to get latest updates, TOO COMPLICATED.
2. USE THE IMPORTER
Using the WP-Importer plugin page and post IDs will get updated, screwing up styling that relies on the post IDs to get activated. This in turn creates a CSS nightmare that I wish to avoid, having to go though the CSS after release to update the new page/post IDs with the ones the database created.
Result: Too finicky, not very professional approach leading to long and complex release process.
3. UPDATE DATABASE MANUALLY
This option is great for small changes but when for more complex releases the list of steps to follow on the PROD interface becomes long and hard to follow, making it easy to make mistakes.
Result: Too easy to screw up, only a last resort.
IS THERE A STANDARD WORDPRESS RELEASE STRATEGY FOR EXISTING WEBSITES?
So basically, my question is: What release process do other wordpress developers follow when UPDATING an existing website? Is there an option that I have not listed below that minimizes hassle and reduces time and complexity during release?
I've set up source control for the site using GIT and I am used to automating things via ANT or similar release script, this may be overkill for the current project but would be ideal to at least know of a simple way to update a wordpress site and minimize the chances of screwing it up.
Thanks!
I don't think this is particular to WordPress, it's a similar situation to any custom site. I personally favor replaying the SQL changes on production that were made on dev. The tricky part is that you have to know what SQL changes were made. For example a certain plugin may make some schema changes when you install it - you need to know what they were. You can do that by creating an export of your DB as SQL before installing a plugin, then take another export after and do a diff on the files.
Since you say you're making the modifications then I might assume you know what SQL changes you are going to make? Just make sure all changes you make to the DB are in the form of SQL script files and not just editing using the GUI (you can use the GUI to help write the queries, but save the actual SQL). After all of your changes are done you should have a bunch of SQL scripts that you ran during your development process - you can re-run them in order without encountering errors.
Then when it's time to push to production, create a staging version of production (that is take a fairly current DB backup of production). Run your update scripts on that and test that everything is ok. If it is, then you can run on production.
definitely make a backup of production before running any changes on it!
The guy behind WordFence was working on a deployment plugin called
Deploymint.
There's a new one called WP Stack.
Metal Toad Media discussed using Capistrano, but that Capistrano isn't specific to WP.
CrowdFavorite launched a service called
RAMP.
Needless to say, you have some other options. If you're making db changes manually make sure you're working with the serialized data effectively. I recommend using Search and Replace DB. WordPress also had a great little trick for changing the site url entirely from the wp-config file.
I assume you have everything running in a test environment. I would then:
Create a new database in your live environment.
Preload it with all content and configurations for the new site.
In your test environment, configure your config.php to point to the new database.
Upload all files to the live server. Upload your config.php last.
This will minimize downtime.
I have a need to create a library of Object Oriented PHP code that will see much reuse and aspires to be highly flexible and modular. Because of its independent nature I would like it to exist as its own SVN project.
I would like to be able to create a new web project, save it in SVN as its own separate project, and include within it the library project code as well. During this process, while coding the web application code and making commits, I may need to add a class to the library. I would like to be able to do so and commit those changes back to the libraries project code.
In light of all this I could manage the code in two ways
Commit the changes to the library back to a branch of its original base project code and make the branch name relevant to the web project I was using it with
Commit the changes to the library back to the original code, growing it in size regardless of any specific references that might exist.
I have two questions
How can I include this library project code into a new project yet not break the subversion functionality, i.e. allowing me to make changes to each project individually?
How I can keep the code synchronized? If I choose the first method of managing the library code I may want to grab changes from another branch and pull it in for use in another.
EDIT - I realize I can simply check out these projects individually and commit/update them individually as well, but then how can I include them together as a single project? To be more clear, how could I create a web project that includes the library code as a unified subversion project in consideration of the points I elaborated on above?
I think you can use svn:externals to achieve what you want. It will pull the library project into your website project and update it whenever you update your working copy. The only thing is you cannot commit back to the library in the same commit as you project as described in this question How do I checkin to local copy AND svn:externals subdirectories in one commit?.
Option #1 looks like the right way to go.
I think you should expect to keep separate branches of the API project for any of your sites that have site-specific modifications to the shared API. Of course, you don't need to create the branch upfront, just checkout the 'trunk' and make sure you branch before you commit any site-specific changes.
There are a couple of articles on branching/merging that I have used in the past that might help you out:
Streamed Lines: Branching Patterns for Parallel Software Development
MSDN Branching and Merging Primer
However, there are some aspects of your 'two questions' that are a bit confusing/concerning. Hopefully I'm misinterpretting what you've said, but keep the following in mind:
With your first question, I think you might be getting caught up on the physical location of the source code on your development machine and how your repositories will be structured (hint: treat the two separately).
In your second question, you mention specific references and it sounds like you might be thinking of making your API in some way dependent on the website source (hint: bad idea for an API).