Recursive flush all app cache

@param null|Module $current Current Module

@return string execute message
540581
protected function flushCache(Module $current = null)
    {
        $message = '';
        if ($current === null) {
            $current = Yii::$app;
        }
        $modules = $current->getModules();
        foreach ($modules as $moduleName => $module) {
            if (is_array($module)) {
                $module = $current->getModule($moduleName, true);
            }
            if ($module instanceof Module) {
                $message .= $this->flushCache($module);
            }
        }
        $components = $current->getComponents();
        foreach ($components as $componentName => $component) {
            if (is_array($component) && $componentName != 'user') {
                $component = $current->get($componentName);
            }
            if ($component instanceof Cache) {
                $message .= $component->flush() ?
                    '<p>' . Yii::t(
                        'wocenter/app', '{currentModuleName}: {componentName} is flushed.', [
                            'currentModuleName' => $current->className(),
                            'componentName' => $component->className(),
                        ]
                    ) . '</p>' :
                    '';
            }
        }
        
        return $message;
    }
161965
public function flush()
    {
        if (null == $this->buildLogFile) {
            $this->resetLogQueue();

            return;
        }
        $messageElements = array();
        for ($i = count($this->logQueue) - 1; $i >= 0; --$i) {
            $message = $this->logQueue[$i];
            $messageString = '<message priority="'.$message->priority.'" ';
            $messageString .= 'timestamp="'.$message->timestamp.'" ';
            $messageString .= 'time="'.date('Y-m-d H:i:s - T', $message->timestamp).'"><![CDATA[';
            $messageString .= base64_encode($message->message);
            $messageString .= ']]></message>';

            $messageElements[] = $messageString;
        }

        $previousLogMessages = '';

        $dirName = dirname($this->buildLogFile);
        if (!file_exists($dirName)) {
            mkdir($dirName, 0755, true);
        }
        if (file_exists($this->buildLogFile)) {
            // copying to temporary file for later inclusion via fgets, less memory consuming
            copy($this->buildLogFile, $this->buildLogFile.'.temp');
        }
        $fh = fopen($this->buildLogFile, 'w+');
        if (is_resource($fh)) {
            fputs($fh, '<?xml version="1.0"?>');
            fputs($fh, "\n");
            fputs($fh, '<build>');
            fputs($fh, "\n");
            fputs($fh, implode("\n", $messageElements));
            fputs($fh, "\n");
            if (file_exists($this->buildLogFile.'.temp')) {
                $fht = fopen($this->buildLogFile.'.temp', 'r');
                if (is_resource($fht)) {
                    $lineCounter = 0;
                    while ($line = fgets($fht)) {
                        // skip first two lines (xml decl and build opening element
                        if ($lineCounter > 2) {
                            fputs($fh, $line);
                        }
                        ++$lineCounter;
                    }
                    fclose($fht);
                    unlink($this->buildLogFile.'.temp');
                } else {
                    self::error('Cannot include previous log messages');
                }
            } else {
                fputs($fh, '</build>');
            }
            //fputs($fh, $previousLogMessages);
            fclose($fh);
            //file_put_contents($this->buildLogFile, $buildXml);
        } else {
            self::error('Cannot open: '.$this->buildLogFile.' for writing.');
        }
        $this->resetLogQueue();
    }
204682
public static function finalizeTree(Directory $current, $prev = null)
    {
        foreach ($current->getEntries() as $entry) {
            if ($entry instanceof Directory) {
                $prev = Builder::finalizeTree($entry, $prev);
            } elseif ($entry instanceof Content) {
                if ($prev) {
                    $prev->setNext($entry);
                    $entry->setPrevious($prev);
                }

                $prev = $entry;
            }
        }

        return $prev;
    }
399951
public static function flush() {
    if (isset(self::$app_log_group)) {
      $req = new FlushRequest();
      $req->setLogs(self::$app_log_group->serializeToString());
      $resp = new VoidProto();
      ApiProxy::makeSyncCall('logservice', 'Flush', $req, $resp);
      self::$app_log_group->clear();
      self::$last_flush_time = microtime(true);
    }
  }
830364
public function flushCache()
    {
        $adapter = $this->driver->getAdapter();

        if ($adapter instanceof CachedAdapter) {
            $adapter->getCache()->flush();
        }
    }
469351
protected function _fetchCurrent()
    {
        if ($this->_current !== null) {
            return $this->_current;
        }

        return $this->_current = parent::current();
    }
