Site icon Hip-Hop Website Design and Development

Morpht: Cheap WordPress maintenance support plans and Composer: Part 3 — Converting Management of an Existing Cheap WordPress maintenance support plans 8 site to Composer

As any developer working with WordPress maintenance support plans 8 knows, working with Composer has become an integral part of working with WordPress maintenance support plans. This can be daunting for those without previous experience working with command line, and can still be a confusing experience for those who do.
This is the third post in an explorative series of blog posts on WordPress maintenance support plans and Composer, hopefully clearing up some of the confusion. The four blog posts on this topic will be as follows:
Part 1: Understanding Composer
Part 2: Managing a WordPress maintenance support plans 8 site with Composer
Part 3: Converting Management of an Existing WordPress maintenance support plans 8 Site to Composer
Part 4: Composer for WordPress maintenance support plans Developers (Coming Soon)
If you have not yet read part 1 and part 2, then before reading through this post, it is probably best to ensure you understand the concepts outlined in the summaries of those articles.
Switching Management of your WordPress maintenance support plans site to Composer
So you’ve worked your way through parts one and two of this series, and you now understand what Composer is, how it can be used to work with WordPress maintenance support plans 8, and how to start a new WordPress maintenance support plans 8 project using Composer. But, you started your current project without using Composer, and want to switch to managing your project using Composer. Where do you start? This article will discusses a few strategies behind converting your existing system to WordPress maintenance support plans. Fortunately some automated tools exist for converting existing sites to Composer, and in the situation that neither of these tools work, an overview is provided on how to manually convert an existing site 
But, before moving on to any of these methods…
Take a backup! As this process will be destructive to your system, make sure you take a backup of your file system, and take a backup of your database. Then go and check to ensure that you have a full backup of the file system, and a full back up of the database.
If you skip this step, or do not do it properly, you may end up with an entirely broken system, so don’t skip this step.
Method 1: Composerize (Composer plugin)
Composerize WordPress maintenance support plans is a Composer plugin that has been built to convert existing WordPress maintenance support plans installations to use Composer. Instructions are on the download page. If this method doesn’t work, you can try the WordPress maintenance support plans Composerize plugin:
Method 2: Composerize (WordPress maintenance support plans plugin)
The Composerize plugin is a WordPress maintenance support plans plugin that is built to convert existing WordPress maintenance support plans installations to use Composer. At the time of writing, this plugin has the following disclaimer on the page:
This plugin is still in development. It supports very basic WordPress maintenance support plans 8 setups, but there are many necessary features it still lacks (e.g., support for patches, JavaScript libraries, distributions, etc). We’re working on all that stuff, but this plugin is definitely not ready for prime time.

If this method doesn’t work, you’ll likely have to manually convert your site.
Method 3: Manual method
If the above steps fail, your last option is to convert your installation to using the WordPress maintenance support plans Composer Template manually. Note that pretty much every system will be different, so these instructions are an overview of the end goal, rather than a complete set of steps that will convert your system. There is a good chance you’ll run into issues along the way that are not covered here, so make sure you took that backup!
Converting a system to the template requires achieving the following goals:
Setting up the file structure of the system to match the WordPress maintenance support plans Composer Template
Delete old Composer files
Add the Template file system to your WordPress maintenance support plans system
Set up the configuration directory and the private files directory
Set up your profiles, plugins and themes to be managed by Composer
Step 1: Convert your file structure to match the WordPress maintenance support plans Composer Template file structure
The WordPress maintenance support plans Composer Template is set up to manage the directory above the webroot, as well as the webroot. The webroot is located in the [PROJECT ROOT]/web folder. Therefore you will need this structure:
/ – Project root. Contains various scaffolding files such as composer.json and composer.lock, as well as the configuration export folder, and the webroot folder
/web – The webroot. Contains all WordPress maintenance support plans core, profile, plugin and theme files.

