CRM-15897 - Fix for Joomla Image Url's not upgraded
authoratif-shaikh <shaikh388@gmail.com>
Mon, 9 Feb 2015 07:47:02 +0000 (13:17 +0530)
committeratif-shaikh <shaikh388@gmail.com>
Fri, 13 Feb 2015 06:44:15 +0000 (12:14 +0530)
----------------------------------------
* CRM-15897: Contact ImagesUnviewable - Issue Persisting through 4.5.5
  https://issues.civicrm.org/jira/browse/CRM-15897

CRM/Upgrade/Incremental/php/FourFour.php

index af2a61d3a00a04b025f6b138e84300d217e18ee5..79383f3eb5420e4d4b6bda0d9e937e478dd08e55 100644 (file)
@@ -378,13 +378,17 @@ ALTER TABLE civicrm_dashboard
   static function upgradeImageUrls(CRM_Queue_TaskContext $ctx, $startId, $endId){
     $dao = self::findContactImageUrls($startId, $endId);
     $failures = array();
+    $config = CRM_Core_Config::singleton();
     while ($dao->fetch()){
       $imageURL = $dao->image_url;
       $baseurl = CIVICRM_UF_BASEURL;
+      //CRM-15897 - gross hack for joomla we need to remove the administrator/
+      if ($config->userFramework == 'Joomla') {
+        $baseurl = str_replace("/administrator/", "/", $baseurl);
+      }
       $baselen = strlen($baseurl);
       if (substr($imageURL, 0, $baselen)==$baseurl){
         $photo = basename($dao->image_url);
-        $config = CRM_Core_Config::singleton();
         $fullpath = $config->customFileUploadDir.$photo;
           if (file_exists($fullpath)){
             // For anyone who upgraded 4.4.6 release (eg 4.4.0=>4.4.6), the $newImageUrl incorrectly used backend URLs.