Return done flags used to tell how the archiving process for a specific archive was completed,

@param array $plugins
@param $segment
@return array
330406
public static function getDoneFlags(array $plugins, Segment $segment)
    {
        $doneFlags = array();
        $doneAllPlugins = self::getDoneFlagArchiveContainsAllPlugins($segment);
        $doneFlags[$doneAllPlugins] = $doneAllPlugins;

        $plugins = array_unique($plugins);
        foreach ($plugins as $plugin) {
            $doneOnePlugin = self::getDoneFlagArchiveContainsOnePlugin($segment, $plugin);
            $doneFlags[$plugin] = $doneOnePlugin;
        }
        return $doneFlags;
    }
169794
public function parse($segment)
    {
        $generated = new PosGenerated();
        $source = new PosSource();
        $pos = new PosMap($generated, $source);
        try {
            $offsets = $this->encoder->decode($segment);
        } catch (VLQError $e) {
            throw new InvalidMappings('Invalid segment "'.$segment.'"', $e);
        }
        $count = count($offsets);
        if (!in_array($count, [1, 4, 5])) {
            throw new InvalidMappings('Invalid segment "'.$segment.'"');
        }
        $generated->line = $this->gLine;
        $this->gColumn += $offsets[0];
        $generated->column = $this->gColumn;
        if ($count >= 4) {
            $this->sFile += $offsets[1];
            $this->sLine += $offsets[2];
            $this->sColumn += $offsets[3];
            $source->fileIndex = $this->sFile;
            $source->line = $this->sLine;
            $source->column = $this->sColumn;
            if ($count === 5) {
                $this->sName += $offsets[4];
                $source->nameIndex = $this->sName;
            }
        }
        return $pos;
    }
612865
protected function getURIsegments($uri, $segmentCount)
    {
        if( $uri === NULL)
        {
            $uri = URI::active();
        }

        
        return explode('/' , rtrim(Datatype::divide($uri, '/', 0, $segmentCount), '/'));
    }
840496
protected static function getPluginArchivers()
    {
        if (empty(static::$archivers)) {
            $pluginNames = \Piwik\Plugin\Manager::getInstance()->getActivatedPlugins();
            $archivers = array();
            foreach ($pluginNames as $pluginName) {
                $archivers[$pluginName] = self::getPluginArchiverClass($pluginName);
            }
            static::$archivers = array_filter($archivers);
        }
        return static::$archivers;
    }
535630
public function list_restorable_archives() {
        global $CFG;

        if (!empty($CFG->disableupdateautodeploy)) {
            return false;
        }

        $codeman = $this->get_code_manager();
        $restorable = array();
        foreach ($this->get_plugins() as $type => $plugins) {
            foreach ($plugins as $plugin) {
                if ($this->can_cancel_plugin_upgrade($plugin)) {
                    $restorable[$plugin->component] = (object)array(
                        'component' => $plugin->component,
                        'zipfilepath' => $codeman->get_archived_plugin_version($plugin->component, $plugin->versiondb)
                    );
                }
            }
        }

        return $restorable;
    }
498078
public static function handleStream($segments) {

		$page = array_shift($segments);
		$guid = array_shift($segments);

		switch ($page) {

			case 'comments' :

				$comment_guid = array_shift($segments);
				set_input('entity_guid', $guid);
				set_input('comment_guid', $comment_guid);
				echo elgg_view_resource('interactions/comments', [
					'guid' => $guid,
					'comment_guid' => $comment_guid
				]);
				return true;

			case 'likes' :
				set_input('guid', $guid);
				echo elgg_view_resource('interactions/likes', [
					'guid' => $guid,
				]);
				return true;

			case 'edit' :
				set_input('guid', $guid);
				echo elgg_view_resource('interactions/edit', [
					'guid' => $guid,
				]);
				return true;

			case 'view' :
				set_input('guid', $guid);
				echo elgg_view_resource('interactions/view', [
					'guid' => $guid,
				]);
				return true;
		}

		return false;
	}
74912
protected function getSegmentIndex($idx, $segment)
    {
        $segment = $this->splitSegment($segment);
        if (isset($segment[$idx - 1])) {
            return $segment[$idx - 1];
        }

        return null;
    }
1074656
public function parse(&$segments)
    {
        $path = implode('/', $segments);
        $query = array();

        // if (count($segments) && strpos($segments[0], '@') === 0) {
        //    $query['oid'] = str_replace('@', '', array_shift($segments));
        // }

        $query['view'] = array_shift($segments);

        if (preg_match('#server\/\w+#', $path)) {
            array_shift($segments);
            $query['server'] = array_shift($segments);
        }

        if (
              isset($query['server']) &&
              count($segments) &&
              $segments[0] == 'token'
        ) {
            $query['get'] = 'accesstoken';
        }

        return $query;
    }
554908
public function setSegments($segments)
    {
        $this->segments = is_array($segments) ? implode('/', $segments) : $segments;

        return $this;
    }
1278853
public function getCompletedTokenDeletionCodes()
    {
        $select = $this->_getDeletionCodeSelect();
        $select->where('grc_for_surveys = ?', self::APPLY_DO);

        return $this->_translateAndSort($this->db->fetchPairs($select));
    }
936425
protected function parseCustomSegments(array $segments)
    {
        if (\count($segments) >= 2) {
            $group = "{$segments[0]}/{$segments[1]}";

            if ($this->getLoader()->exists($group)) {
                return [null, $group, \implode('.', \array_slice($segments, 2))];
            }
        }

        return $this->parseBasicSegments($segments);
    }
