Skip to content
Snippets Groups Projects
Select Git revision
  • f4a9db3e58ec774042c702b3d5f5b07143c04510
  • main default protected
  • studip-rector
  • ci-opt
  • course-members-export-as-word
  • data-vue-app
  • pipeline-improvements
  • webpack-optimizations
  • rector
  • icon-renewal
  • http-client-and-factories
  • jsonapi-atomic-operations
  • vueify-messages
  • tic-2341
  • 135-translatable-study-areas
  • extensible-sorm-action-parameters
  • sorm-configuration-trait
  • jsonapi-mvv-routes
  • docblocks-for-magic-methods
19 results

Seminar_Auth.class.php

Blame
  • Forked from Stud.IP / Stud.IP
    Source project has a limited visibility.
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    Dump.php 1.53 KiB
    <?php
    
    namespace Studip\Cli\Commands\Base;
    
    use Config;
    use Symfony\Component\Console\Command\Command;
    use Symfony\Component\Console\Input\InputArgument;
    use Symfony\Component\Console\Input\InputInterface;
    use Symfony\Component\Console\Output\OutputInterface;
    use Symfony\Component\Console\Style\SymfonyStyle;
    
    class Dump extends Command
    {
        protected static $defaultName = 'base:dump';
    
        protected function configure(): void
        {
            $this->setDescription('Dumping Stud.IP directory');
            $this->addArgument('path', InputArgument::REQUIRED, 'path where the backup should be saved');
        }
    
        protected function execute(InputInterface $input, OutputInterface $output): int
        {
            $io = new SymfonyStyle($input, $output);
    
            $dump_dir = realpath($input->getArgument('path'));
            $prefix = Config::get()->STUDIP_INSTALLATION_ID ? Config::get()->STUDIP_INSTALLATION_ID : 'studip';
            $today = date('Ymd');
    
            $base_path = realpath($GLOBALS['STUDIP_BASE_PATH']);
    
            if (!$base_path) {
                $io->error('Stud.IP directory not found!');
                return Command::FAILURE;
            }
    
            $dumb_studip = $dump_dir . '/' . $prefix . '-BASE-' . $today . '.tar.gz';
    
            $io->info('Dumping Stud.IP directory to' . $base_path);
    
            $cmd = "cd $base_path && tar -czf $dumb_studip ." . ' 2>&1';
    
            exec($cmd, $output, $ok);
    
            if ($ok > 0) {
                $io->error(join("\n", array_merge([$cmd], $output)));
                return Command::FAILURE;
            }
            return Command::SUCCESS;
        }
    }