Plugin for Moodle or WordPress Installed as Symlink to local repository

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:

  1. Copy the lti directory into the /var/www/html/domainname/public_html/wp-content/plugins/
  2. Clone a repository as in: sudo git clone 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:

  1. cd ~
  2. sudo git clone

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.

Posted in moodle, plugin, WordPress.