Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

…ater:arrayUnique() as an alias an deprecate it.
  • Loading branch information...
commit 354a7653ca81acc1b12a3b1c1e6188e078bd9451 1 parent f5c536e
@realityking realityking authored
View
23 libraries/joomla/updater/updater.php
@@ -14,6 +14,8 @@
jimport('joomla.filesystem.archive');
jimport('joomla.filesystem.path');
jimport('joomla.base.adapter');
+jimport('joomla.utilities.arrayhelper');
+jimport('joomla.log.log');
/**
* Updater Class
@@ -79,7 +81,7 @@ public function findUpdates($eid=0) {
{
if(array_key_exists('update_sites',$update_result) && count($update_result['update_sites']))
{
- $results = $this->arrayUnique(array_merge($results, $update_result['update_sites']));
+ $results = JArrayHelper::arrayUnique(array_merge($results, $update_result['update_sites']));
$result_count = count($results);
}
if(array_key_exists('updates', $update_result) && count($update_result['updates']))
@@ -139,24 +141,13 @@ public function findUpdates($eid=0) {
* Multidimensional array safe unique test
* Borrowed from PHP.net
* @see http://au2.php.net/manual/en/function.array-unique.php
+ *
+ * @deprecated 11.1 Use JArrayHelper::arrayUnique() instead.
*/
public function arrayUnique($myArray)
{
- if (!is_array($myArray)) {
- return $myArray;
- }
-
- foreach ($myArray as &$myvalue){
- $myvalue=serialize($myvalue);
- }
-
- $myArray=array_unique($myArray);
-
- foreach ($myArray as &$myvalue){
- $myvalue=unserialize($myvalue);
- }
-
- return $myArray;
+ JLog::add('JUpdater::arrayUnique() is deprecated. See JArrayHelper::arrayUnique().', JLog::WARNING, 'deprecated');
+ return JArrayHelper::arrayUnique($myArray);
}
public function update($id)
View
24 libraries/joomla/utilities/arrayhelper.php
@@ -360,4 +360,28 @@ protected static function _sortObjects(&$a, &$b)
return 0;
}
+
+ /**
+ * Multidimensional array safe unique test
+ * Borrowed from PHP.net
+ * @see http://au2.php.net/manual/en/function.array-unique.php
+ */
+ public static function arrayUnique($myArray)
+ {
+ if (!is_array($myArray)) {
+ return $myArray;
+ }
+
+ foreach ($myArray as &$myvalue){
+ $myvalue=serialize($myvalue);
+ }
+
+ $myArray=array_unique($myArray);
+
+ foreach ($myArray as &$myvalue){
+ $myvalue=unserialize($myvalue);
+ }
+
+ return $myArray;
+ }
}
Please sign in to comment.
Something went wrong with that request. Please try again.