User:Aexoxea/Tiki Wiki CMS Groupware/Files Stable

From ArchWiki

These files can be used to build and install the latest stable release of Tiki Wiki CMS Groupware.

Note: This page exists in lieu of a package in AUR for now. I still consider these files to be experimental and I can't yet commit to keeping them updated.
PKGBUILD
pkgname=tikiwiki
pkgver=18.1
pkgrel=1
_relcodename="18.x_Alcyone"
_minphpver="5.6"   # Inclusive of this version.
_maxphpver="7.3"   # Exclusive of this version.
pkgdesc="Tiki Wiki CMS Groupware, stable version."
arch=('any')
url="https://tiki.org/"
license=('LGPL2.1')
depends=("php-intl>=${_minphpver}" "php-intl<${_maxphpver}")
optdepends=("php-gd>=${_minphpver}: image processing and CAPTCHAs"
            "php-gd<${_maxphpver}: image processing and CAPTCHAs"
            "mariadb>=5.0: supported database server"
            "mysql>=5.0: supported database server")
makedepends=("unzip")
conflicts=('tikiwiki-lts')
source=("tiki-${pkgver}.tar.gz::https://sourceforge.net/projects/tikiwiki/files/Tiki_${_relcodename}/${pkgver}/tiki-${pkgver}.tar.gz/download"
        "apache.example.conf"
        "setup-6460.diff")
options=('emptydirs' '!strip')
install="${pkgname}.install"
md5sums=('e77429d6ccee2ec5fca4bb3b13cf11c0'
         'f761900ca84055a145a68ad10551aced'
         'a03b834fab3a0a802c7123a4034cf8d9')
sha1sums=('29217ba03712152f48efa05fefe568484f116f1c'
          'db56b4e1960f16a595a6b309a77d0fee46b48bf0'
          '3d3275c87a84c6169021a86f5e53aa52af5eebb6')

package() {
# Copy the main package files into place.
mkdir --parents "${pkgdir}/usr/share/webapps/"
cp --archive --force "${srcdir}/tiki-${pkgver}" "${pkgdir}/usr/share/webapps/tikiwiki"

# Install the Apache example configuration.
install -D --mode="644" --target-directory="${pkgdir}/etc/webapps/tikiwiki/" "${srcdir}/apache.example.conf"

# Ready the setup script for use.
chmod a+rx,u+w "${pkgdir}/usr/share/webapps/tikiwiki/setup.sh"
patch "${pkgdir}/usr/share/webapps/tikiwiki/setup.sh" "${srcdir}/setup-6460.diff"   # Workaround for 'https://dev.tiki.org/item6460'.

# Run the setup script.
cd "${pkgdir}/usr/share/webapps/tikiwiki/"
if [ -e "/usr/bin/php" ]; then
    ./setup.sh -u http -g http -n fix
elif [ -e "/usr/bin/php72" ]; then
    ./setup.sh -u http -g http -p php72 -n fix
elif [ -e "/usr/bin/php71" ]; then
    ./setup.sh -u http -g http -p php71 -n fix
elif [ -e "/usr/bin/php70" ]; then
    ./setup.sh -u http -g http -p php70 -n fix
elif [ -e "/usr/bin/php56" ]; then
    ./setup.sh -u http -g http -p php56 -n fix
else
    echo ":: WARNING: Setup script not run as no supported PHP binary could be found."
fi
}
apache.example.conf
<IfModule mod_alias.c>
    Alias /tiki /usr/share/webapps/tikiwiki/
</IfModule>

<Directory /usr/share/webapps/tikiwiki/>
    Options FollowSymlinks
    AllowOverride all
    Require all granted
    php_admin_value open_basedir "/srv/http/:/dev/urandom:/tmp/:/usr/share/pear/:/usr/share/webapps/tikiwiki/:/etc/webapps/tikiwiki/"
</Directory>
setup-6460.diff
--- setup.sh
+++ setup.sh
@@ -553,10 +553,10 @@
 	then
 		if exists curl;
 		then
-			curl -s https://getcomposer.org/installer | php -- --install-dir=temp
+			curl -s https://getcomposer.org/installer | "${PHPCLI}" -- --install-dir=temp
 		else
 			# todo : if exists php;
-			php -r "eval('?>'.file_get_contents('https://getcomposer.org/installer'));" -- --install-dir=temp
+			"${PHPCLI}" -r "eval('?>'.file_get_contents('https://getcomposer.org/installer'));" -- --install-dir=temp
 		fi
 		# if PATCHCOMPOSERFLAG then modify temp/composer.phar to avoid the warnings
 		# this hack is not yet possible because of a self signature check in temp/composer.phar
tikiwiki.install
pre_install() {

echo ":: Prior to installing Tiki Wiki CMS Groupware, you should consider the actions"
echo "   listed at:"
echo "   'https://wiki.archlinux.org/index.php/User:Aexoxea/Tiki_Wiki_CMS_Groupware#Before_Installation'"

}

post_install() {

echo ":: If you encounter trouble using Tiki Wiki CMS Groupware on PHP 7.2 or 7.1,"
echo "   consider downgrading to PHP 7.0 or 5.6. More information can be found at"
echo "   'https://doc.tiki.org/Requirements'."
echo "   "
echo ":: To complete the setup of Tiki Wiki CMS Groupware, you need to follow the"
echo "   instructions starting at:"
echo "   'https://wiki.archlinux.org/index.php/User:Aexoxea/Tiki_Wiki_CMS_Groupware#Installation_and_server_set_up'"

}

pre_upgrade() {

echo ":: Prior to upgrading Tiki Wiki CMS Groupware, you should consider the actions"
echo "   listed at:"
echo "   'https://wiki.archlinux.org/index.php/User:Aexoxea/Tiki_Wiki_CMS_Groupware#Before_updating'"

# Clear out Tiki caches -- cached files may interfere with the upgrade process.
rm --force --recursive /usr/share/webapps/tikiwiki/modules/cache/*
rm --force --recursive /usr/share/webapps/tikiwiki/temp/cache/*
rm --force --recursive /usr/share/webapps/tikiwiki/temp/public/*
rm --force --recursive /usr/share/webapps/tikiwiki/temp/templates_c/*

}

post_upgrade() {

# Remove lock file -- allows Tiki installer to be used.
rm --force /usr/share/webapps/tikiwiki/db/lock

echo ":: To complete the upgrade of Tiki Wiki CMS Groupware, you need to follow the"
echo "   instructions starting at:"
echo "   'https://wiki.archlinux.org/index.php/User:Aexoxea/Tiki_Wiki_CMS_Groupware#Apply_the_update'"

}

pre_remove() {

# Clear out Tiki caches -- cached files may interfere with the upgrade process (if doing a remove-then-install).
rm --force --recursive /usr/share/webapps/tikiwiki/modules/cache/*
rm --force --recursive /usr/share/webapps/tikiwiki/temp/cache/*
rm --force --recursive /usr/share/webapps/tikiwiki/temp/public/*
rm --force --recursive /usr/share/webapps/tikiwiki/temp/templates_c/*

}

post_remove() {

# Remove lock file -- allows Tiki installer to be used (if doing a remove-then-install).
rm --force /usr/share/webapps/tikiwiki/db/lock

echo ":: If you're removing Tiki Wiki CMS Groupware for good, remember to:"
echo "   (1) Remove Tiki's database (and database user account, if applicable)."
echo "   (2) Remove any residual files under /usr/share/webapps/tikiwiki/."

}