1

I am trying add a Wordpress plugin from a Github Enterprise repo into my project. I have my wp-content folder within the root and my composer.json is as follows:

  "repositories": [
      {
      "type": "package",
      "package": {
        "name": "name/plugin-name,
        "type": "wordpress-plugin",
        "version": "v1.0",
        "dist": {
          "type": "zip",
          "url": "https://example.githubname.com/name/plugin-name/archive/v1.0.zip"
        },
        "require" : {
          "composer/installers": "v1.0.21"
        }
      }
    },
    {
      "type":"composer",
      "url":"http://wpackagist.org"
    }
  ],
  "require": {
    "name/plugin-name": "v1.0"
  },

}

The following repository looks to unzip this repo and unpack it into the /wp-content/ folder.

I get the following error:

    Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Installing name/plugin-name (v1.0)
    Downloading: 100%
    Invalid zip file, retrying...
  - Installing name/plugin-name (v1.0)
    Downloading: 100%
    Invalid zip file, retrying...
  - Installing name/plugin-name (v1.0)
    Downloading: 100%


  [UnexpectedValueException]
  'wp-content/plugins/plugin-name//2b5746433a46375b233f5f91a9a69b43.zip' is not a zip archive.

It looks like the zip may be trying to authenticate via Github Enterprise. I tried removing ""url": "https://example.githubname.com/name/plugin-name/archive/v1.0.zip"" and adding a public facing repo like ""url": "https://github.com/WordPress/WordPress/archive/4.2.2.zip"" and it downloads into the plugin-name folder properly.

Is there something I can to for a github enterprise hosted wordpress plugin to be able to be extracted in the wp-content folder?

dope
  • 113
  • 3
  • 11

1 Answers1

1

The public URL that works is a Release for that repo. See the link "Source code (zip)" in the Release tagged 4.2.2 - it matches the public .zip URL you're pointing to:

https://github.com/WordPress/WordPress/releases/tag/4.2.2

Similarly, if you take the source you have and "release" it so that instead of storing the .zip in the repo, you make it a release and reference the release .zip it should work.

Alternatively, if you put the .zip in the repo, it might work if you reference the "raw" url but the example above is what actually recreates the public scenario.

busse
  • 1,761
  • 14
  • 25
  • Right now the zip is prerelease. Would that be an issue? Also people have mentioned to use Satis. – dope May 22 '15 at 04:25
  • 1
    @dope The zip being prerelease or release is more of a matter of preference I guess - would other people be accessing that repo that thinking it is a real release? If not, or if you label the version as prerelease, you should be ok. Regarding Satis, that may work, but you still need to host it in such a way that the GHE server serves is as an actual .zip and not a web page referencing the zip - see the raw URL question here: http://stackoverflow.com/questions/4604663/download-single-files-from-github – busse May 25 '15 at 12:49