Sometimes it is convenient to install a plugin for Moodle or WordPress using a repository. Installing a plugin is as simple as copying the directory to the plugins directory. However if we want it to be a local repository then we can clone a remote. For example, to install the lti plugin in our WordPress installation we can either:
- Copy the lti directory into the /var/www/html/domainname/public_html/wp-content/plugins/
- Clone a repository as in:
sudo git clone https://github.com/spinozarabel/Wordpress-LTI-1.2.git lti
The problem with approach number 2 is that the actual lti directory is a sub-folder inside of WordPress-LTI-1.2. To solve this problem, we can clone the repository in our user home directory as follows:
sudo git clone https://github.com/spinozarabel/Wordpress-LTI-1.2.git
Now we can create a symlink as follows:
sudo lm -s /var/www/documentroot/wp-content/plugins/lti /home/myusername/Wordpress-LTI-1.2/lti
We just need to make sure that the lti sub-folder is not already present in the plugins directory as the symlink will create it.
Now to refresh our local repo we just go there and do a
sudo git pull and due to the symlink the changes are reflected immediately in the plugin.