454013
public function getData($segments){
		$data=new \stdClass();
		$this->json=new \stdClass();
		$this->getDataJson($segments, $this->json);

		$data->error=$this->error;
		$data->json=$this->json;
		$this->json->error=$this->error;
		return $data;
		}
1310826
public static function getArchiveTemplateSlugs()
    {
        $archives = get_post_types(array(
            'has_archive' => true
        ), 'names');

        $templates = array();

        foreach ($archives as $archive) {
            $template = \Modularity\Helper\Wp::findCoreTemplates(array(
                'archive-' . $archive
            ));

            if ($template) {
                $templates[] = $template;
            } else {
                $templates[] = 'archive';
            }
        }

        array_unique($templates);
        return $templates;
    }
807592
public function callAggregateAllPlugins($visits, $visitsConverted, $forceArchivingWithoutVisits = false)
    {
        Log::debug("PluginsArchiver::%s: Initializing archiving process for all plugins [visits = %s, visits converted = %s]",
            __FUNCTION__, $visits, $visitsConverted);

        /** @var Logger $performanceLogger */
        $performanceLogger = StaticContainer::get(Logger::class);

        $this->archiveProcessor->setNumberOfVisits($visits, $visitsConverted);

        $archivers = static::getPluginArchivers();

        foreach ($archivers as $pluginName => $archiverClass) {
            // We clean up below all tables created during this function call (and recursive calls)
            $latestUsedTableId = Manager::getInstance()->getMostRecentTableId();

            /** @var Archiver $archiver */
            $archiver = $this->makeNewArchiverObject($archiverClass, $pluginName);

            if (!$archiver->isEnabled()) {
                Log::debug("PluginsArchiver::%s: Skipping archiving for plugin '%s' (disabled).", __FUNCTION__, $pluginName);
                continue;
            }

            if (!$forceArchivingWithoutVisits && !$visits && !$archiver->shouldRunEvenWhenNoVisits()) {
                Log::debug("PluginsArchiver::%s: Skipping archiving for plugin '%s' (no visits).", __FUNCTION__, $pluginName);
                continue;
            }

            if ($this->shouldProcessReportsForPlugin($pluginName)) {

                $this->logAggregator->setQueryOriginHint($pluginName);

                try {
                    $timer = new Timer();
                    if ($this->shouldAggregateFromRawData) {
                        Log::debug("PluginsArchiver::%s: Archiving day reports for plugin '%s'.", __FUNCTION__, $pluginName);

                        $archiver->callAggregateDayReport();
                    } else {
                        Log::debug("PluginsArchiver::%s: Archiving period reports for plugin '%s'.", __FUNCTION__, $pluginName);

                        $archiver->callAggregateMultipleReports();
                    }

                    $this->logAggregator->setQueryOriginHint('');

                    $performanceLogger->logMeasurement('plugin', $pluginName, $this->params, $timer);

                    Log::debug("PluginsArchiver::%s: %s while archiving %s reports for plugin '%s' %s.",
                        __FUNCTION__,
                        $timer->getMemoryLeak(),
                        $this->params->getPeriod()->getLabel(),
                        $pluginName,
                        $this->params->getSegment() ? sprintf("(for segment = '%s')", $this->params->getSegment()->getString()) : ''
                    );
                } catch (Exception $e) {
                    throw new PluginsArchiverException($e->getMessage() . " - in plugin $pluginName", $e->getCode(), $e);
                }
            } else {
                Log::debug("PluginsArchiver::%s: Not archiving reports for plugin '%s'.", __FUNCTION__, $pluginName);
            }

            Manager::getInstance()->deleteAll($latestUsedTableId);
            unset($archiver);
        }
    }
301693
private function getExistingPlugins()
    {
        $pluginsIndexed = [];
        $plugins = $this
            ->pluginRepository
            ->findAll();

        /**
         * @var Plugin $plugin
         */
        foreach ($plugins as $plugin) {
            $pluginNamespace = $plugin->getNamespace();
            $pluginsIndexed[$pluginNamespace] = $plugin;
        }

        return $pluginsIndexed;
    }
67997
protected function buildSegments(array $segments)
    {
        $pattern  = "";
        $patterns = [];
        $wildcardTokens = array_keys($this->wildcards);
        $wildcardRegex  = $this->wildcards;

        foreach ($segments as $n => $segment) {
            if ($segment === "" && $n !== 0) {
                throw new BadRouteException(BadRouteException::EMPTY_OPTIONAL_PARTS);
            }

            $patterns[] = $pattern .= str_replace($wildcardTokens, $wildcardRegex, $segment);
        }

        return $patterns;
    }
1245300
private static function processSegmentForTypedDimensions( $variableSet, $segment )
	{
		$results = array();

		if ( isset( $segment['typedMember'] ) )
		{
			foreach ( $segment['typedMember'] as $typedMember )
			{
				$dimension = $typedMember['dimension'];
				$member = $typedMember['member'];

				$dimensionQName = qname( $dimension, $variableSet->xbrlInstance->getInstanceNamespaces() );
				$memberQName = qname( $member, $variableSet->xbrlInstance->getInstanceNamespaces() );

				$results[ $dimensionQName->clarkNotation() ] = array();
			}
		}

		return $results;
	}