45108
public function flushBuffer()
    {
        $this->expectedBodyLength = null;
        $this->headers = [];
        $this->mode = self::MODE_HEADER;

        $currentBuffer = substr($this->buffer, $this->offset);
        $this->offset = 0;
        $this->bufferSize = 0;
        $this->buffer = '';
        return $currentBuffer;
    }
585409
public function clear(bool $current = false): void
    {
        if ($current) {
            $this->curr->clear();
        }
        $this->next->clear();
    }
642178
protected function getCurrent($key)
    {
        if (isset($this->current[$key])) {
            return $this->current[$key];
        }
        return null;
    }
1004017
public function flush()
    {
        /** @var Cache $cache */
        $cache = $this->app['phraseanet.cache-service'];
        $flushOK = $cache->flushAll() ? 'ok' : 'ko';

        return $this->app->redirectPath('admin_dashboard', ['flush_cache' => $flushOK]);
    }
1000051
public function flush($dir = '')
    {
        $dir = $cache_dir = APP_PATH . '/' . Config::get('cache_dir');
        \ePHP\Misc\Dir::deleteDir($dir);
        mkdir($dir, 0777);
    }
535904
public function current()
    {
        $module = $this->query->getFromBean()->module_name;
        return \BeanFactory::retrieveBean($module, $this->key(), $this->retrieve_params);
    }
1279705
public function current()
    {
        if (is_null($this->current)) {
            $this->current = current($this->branch);
        }
        if ($this->current instanceof RecursiveLeafInterface) {
            return $this->current->current();
        }

        return false;
    }
1062482
public function get($attr,$current=true)
    {
        if (!$this->_data || !array_key_exists($attr, $this->_data)) {
            return null;
        }
        return Connection::convertToEncoding($current ? $this->_data[$attr] : $this->_prev_data[$attr]);
    }
625136
public static function execute($currentRoute)
    {
        $currentRouteParts = explode('/', $currentRoute);

        foreach (self::$routes as $route) {

            // Check if route matches complete URL.
            if ($route['url'] == $currentRoute) {
                return self::callController($route);
            }

            // Exploding route parts for dynamic checking.
            $routeParts = explode('/', $route['url']);

            // If route parts does not match current URL parts, continue.
            if (count($currentRouteParts) !== count($routeParts)) {
                continue;
            }

            $parts = count($routeParts) - 1;
            $valid = true;
            $properties = [];

            foreach ($routeParts as $key => $routePart) {
                $dynamicRoute = false;

                // Current route is not valid, continuing.
                if (! $valid) {
                    continue;
                }

                // Current route part is dynamic, add to array.
                if (substr($routePart, 0, 1) == '{' && substr($routePart, -1, 1) == '}') {
                    $properties[substr($routePart, 1, -1)] = $currentRouteParts[$key];
                    $dynamicRoute = true;
                }

                // If is not dynamic part, and does not match current URL part, make route invalid and continue.
                if (! $dynamicRoute && $routePart != $currentRouteParts[$key]) {
                    $valid = false;
                    continue;
                }

                // Check passed, call controller for current route.
                if ($key == $parts && $valid == true) {
                    return self::callController($route, $properties);
                }
            }
        }

        // No valid route for current route, throw exception.
        throw new RouteNotFoundException($currentRoute);
    }
364916
public function current()
    {
        if ($this->valid() && !isset($this->objects[$this->position])) {
            $class = $this->objectClass;
            $object = new $class();
            $this->hydrator->hydrate($object, $this->currentData);
            $this->classMetadata->getEventManager()->execute(EventManager::EVENT_POST_LOAD, $object);
            if (!$this->readOnly) {
                $this->repository->cacheObject($object);
                $this->documentManager->addObject($object, DocumentManager::OBJ_MANAGED, $this->repository);
            }
            if ($this->rewindable) {
                $this->objects[] = $object;
            } else {
                return $object;
            }
        }

        if (isset($this->objects[$this->position])) {
            return $this->objects[$this->position];
        } else {
            return null;
        }
    }
1369679
public function update($current)
	{
		$this->validate();

		if ($this->files()->isEmpty()) {
			return $this->currentPictures($current);
		}

		$result = $this->mapUpdatedPictures($current);

		if (count($result) == 1 && is_array($result[0])) {
			return $result[0];
		}

		return $result;
	}