Add a script to install SMF packages into the image.

Esse commit está contido em:
Adrian Malacoda 2018-09-03 21:53:41 -05:00
commit 2d417f433d
2 arquivos alterados com 56 adições e 0 exclusões

Ver arquivo

@ -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
scripts/add_mod.php Arquivo executável
Ver arquivo

@ -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();