Update website(s) similar functionality as used by Wordpress and others - php

We have developed a CMS based website builder. It is currently available only in asp/ms-sql. A php/mysql version is in production now.
One critical thing that we are missing is a way to notify users of this software about an available update and a simple "one-click" solution to installing the update.
The update could be something as simple as correcting a typo or as complex as adding a new feature which would entail new pages in the CMS, changes to the public pages and changes to an existing DB table or the addition of a new table.
The question proposed is... Where do we even begin to find information regarding the implementation of an update?
Hope someone here can point us in the right direction.

When an administrator logs in, the site sends a HTTP request (using CURL from the server, or JSONP from within the browser) to the update server with it's current version. The update server replies with 'there is a newer version: 2.0.1.1.2' or 'no update available'.
On hitting update, replace core files and adjust the database by ALTER TABLE statements.
Ensure you have the file permissions to write em with the www user.
You should build the software a way that you have files which do not get edited by the user and files with only user content. So you can replace the core files without worrying to replace any user content. User config files need special treatment.
It's not that hard so I hope my suggestion helps.
Just make sure you have a very strict API and code, so it works for all customers, no regard of operating system and environment, it's difficult to change things later.
I also suggest using SSL for the communication.

Related

Copy whole WordPress instance onto my own Server? (Plugins, Blog entries etc.)

I'm currently trying to duplicate the WordPress instance my customer is running to do some testing before changing something in the live version. Sadly I can't figure out how to get all Data including the Woocommerce WebShop on my own Test-Server. My Test-Server is freshly installed and runs WordPress with MariaDB. All the Data I got from the customers Server is located in a Folder with the Name "www.WEBSITEOFCUSTOMER.at", I can't go higher into the Folder Hirarchy due to restrictions of his WebSpace Provider.
This is the Content of the "www.WEBSITEOFCUSTOMER.at" Folder
At some point it looked like I could just copy it over into my /var/www/html/wordpress/ but that destroyed my Test-Instance.
Assuming that I understand that you don't have deep and well knowledge about migration/transfers, I will suggest you to use the Duplicator Plugin to make your job without any issues. This plugin can packaging all your data in one file and then moving to another server/folder etc. you can extract the package with new address. But one notice here: You have to read how Duplicator works, then understand the process and then start to transfer. One good point to understand how the plugin works is to search on youtube where are many guides and examples to see. If you do one time you will not forget for ever. Like a bike in example ;)
Hope this help and if you meet any trouble during the process do not hesitate to ask again for further information.

Deploy updates for code igniter web application

I have a web application written on Code Igniter and almost ready for the release.
I'm looking into ways to do "automatic" updates for the clients.
Now there are going to be versions of the application on which the users will choose to update and when to do it.
I'm curious on how to update the files for the user.
What i used to do before using a framework i used to make a zip file of the new-edited files store it on an FTP and on the user side when he updated i just unziped the file and replace the ones on his side.
For the database schema and other updates i intend to keep a file with the required queries and run during the update.
Should i go with that way or is there something other that i can implement on Code Igniter?
A more straight forward road?
Also i'm still figuring out the part where a user will have to update from say version 1.0.0 to 1.0.3 (2 or 3 versions apart) and the requirements on the files side but on the database also.
Thank you
If you are willing to put it under version control with Git, you can use PHPloy to push only the latest change to the server through FTP. Check it out on Github: https://github.com/banago/PHPloy
Disclaimer: I've written PHPloy

Wordpress site release management strategy

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.

Wordpress Development VS Production Environments

I am about to use WordPress as CMS with a lot of customization, but my question is, how should I sync development to production?
Assuming WordPress is not used, a typical development cycle is to develop the pages locally, and create the DB scripts. Then when everything is ready, it is posted to the site. And then again, more db and code changes, then only the changes are updated/applied, and so on.
Now, with WordPress, you get all the great features (one example is blogging, comments, almost ready CMS ...etc). However deployment is a pain! Ideally, I would rather keep my typical development cycle described above. Therefore I am going to be implementing WordPress locally (from wordpress.org) and then pushing the changes to my production server.
So, assuming that I create a new page in WordPress locally (I will never create pages on the server, all locally, I will find a way to disable wp-admin for the server), a number of files are created. This is not a problem so far. HOWEVER, if I want to add content to that newly created page, that content is saved to my local database. Even though that content is a database change, it is considered (from my point of view) a new change that should be pushed to server rather than add that content via the live server (because that content is considered static, it is not a blog post or a comment, it is a static page).
Now, that new page content is saved to the DB, and therefore, the DB will have changes done on my local machine that I should push to the server along with the files that I will FTP to the server.
My questions are:
Is this approach correct? If not, what do you suggest
What is the best way to find database diffs? What is a tool to use? Does MySQL Workbench provide something like that? I intend to use that tool to find diffs and then generate an update script for the DB. The reason for this question is I normally make the changes myself, and I know how to track them, but now, those DB changes are generated by WordPress and I need to reverse engineer them to find out which changes are made.
Assuming I got step 2 to work, is there anything in that script that should be modified? Such as server names? Does WordPress hard-code server names for example?
So to summarize and give you more information about my development environment, I use XAMPP for development on Windows 7, with PHP and MySQL setup. I also use Mercurial for source control. As mentioned above, I will use WordPress as part of the solution and I intend to use it to help me create a CMS solution. I will use it locally for page generation, and disable that feature for online (keeping online for blog posts and similar entries only). I am doing that so as to keep things in-sync. If I create a page locally, some data is saved to the DB. Now, how do I sync/upload?
Thanks.
OK, after further investigation, here is what I concluded.
All theme development should be version-controlled
All plugin development should be version-controlled
Content of pages and posts are not part of the development porcess, this is contect and should only be backed up.
This way, you do not need to worry about DB changes ...etc.
Hope this helps everyone.
You might use a Version Control System? What OS is the development on, e.g. Win or Linux? And what is the production OS? I use http://serverpress.com for my testing environment though there are others, WAMP, LAMP, etc.

How can i Rollback for files/folders corresponding to the changes done?

I am using PHP and Mysql
I have PHP script in which I rollback all the data in the database such data all the old value be reset to the database if update is done, and all new value gets deleted if new insert has been done.
Now my goal is to perform the same process with files/folders associated with the changes done, I am not able to create an idea for doing the rollback job with the files/folders associated with the Changes.. So can anyone of u help me or direct me to get the best idea?????
EDITED
I want this functionality in one of my Joomla Component.. I have to it all through scripting
When it comes to managing histories and providing the functionality to "rollback" to a specific site-wide snapshot, you are probably well-advised to be looking into Source Code Management systems/techniques such as GIT, Subversion, etc.
These systems seem to be the industry standard for managing source code development, and should provide the functionality of which you speak.
If you are looking to create a self-contained Version Control system for these files and folders, then you will either need to custom create one, whereby any change to a file also records the contents of that file (and the change date/time) into a MySQL Table, or you may need to look at adapting an existing PHP/MySQL Version Control system as a component of your product (respecting, of course, their licensing terms).
I would recommend performing a Google Search for "php version control", and then looking through the results for an option which best suits your needs.
May be you should try to use the native api of the host operating system

Categories