Handles Wordpress plugin and theme update requests by comparing the request data with files hosted on github, bitbucket or gitlab.
PHP
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
cache
cookies
includes
projectSettings
projectSettingsSamples
res
temp
.gitignore
.htaccess
LICENSE
db.json-rename
globalSettings.json-sample
index.php
readme.md

readme.md

Project Update API for Wordpress

Handles Wordpress plugin and theme update requests by comparing the request data with files hosted on github, bitbucket or your own gitlab server.
See Project Wiki for detailed information and documentation.

This is targeted to Wordpress plugin and theme developers who do not want to use the official Wordpress Plugin Directory for whatever reasons.
For example some might want to use GIT instead of SVN or want to keep the project private and only distribute updates it to specific IP-addresses or to requests containing a valid API key.

It it possible to specify the branch on which the updates will be distributed so you can have a development branch and a live branch.

Version

1.0.3

The projects class files are versioned itself and have their independent version.

Tested

  • Tested with github and bitbucket in july 2012.
  • Tested with gitlab version 2.7.0 installed on debian.

not tested:

  • Protected repositories on github.
  • Public repositories on bitbucket.

Support

I've written this project for my own needs so i am not willing to give full support. Anyway, i am very interested in any bugs, hints, requests or whatever. Please use the github issue system and i will try to answer.

Dependencys

Required:

Recommended:

File_Archive is used to rename the project Folders for github and bitbucket and convert the archives from gitlab from tar.gz to zip. If you choose not to use it you have to set the global settings "useCache" and "renameFolders" to false.

Installation

  1. Make sure your web-server supports all the dependences.
  2. Download or Clone the Project Files into a folder on your web-server.
  3. Rename the globalSettings.json-sample to globalSettings.json
  4. Rename db.json-rename to db.json
  5. Make sure your www-user can write to:
    • cache folder
    • cookies folder
    • temp folder
    • db.json file
  6. Make your settings in globalSettings.json. See Project Wiki - Global Settings for details.
  7. Setup your first project
    1. Choose the appropriate file from /projectSettingsSamples folder.
    2. Copy it into /projectSettings folder.
    3. Rename it in [your Project Slug].json.
    4. Insert the project data. See Project Wiki - Project Settings for details.
  8. Check if everything works by testing one of the api requests. See Project Wiki - API Requests for documentation.

Preparing your Plugin/Theme

It is required that you change your plugin code so the update requests will not be send to wordpress.org but to your server.

I am currently developing a Wordpress sub-framework for handling this. Keep watching THEUPDATES standalone for more to come.

I have not tested it but it should work as well with the plugin and theme files of the Automatic Theme & Plugin Updater from jeremyclark13. Which, btw. can also be a great alternative to this project if you want to keep your plugin code completely on your server.

Props

Inspired by:

Inspired means that i have seen these brilliant projects, started to use them and than started to write my own version with the intention to just have the functionality i really use.
I got the idea of how things are working by analyzing and using the code of them and i can't say where i used snippets from these projects but they've influenced my code strongly.

Uses:

Changelog

1.0.3

  • Supports now page-level DocBlocks before WP-project-info comment in the info-file.

1.0.2

  • Internal change to the way the Request class gets its parameters from the request.
  • Added a "clean_cacheandtemp" action (?action=clean_cacheandtemp&confirm=[yourPassword])
    The confirmation password can be set in globalSettings.json.
  • Added the filename to error outputs via _exit().
  • Recursive dir deletion now via readdir() instead of glob().

1.0.1

  • Added "remoteSlug" to documentation of optional project Settings.
  • Added the possibility to include The pear package "File_Archive" from the projects folder. This way it is possible to change the package without affecting other projects relying on this package. The change might be required to address this issue.
  • Minor bugfixes and cosmetics.

Todo

Here is a list of tasks that i think would be nice to have. But i did not took the time to build/test them.

  • Test with larger repositories
  • Get gitlab https to work
  • Check protected github + public bitbucket
  • Add forceCacheLive option for relying on local cache for a specific time frame
  • Add cronjob requests for checking cache and gitlab login.
  • Write tests
  • Spice up the theme detail page.
  • Backend ;)

This tasks are hard to me it would be nice if anyone can help:

  • Check documentation for logical and spelling mistakes
  • Check the code for security issues.
  • Check the code for logic optimization.

I am not an native English speaker so please pardon any spelling or grammar mistakes. I'd really love to get some feedback for any errors in the documentation.

License

Copyright (C) 2012 Hannes Diercks

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.