Backups\Controller\Backups::index PHP Метод

index() публичный Метод

public index ( )
    public function index()
    {
        $backups = [];
        foreach ($this->app->helper("fs")->ls('*.zip', '#backups:') as $file) {
            if (!$file->isFile()) {
                continue;
            }
            if ($file->getExtension() != 'zip') {
                continue;
            }
            $basename = $file->getBasename('.zip');
            $parts = explode('.', $basename);
            $timestamp = $parts[0];
            array_splice($parts, 0, 1);
            $backups[] = ["timestamp" => $timestamp, "info" => implode('.', $parts), "file" => $basename, "size" => $this->app->helper("utils")->formatSize($file->getSize())];
        }
        if (count($backups)) {
            $backups = array_reverse($backups);
        }
        return $this->render('backups:views/index.php', compact('backups'));
    }