Commit 9eec3edc authored by Mitsuhiro Yoshida's avatar Mitsuhiro Yoshida Committed by Robert Lyon
Browse files

Bug 1871515: pdfunite and ghostscript availability check for RHEL/CentOS

Change-Id: I8627d9c42323a85d65d7a50c16ae6c54a082f956
(cherry picked from commit c12c87dc)
parent 05cae220
Loading
Loading
Loading
Loading
+15 −3
Original line number Diff line number Diff line
@@ -69,16 +69,28 @@ class PluginExportPdf extends PluginExportHtml {
    public static function has_pdf_combiner() {
        // Check we have a valid way to combine pdfs
        $combiner = false;
        if ($pdfunite = exec('apt-cache policy poppler-utils | grep Installed')) {

        if ($pdfunite = exec('apt-cache policy poppler-utils | grep Installed')) { // Ubuntu
            if (!preg_match('/Installed\: \(none\)/', $pdfunite)) {
                $combiner = 'pdfunite';
            }
        }
        if ($ghostscript = exec('apt-cache policy ghostscript | grep Installed')) {
        else if ($pdfunite = exec('rpm -q poppler-utils')) { // RHEL / CentOS
            if (!preg_match('/is not installed/', $pdfunite)) {
                $combiner = 'pdfunite';
            }
        }

        if ($ghostscript = exec('apt-cache policy ghostscript | grep Installed')) { // Ubuntu
            if (!preg_match('/Installed\: \(none\)/', $ghostscript)) {
                $combiner = 'ghostscript';
            }
        }
        else if ($ghostscript = exec('rpm -q ghostscript')) { // RHEL / CentOS
            if (!preg_match('/is not installed/', $ghostscript)) {
                $combiner = 'ghostscript';
            }
        }
        return $combiner;
    }