CRM-16425 Added CiviCRM Licensing Exception in header
[civicrm-core.git] / CRM / Upgrade / Incremental / php / FourFour.php
index 6d7f437960192fab580abcb5a92c1ce88d43527e..c7a2f4c611bad05f0f554333c4bae9f8e53bfa1b 100644 (file)
@@ -3,13 +3,13 @@
  +--------------------------------------------------------------------+
  | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014                                |
+ | Copyright CiviCRM LLC (c) 2004-2015                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
  | CiviCRM is free software; you can copy, modify, and distribute it  |
  | under the terms of the GNU Affero General Public License           |
- | Version 3, 19 November 2007.                                       |
+ | Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   |
  |                                                                    |
  | CiviCRM is distributed in the hope that it will be useful, but     |
  | WITHOUT ANY WARRANTY; without even the implied warranty of         |
  | See the GNU Affero General Public License for more details.        |
  |                                                                    |
  | You should have received a copy of the GNU Affero General Public   |
- | License along with this program; if not, contact CiviCRM LLC       |
+ | License and the CiviCRM Licensing Exception along                  |
+ | with this program; if not, contact CiviCRM LLC                     |
  | at info[AT]civicrm[DOT]org. If you have questions about the        |
  | GNU Affero General Public License or the licensing of CiviCRM,     |
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
-*/
+ */
 
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2014
+ * @copyright CiviCRM LLC (c) 2004-2015
  * $Id$
  *
  */
@@ -46,7 +47,7 @@ class CRM_Upgrade_Incremental_php_FourFour {
   }
 
   /**
-   * Compute any messages which should be displayed beforeupgrade
+   * Compute any messages which should be displayed beforeupgrade.
    *
    * Note: This function is called iteratively for each upcoming
    * revision to the database.
@@ -76,7 +77,7 @@ class CRM_Upgrade_Incremental_php_FourFour {
   }
 
   /**
-   * Compute any messages which should be displayed after upgrade
+   * Compute any messages which should be displayed after upgrade.
    *
    * @param string $postUpgradeMessage
    *   alterable.
@@ -379,16 +380,29 @@ ALTER TABLE civicrm_dashboard
     $this->addTask(ts('Update saved search information'), 'changeSavedSearch');
   }
 
+  /**
+   * Upgrade image URLs.
+   *
+   * @param \CRM_Queue_TaskContext $ctx
+   * @param $startId
+   * @param $endId
+   *
+   * @return bool
+   */
   public 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 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.
@@ -408,6 +422,13 @@ ALTER TABLE civicrm_dashboard
     return TRUE;
   }
 
+  /**
+   * Change saved search.
+   *
+   * @param \CRM_Queue_TaskContext $ctx
+   *
+   * @return bool
+   */
   public static function changeSavedSearch(CRM_Queue_TaskContext $ctx) {
     $membershipStatuses = array_flip(CRM_Member_PseudoConstant::membershipStatus());
 
@@ -832,4 +853,5 @@ CREATE TABLE IF NOT EXISTS `civicrm_word_replacement` (
     }
     return $result;
   }
+
 }