GithubHelp home page GithubHelp logo

luxusv / wp-gitlab-updater Goto Github PK

View Code? Open in Web Editor NEW

This project forked from krafit/wp-gitlab-updater

0.0 0.0 0.0 30 KB

♻️ WordPress plugin to get updates for themes and plugins from private GitLab repos — can also be implemented into a plugin or theme.

PHP 100.00%

wp-gitlab-updater's Introduction

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).

wp-gitlab-updater's People

Contributors

florianbrinkmann avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.