# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit webapp

MY_EXT="stable-2021-03-01"

DESCRIPTION="Multilingual multiuser multi-blog engine"
HOMEPAGE="http://www.b2evolution.net"
SRC_URI="https://github.com/b2evolution/b2evolution/releases/download/${PV}/b2evolution-${PV}-${MY_EXT}.zip"

LICENSE="GPL-2"
KEYWORDS="~alpha ~amd64 ~arm ~ppc ~x86"
IUSE=""

RDEPEND="virtual/httpd-php
        || ( dev-lang/php[mysql] dev-lang/php[mysqli] )"
DEPEND="${RDEPEND}
	app-arch/unzip"

need_httpd_cgi

S="${WORKDIR}/${PN}"

src_install() {
	webapp_src_preinst

	insinto "${MY_HTDOCSDIR}"
	doins -r .

	#cp conf/_basic_config.template.php conf/_basic_config.php
	#rm doc/*.*-*.html doc/*.src.html
	#dohtml doc/*.html

	webapp_serverowned "${MY_HTDOCSDIR}"
	webapp_serverowned "${MY_HTDOCSDIR}"/conf/_basic_config.template.php
	webapp_configfile "${MY_HTDOCSDIR}"/conf/_{advanced,application,basic_config.template,config,formatting,icons,locales,stats,upgrade}.php

	webapp_postinst_txt en "${FILESDIR}"/postinstall-en.txt
	webapp_postupgrade_txt en "${FILESDIR}"/postupgrade-en.txt

	webapp_src_install
}