From e05e56b5edab6c0f1a151083db6ab36f8d355fa0 Mon Sep 17 00:00:00 2001
From: mattab <matthieu.aubry@gmail.com>
Date: Mon, 7 Apr 2014 14:28:10 +1200
Subject: [PATCH] Fixes #4958 Remove CoreAdminHome.getKnownSegmentsToArchive
 API

---
 core/CronArchive.php          |  2 +-
 misc/cron/archive.sh          | 18 ------------------
 plugins/CoreAdminHome/API.php |  6 ------
 3 files changed, 1 insertion(+), 25 deletions(-)

diff --git a/core/CronArchive.php b/core/CronArchive.php
index e1b9b8f731..96f5566e42 100644
--- a/core/CronArchive.php
+++ b/core/CronArchive.php
@@ -520,7 +520,7 @@ class CronArchive
 
     private function initSegmentsToArchive()
     {
-        $segments = APICoreAdminHome::getInstance()->getKnownSegmentsToArchive();
+        $segments = \Piwik\SettingsPiwik::getKnownSegmentsToArchive();
         if (empty($segments)) {
             return array();
         }
diff --git a/misc/cron/archive.sh b/misc/cron/archive.sh
index 59af4660b5..6fc4a9c1bc 100755
--- a/misc/cron/archive.sh
+++ b/misc/cron/archive.sh
@@ -70,9 +70,6 @@ TOKEN_AUTH=`cat $FILENAME_TOKEN_CONTENT | cut -f2`
 CMD_GET_ID_SITES="$PHP_BIN -q $PIWIK_PATH -- module=API&method=SitesManager.getAllSitesId&token_auth=$TOKEN_AUTH&format=csv&convertToUnicode=0"
 ID_SITES=`$CMD_GET_ID_SITES`
 
-CMD_GET_SEGMENTS_TO_ARCHIVE="$PHP_BIN -q $PIWIK_PATH -- module=API&method=CoreAdminHome.getKnownSegmentsToArchive&token_auth=$TOKEN_AUTH&format=csv&convertToUnicode=0"
-SEGMENTS_TO_ARCHIVE=`$CMD_GET_SEGMENTS_TO_ARCHIVE`
-
 echo "Starting Piwik reports archiving..."
 echo ""
 for idsite in $ID_SITES; do
@@ -84,21 +81,6 @@ for idsite in $ID_SITES; do
       CMD="$PHP_BIN -q $PIWIK_PATH -- module=API&method=VisitsSummary.getVisits&idSite=$idsite&period=$period&date=last52&format=xml&token_auth=$TOKEN_AUTH"
       $CMD
       
-      for segment in $SEGMENTS_TO_ARCHIVE; do
-	    if test $segment != "value"; then
-	        # Ignore "No data available" response when there are no segment to pre-process
-            if test $segment != "No"; then
-            if test $segment != "data"; then
-            if test $segment != "available"; then
-              echo ""
-              echo " - Archiving for visitor segment $segment ..."
-              CMD_ARCHIVE_SEGMENT="${CMD}&segment=$segment"
-              $CMD_ARCHIVE_SEGMENT
-            fi
-            fi
-            fi
-        fi
-      done
     done
 
     echo ""
diff --git a/plugins/CoreAdminHome/API.php b/plugins/CoreAdminHome/API.php
index d3d8f9adf7..8a0f0ed8c9 100644
--- a/plugins/CoreAdminHome/API.php
+++ b/plugins/CoreAdminHome/API.php
@@ -39,12 +39,6 @@ class API extends \Piwik\Plugin\API
         return TaskScheduler::runTasks();
     }
 
-    public function getKnownSegmentsToArchive()
-    {
-        Piwik::checkUserHasSuperUserAccess();
-        return SettingsPiwik::getKnownSegmentsToArchive();
-    }
-
     /*
      * stores the list of websites IDs to re-reprocess in archive.php
      */
-- 
GitLab