Skip to content

Instantly share code, notes, and snippets.

@demeritcowboy
Last active November 13, 2019 02:56
Show Gist options
  • Save demeritcowboy/e1a0b6dbe8149e4f3e04510cf4c3ae80 to your computer and use it in GitHub Desktop.
Save demeritcowboy/e1a0b6dbe8149e4f3e04510cf4c3ae80 to your computer and use it in GitHub Desktop.
Install civicrm on drupal 8 using roundearth on windows - Sept 2019 version

OBSOLETE

Variation of patch below has been merged into the roundearth plugin as of 2019-11-12, so shouldn't need this anymore.


Intro

There's a problem that seems to have been around since about June 2019 where archive_tar is no longer able to extract the civicrm download .tar.gz file on windows so the install fails. These steps will get it installed.

Steps

  • composer create-project roundearth/drupal-civicrm-project:8.x-dev some-dir
    • It will fail with an error about unable to extract.
  • Apply hack patch to vendor/roundearth/civicrm-composer-plugin/src/Handler.php
--- Handler.php
+++ Handler.php.new
@@ -195,8 +195,10 @@
       $this->filesystem->dumpFile($civicrm_archive_file, fopen($civicrm_archive
_url, 'r'));

       $this->output("<info>Extracting CiviCRM {$civicrm_version} release...</in
fo>");
-      $extract_successful = (new \Archive_Tar($civicrm_archive_file, "gz"))->ex
tract($civicrm_extract_path);
-      if (!$extract_successful) {
+      try {
+        $phar = new \PharData($civicrm_archive_file);
+        $phar->extractTo($civicrm_extract_path);
+      } catch (Exception $e) {
         throw new \RuntimeException("Unable to extract: $civicrm_archive_file")
;
       }
  • Delete vendor/civicrm/civicrm-core.
    • This is important because otherwise it won't trigger the plugin to do its thing in the next step.
  • From the root folder where you installed the project, type:
    • composer require civicrm/civicrm-drupal-8
  • Install drupal normally, e.g. visiting http://site/install.php.
  • If logged in to website, logout.
  • From the root folder where you installed the project, type:
    • vendor\drush\drush\drush.bat en -y -l host.name.org civicrm
      • Replace host.name.org with the correct domain name, e.g. example.org. Without the -l parameter you'll probably end up with http://DEFAULT as civi's BASEURL.
  • Log back in
  • The civi menus will look messed up. So as it says in the roundearth readme, update the resource url by going to /civicrm/admin/setting/url?reset=1 and setting the value to [cms.root]/libraries/civicrm.
@demeritcowboy
Copy link
Author

Updated gist with alternate PharData patch. Also see https://gitlab.com/roundearth/civicrm-composer-plugin/merge_requests/8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment