Skip to content
WordPress plugin to get updates for themes and plugins from private GitLab repos — can also be implemented into a plugin or theme.
PHP
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src Process next theme in theme_update() if error Jun 3, 2018
.gitignore Changes which should have been part of init commit Jun 30, 2017
changelog.md 2.0.2 Jul 25, 2017
readme.md Add link to token page to readme Jun 17, 2019
uninstall.php Added settings Jul 7, 2017
wp-gitlab-updater.php version push Jul 25, 2017

readme.md

WordPress plugin and theme updates from private GitLab repos

You can use this as a WordPress plugin (for example, if you have multiple themes and/or plugins in one WP installation, which should be updated with the script), or include it directly in a theme or plugin. The script uses the GitLab tags to check for a new version.

Usage as a WordPress plugin

Just download the repo and upload the ZIP as a new plugin to your WordPress install or use the GitHub updater plugin.

After that, you will find a new options page under SettingsGitLab Updater. There you can find all installed themes and plugins, and fields to insert the needed data to make one or more of them use your GitLab repo as update source.

Search the theme or plugin in the list and insert the following data:

  • Access token is the GitLab API access token (needs »api« and »read_registry« scope. If you use the gitlab.com version, you can create the token here: gitlab.com/profile/personal_access_tokens). The safest way might be to create the access token for an external user with the role »reporter«, who has only access to the theme repo. Project features like wiki and issues can be hidden from external users.
  • GitLab URL needs to be the URL of your GitLab install. For example https://gitlab.com
  • Repo needs to be the identifier of the repo in the format username/repo or group/repo

Bundled inside a plugin or theme

Inside a theme

To bundle it into a theme, you can just grab the src/theme-updater.php and src/updater-base.php and put it into your theme, for example, into a wp-gitlab-updater folder. After that, you can call it like that:

/**
 * Include the file with the ThemeUpdater class.
 */
 require_once 'wp-gitlab-updater/theme-updater.php';
  
/**
 * Init the theme updater.
 */
new Moenus\GitLabUpdater\ThemeUpdater( [
    'slug' => 'SlugOfTheTheme', 
    'access_token' => 'YourGitLabAccessToken',
    'gitlab_url' => 'URLtoGitLabInstall',
    'repo' => 'RepoIdentifier',
] );

The params are the same as explained in the Usage as a WordPress plugin part — slug must be the directory of the theme.

Inside a plugin

For that, take the src/plugin-updater.php and src/updater-base.php, put it into your plugin and call it:

/**
 * Include the file with the PluginUpdater class.
 */
require_once 'wp-gitlab-updater/plugin-updater.php';
  
/**
 * Init the plugin updater with the plugin base name.
 */
new Moenus\GitLabUpdater\PluginUpdater( [
    'slug' => 'SlugOfPlugin', 
    'plugin_base_name' => 'BaseNameOfThePlugin', 
    'access_token' => 'YourGitLabAccessToken', 
    'gitlab_url' => 'URLtoGitLabInstall',
    'repo' => 'RepoIdentifier',
] );

Same params as explained in Usage as a WordPress pluginslug is plugin directory and plugin_base_name the basename (for example, svg-social-menu/svg-social-menu.php).

You can’t perform that action at this time.