Skip to content

Commit

Permalink
Merge pull request #1118 from nextcloud/occ-register-mime-types
Browse files Browse the repository at this point in the history
Command for registering maps mimetypes
  • Loading branch information
tacruc authored Sep 15, 2023
2 parents 58a8d77 + 0d4a53d commit 9d43104
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
1 change: 1 addition & 0 deletions appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
<commands>
<command>OCA\Maps\Command\RescanPhotos</command>
<command>OCA\Maps\Command\RescanTracks</command>
<command>OCA\Maps\Command\RegisterMimetypes</command>
</commands>
<settings>
<admin>OCA\Maps\Settings\AdminSettings</admin>
Expand Down
56 changes: 56 additions & 0 deletions lib/Command/RegisterMimetypes.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php

/**
* Nextcloud - maps
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Piotr Bator <[email protected]>
* @copyright Piotr Bator 2017
*/

namespace OCA\Maps\Command;

use OCA\Maps\Service\MimetypeService;
use OCP\Encryption\IManager;
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\Input\InputOption;
use OCP\IConfig;

use OCA\Maps\Service\PhotofilesService;

class RegisterMimetypes extends Command {

protected $mimetypeService;

public function __construct(MimetypeService $mimetypeService) {
parent::__construct();
$this->mimetypeService = $mimetypeService;
}

/**
* @return void
*/
protected function configure() {
$this->setName('maps:register-mimetypes')
->setDescription('Registers the maps mimetypes for existing and new files.');
}

/**
* @param InputInterface $input
* @param OutputInterface $output
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output): int {
$this->output = $output;
$output->writeln("Register mimetypes for existing files");
$this->mimetypeService->registerForExistingFiles();
$output->writeln("Register mimetypes for new files");
$this->mimetypeService->registerForNewFiles();
return 0;
}
}

0 comments on commit 9d43104

Please sign in to comment.