From 4db100ce95f472f68a59364345b9586250cb47b7 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Thu, 30 Jul 2020 21:47:26 -0700 Subject: [PATCH] FiveTwentyEight - Provide concrete details about civicrm.files This hopefully makes it easier to decide what to do without needing a scavenger hunt. --- .../Incremental/php/FiveTwentyEight.php | 25 ++++++++++++------- CRM/Utils/System/WordPress.php | 3 +++ 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/CRM/Upgrade/Incremental/php/FiveTwentyEight.php b/CRM/Upgrade/Incremental/php/FiveTwentyEight.php index e0f9146707..27b49c8f3f 100644 --- a/CRM/Upgrade/Incremental/php/FiveTwentyEight.php +++ b/CRM/Upgrade/Incremental/php/FiveTwentyEight.php @@ -56,16 +56,23 @@ class CRM_Upgrade_Incremental_php_FiveTwentyEight extends CRM_Upgrade_Incrementa return ''; } - return '

' . ts('Starting with version 5.29.0, CiviCRM on WP will - automate the determination of the civicrm files directory. Please - read the upgrade documentation related to this change before starting the upgrade process - If you have a legacy (wp-content/plugins/files/civicrm) or non-standard directory - structure you will need to either override the settings in civicrm.settings.php - or by specifying the locations in System Settings Directories and System - Settings Resource URLs. . Starting with version 4.7.0, wp-content/uploads/civicrm/ - is the standard WordPress CiviCRM Files directory.', [ + $table = '' + . sprintf('', ts('[civicrm.files] Path')) + . sprintf('', ts('5.29 Default:'), wp_upload_dir()['basedir'] . DIRECTORY_SEPARATOR . 'civicrm' . DIRECTORY_SEPARATOR) + . sprintf('', ts('5.28 Default:'), CRM_Core_Config::singleton()->userSystem->getDefaultFileStorage()['path']) + . sprintf('', ts('Active Value:'), Civi::paths()->getVariable('civicrm.files', 'path')) + . sprintf('', ts('[civicrm.files] URL')) + . sprintf('', ts('5.29 Default:'), wp_upload_dir()['baseurl'] . '/civicrm/') + . sprintf('', ts('5.28 Default:'), CRM_Core_Config::singleton()->userSystem->getDefaultFileStorage()['url']) + . sprintf('', ts('Active Value:'), Civi::paths()->getVariable('civicrm.files', 'url')) + . '
%s
%s%s
%s%s
%s%s
%s
%s%s
%s%s
%s%s
'; + + return '

' . ts('Starting with version 5.29.0, CiviCRM on WordPress may make a subtle change in the calculation of [civicrm.files]. + To ensure a smooth upgrade, please review the following table. All paths and URLs should appear the same. If there is any discrepancy, + then consult the upgrade documentation.', [ 1 => 'https://docs.civicrm.org/sysadmin/en/latest/upgrade/version-specific/#civicrm-5.29', - ]) . '

'; + 2 => '...wp-content/uploads/civicrm', + ]) . '

' . $table; } /* diff --git a/CRM/Utils/System/WordPress.php b/CRM/Utils/System/WordPress.php index 31b95ccda3..63672eeeec 100644 --- a/CRM/Utils/System/WordPress.php +++ b/CRM/Utils/System/WordPress.php @@ -135,6 +135,9 @@ class CRM_Utils_System_WordPress extends CRM_Utils_System_Base { * Moved from CRM_Utils_System_Base */ public function getDefaultFileStorage() { + // NOTE: On WordPress, this will be circumvented in the future. However, + // should retain it to allow transitional/upgrade code determine the old value. + $config = CRM_Core_Config::singleton(); $cmsUrl = CRM_Utils_System::languageNegotiationURL($config->userFrameworkBaseURL, FALSE, TRUE); $cmsPath = $this->cmsRootPath(); -- 2.25.1