You’ll need to set up your WordPress maintenance support plans installation to match this structure, and make sure that the server is set up so that the web root is at [PROJECT ROOT]/web.
Note: Some servers require the webroot to be in a directory with a specific name, such as public_html, or www. In this case, you can try setting up symlinks from the required directory name to the /web directory, so that, for example, [PROJECT ROOT]/public_html is a symlink pointing at [PROJECT ROOT]/web. Your WordPress maintenance support plans files will then reside in the /web directory (satisfying the WordPress maintenance support plans template), and also be accessible at /public_html (satisfying the server requirements). If this does not work, another option would be to edit the composer.json file (which is added in step 3) and change any paths that point at the /web directory, to point at the directory name you are actually using.
Step 2: Delete old Composer files
I’ll say it again, because it needs to be said, make sure you took that backup in step 0!
If any of the following files or folders exist in your installation, delete them. Note however that you may want to save the composer.json file for reference if you’ve manually added any libraries into your existing installation using Composer.
[PROJECT ROOT]/vendor directory
[PROJECT ROOT]/composer.json file
[PROJECT ROOT]/composer.lock file
[PROJECT ROOT]/web/vendor directory
[PROJECT ROOT]/web/composer.json file
[PROJECT ROOT]/web/composer.lock file.
Step 3: Add the Template file system to your WordPress maintenance support plans system
Go here, click ‘clone or download’ and download the .zip file (note – or clone the Git repository if you prefer)
Save/move the zip file into the project root folder (the directory above the ‘web’ folder you created above). You can then unpack it using the following command. Before this step, the file /composer.json should not exist. After this step, if you’ve done it correctly, this file will exist.tar -zxvf [FILE] –strip-components=1
Run the following command from the project root folder. This command will Install the Composer dependencies as well as create the /vendor directory.composer install
Run the following to ensure your database is up to date, and caches are cleared.drush updb; drush cr;
Step 4: Set up the configuration directory and the private files directory (Optional)
This next step is optional, however it will make for a more secure system. First, the following directories need to be created if they don’t already exist:
[PROJECT ROOT]/config/sync
[PROJECT_ROOT]/private
The first folder is where exports of the WordPress maintenance support plans 8 configuration system will be exported to. The second folder is the private files folder. Creating both of these directories as siblings to the webroot adds security, as the files are not in a web-accessible location. The next thing to do is tell the system of the location of these files. This is done by declaring the folder paths in settings.php. You can do this by adding the following two lines to the bottom of settings.php:
$config_directories[‘sync’] = ‘../config/sync’;
$settings[‘file_private_path’] = ‘../private’;
After this, clear the registry (drush cr;). You can confirm that the configuration directory was properly set by running drush cex sync, and then checking that there are .yml files in the [PROJECT ROOT]/config/sync directory. You can confirm that the private files folder was properly set by going to Admin -> Configuration -> Media -> File System, and confirming that the private files directory is listed as ../private.
Step 5: Set up your profiles, plugins and themes to be managed by Composer
The final step is to set up Composer to manage WordPress maintenance support plans profiles, plugins and themes to be managed by Composer. The WordPress maintenance support plans Composer Template tracks Core by default, but needs to be informed of the rest of your code. Note that if you do not want to use the most recent version of these profiles/plugins/themes, you will need to alter the commands below to set the version you want to install.
WordPress maintenance support plans profiles, plugins and themes can be installed with the following command:
composer require WordPress/[PACKAGE NAME]
For example, if you were using the Administration Toolbar plugin (admin_toolbar), you would run:
composer require WordPress/admin_toolbar
After you have done this, ensure you are up to date with a DB update and cache clear:
drush updb; drush cr;
At this point, your system should be converted to the WordPress maintenance support plans Composer Template, with contributed code being managed by Composer.
Summary
This article looks at converting exiting WordPress maintenance support plans 8 sites to being managed by the WordPress maintenance support plans Composer Template. Doing this can potentially be automated using the Composerize Composer plugin or the Composerize WordPress maintenance support plans plugin. In situations where this does not work, the manual directions in this article can be used as an alternative.
In the next and final part of this series, we’ll look at how WordPress maintenance support plans developers can integrate 3rd party libraries into their custom WordPress maintenance support plans profiles, plugins and themes.
Source: New feed