Skip to content
This repository
Browse code

Move JUpdater:arrayUnique() to JArrayHelper::arrayUnique(). Keep JUpd…

…ater:arrayUnique() as an alias an deprecate it.
  • Loading branch information...
commit 354a7653ca81acc1b12a3b1c1e6188e078bd9451 1 parent f5c536e
Rouven Weßling authored June 10, 2011
23  libraries/joomla/updater/updater.php
@@ -14,6 +14,8 @@
14 14
 jimport('joomla.filesystem.archive');
15 15
 jimport('joomla.filesystem.path');
16 16
 jimport('joomla.base.adapter');
  17
+jimport('joomla.utilities.arrayhelper');
  18
+jimport('joomla.log.log');
17 19
 
18 20
 /**
19 21
  * Updater Class
@@ -79,7 +81,7 @@ public function findUpdates($eid=0) {
79 81
 			{
80 82
 				if(array_key_exists('update_sites',$update_result) && count($update_result['update_sites']))
81 83
 				{
82  
-					$results = $this->arrayUnique(array_merge($results, $update_result['update_sites']));
  84
+					$results = JArrayHelper::arrayUnique(array_merge($results, $update_result['update_sites']));
83 85
 					$result_count = count($results);
84 86
 				}
85 87
 				if(array_key_exists('updates', $update_result) && count($update_result['updates']))
@@ -139,24 +141,13 @@ public function findUpdates($eid=0) {
139 141
 	 * Multidimensional array safe unique test
140 142
 	 * Borrowed from PHP.net
141 143
 	 * @see http://au2.php.net/manual/en/function.array-unique.php
  144
+	 *
  145
+	 * @deprecated	11.1	Use JArrayHelper::arrayUnique() instead.
142 146
 	 */
143 147
 	public function arrayUnique($myArray)
144 148
 	{
145  
-		if (!is_array($myArray)) {
146  
-			return $myArray;
147  
-		}
148  
-
149  
-		foreach ($myArray as &$myvalue){
150  
-			$myvalue=serialize($myvalue);
151  
-		}
152  
-
153  
-		$myArray=array_unique($myArray);
154  
-
155  
-		foreach ($myArray as &$myvalue){
156  
-			$myvalue=unserialize($myvalue);
157  
-		}
158  
-
159  
-		return $myArray;
  149
+		JLog::add('JUpdater::arrayUnique() is deprecated. See JArrayHelper::arrayUnique().', JLog::WARNING, 'deprecated');
  150
+		return JArrayHelper::arrayUnique($myArray);
160 151
 	}
161 152
 
162 153
 	public function update($id)
24  libraries/joomla/utilities/arrayhelper.php
@@ -360,4 +360,28 @@ protected static function _sortObjects(&$a, &$b)
360 360
 
361 361
 		return 0;
362 362
 	}
  363
+
  364
+	/**
  365
+	 * Multidimensional array safe unique test
  366
+	 * Borrowed from PHP.net
  367
+	 * @see http://au2.php.net/manual/en/function.array-unique.php
  368
+	 */
  369
+	public static function arrayUnique($myArray)
  370
+	{
  371
+		if (!is_array($myArray)) {
  372
+			return $myArray;
  373
+		}
  374
+
  375
+		foreach ($myArray as &$myvalue){
  376
+			$myvalue=serialize($myvalue);
  377
+		}
  378
+
  379
+		$myArray=array_unique($myArray);
  380
+
  381
+		foreach ($myArray as &$myvalue){
  382
+			$myvalue=unserialize($myvalue);
  383
+		}
  384
+
  385
+		return $myArray;
  386
+	}
363 387
 }

0 notes on commit 354a765

Please sign in to comment.
Something went wrong with that request. Please try again.