Public bug reported:

Adding the following code, we can check Chrome browser installation on
Red Hat Enterprise Linux (RHEL) and CentOS environment (Related to Bug
#1871515).

File to modify:
export/pdf/lib.php

Line:
133

[Before]
    /**
     * Dumps all views into the HTML export
     */
    private function pdf_view_export_data() {
        global $pdfrun;
        static $browser;
        static $page;

        $progressstart = 85;
        $progressend   = 95;
        $i = 0;
        $viewcount = count($this->views);

        if (!isset($pdfrun) || $pdfrun == 'first' || $pdfrun == 'all') {
            $browsertype = 'chromium-browser';
            system('dpkg -l | grep ' . $browsertype, $error);
            if ($error) {
                $browsertype = 'chrome';
                system('dpkg -l | grep ' . $browsertype, $error2);
                if ($error2) {
                    throw new MaharaException('Need to have a Chrome browser 
installed to use the headless pdf option');
                }
            }

[After]
    /**
     * Dumps all views into the HTML export
     */
    private function pdf_view_export_data() {
        global $pdfrun;
        static $browser;
        static $page;

        $progressstart = 85;
        $progressend   = 95;
        $i = 0;
        $viewcount = count($this->views);
        if (system('command -v dpgk')) {
            $command = 'dpkg -l';
        } else {
            $command = 'rpm -qa';
        }

        if (!isset($pdfrun) || $pdfrun == 'first' || $pdfrun == 'all') {
            $browsertype = 'chromium-browser';
            system($command . ' | grep ' . $browsertype, $error);
            if ($error) {
                $browsertype = 'chrome';
                system($command . ' | grep ' . $browsertype, $error2);
                if ($error2) {
                    throw new MaharaException('Need to have a Chrome browser 
installed to use the headless pdf option');
                }
            }

** Affects: mahara
     Importance: Medium
         Status: New


** Tags: export

-- 
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: Subscription for all Mahara Contributors -- please ask 
on #mahara-dev or mahara.org forum before editing or unsubscribing it!
https://bugs.launchpad.net/bugs/1871718

Title:
  Chrome browser availability check for RHEL/CentOS

Status in Mahara:
  New

Bug description:
  Adding the following code, we can check Chrome browser installation on
  Red Hat Enterprise Linux (RHEL) and CentOS environment (Related to Bug
  #1871515).

  File to modify:
  export/pdf/lib.php

  Line:
  133

  [Before]
      /**
       * Dumps all views into the HTML export
       */
      private function pdf_view_export_data() {
          global $pdfrun;
          static $browser;
          static $page;

          $progressstart = 85;
          $progressend   = 95;
          $i = 0;
          $viewcount = count($this->views);

          if (!isset($pdfrun) || $pdfrun == 'first' || $pdfrun == 'all') {
              $browsertype = 'chromium-browser';
              system('dpkg -l | grep ' . $browsertype, $error);
              if ($error) {
                  $browsertype = 'chrome';
                  system('dpkg -l | grep ' . $browsertype, $error2);
                  if ($error2) {
                      throw new MaharaException('Need to have a Chrome browser 
installed to use the headless pdf option');
                  }
              }

  [After]
      /**
       * Dumps all views into the HTML export
       */
      private function pdf_view_export_data() {
          global $pdfrun;
          static $browser;
          static $page;

          $progressstart = 85;
          $progressend   = 95;
          $i = 0;
          $viewcount = count($this->views);
          if (system('command -v dpgk')) {
              $command = 'dpkg -l';
          } else {
              $command = 'rpm -qa';
          }

          if (!isset($pdfrun) || $pdfrun == 'first' || $pdfrun == 'all') {
              $browsertype = 'chromium-browser';
              system($command . ' | grep ' . $browsertype, $error);
              if ($error) {
                  $browsertype = 'chrome';
                  system($command . ' | grep ' . $browsertype, $error2);
                  if ($error2) {
                      throw new MaharaException('Need to have a Chrome browser 
installed to use the headless pdf option');
                  }
              }

To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1871718/+subscriptions

_______________________________________________
Mailing list: https://launchpad.net/~mahara-contributors
Post to     : mahara-contributors@lists.launchpad.net
Unsubscribe : https://launchpad.net/~mahara-contributors
More help   : https://help.launchpad.net/ListHelp

Reply via email to