Bläddra i källkod

Add a script to install SMF packages into the image.

mw_31
Adrian Malacoda 11 månader sedan
förälder
incheckning
2d417f433d
2 ändrade filer med 56 tillägg och 0 borttagningar
  1. 4
    0
      Dockerfile
  2. 52
    0
      scripts/add_mod.php

+ 4
- 0
Dockerfile Visa fil

@@ -42,6 +42,10 @@ RUN /scripts/add_extension.sh FlaggedRevs $MW_VERSION && \
/scripts/add_extension.sh Nuke $MW_VERSION && \
/scripts/add_extension.sh Auth_remoteuser $MW_VERSION

# Install SMF mods
# 3 September 2018: These would also need to be installed in the database.
RUN /scripts/add_mod.php "http://custom.simplemachines.org/mods/index.php?action=download;mod=3067;id=179832"

# Add our stuff
ADD --chown=www-data:www-data application application
RUN cd $WIKI_SOURCE && composer update --no-dev

+ 52
- 0
scripts/add_mod.php Visa fil

@@ -0,0 +1,52 @@
#!/usr/bin/env php
<?php
define("SMF", true);
$boarddir = getenv("FORUMS_SOURCE");
$sourcedir = "$boarddir/Sources";
$forum_version = "SMF " . getenv("SMF_VERSION");

$temp_dir = "$boarddir/Packages/temp";

require_once("$sourcedir/Errors.php");
require_once("$sourcedir/QueryString.php");
require_once("$sourcedir/Subs.php");
require_once("$sourcedir/Subs-Package.php");

function loadLanguage($language) {}

function download($uri) {
$entries = scandir(".");
passthru("wget --content-disposition \"$uri\"");
return array_values(array_diff(scandir("."), $entries))[0];
}

function downloadPackage($packageUrl) {
global $boarddir;
$packageFile = download($packageUrl);
$fullPackageName = "$boarddir/Packages/$packageFile";
rename($packageFile, $fullPackageName);
return $packageFile;
}

function unpackPackage($packageFile) {
global $boarddir, $temp_dir;
$fullPackageName = "$boarddir/Packages/$packageFile";
mktree($temp_dir, 0777);
read_tgz_file($fullPackageName, $temp_dir);
}

function installPackage($packageFile) {
$packageInfo = getPackageInfo($packageFile);
return parsePackageInfo($packageInfo['xml'], false);
}

function cleanup() {
global $temp_dir;
deltree($temp_dir);
}

$packageUrl = $argv[1];
$packageFile = downloadPackage($packageUrl);
unpackPackage($packageFile);
installPackage($packageFile);
cleanup();

Laddar…
Avbryt
Spara