Skip to content

Commit

Permalink
ready to upload on pkglist
Browse files Browse the repository at this point in the history
  • Loading branch information
frankspress committed Mar 28, 2020
1 parent a7479d3 commit 67494aa
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 298 deletions.
6 changes: 1 addition & 5 deletions src/Controller/ApiParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ public function __construct( EmailHandler $emailHandler, UploadHandler $uploadHa

public function sgParser() {

$milliseconds = round(microtime(true) * 1000);

$newEmail = $this->emailHandler->parseEmail();
$newAttachment = [];

Expand All @@ -54,9 +52,7 @@ public function sgParser() {
$this->eventDispatcher->dispatch( $event,SgParserEvents::PARSER_API );
}

$milliseconds2 = round(microtime(true) * 1000);
// file_put_contents(__DIR__."/timeee.txt", 'time init:'. $milliseconds.' time done:'.$milliseconds2 );
return new JsonResponse(['success'], 200);
return new JsonResponse([], 200);
}


Expand Down
24 changes: 0 additions & 24 deletions src/Controller/request.log

This file was deleted.

236 changes: 0 additions & 236 deletions src/Controller/request2.log

This file was deleted.

12 changes: 8 additions & 4 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,21 @@ public function getConfigTreeBuilder()

$rootNode
->children()

->arrayNode('email')
->addDefaultsIfNotSet()
->children()
->integerNode('max_body_length')->defaultValue(3000)->info('Int, max body length allowed')->end()
->booleanNode('raw_response')->defaultValue(true)->info('Returns only the actual email or direct response')->end()
->booleanNode('raw_subject')->defaultValue(true)->info('Strips RE: from email subject')->end()
->booleanNode('raw_response')->defaultFalse()->info('Returns only the actual email or direct response')->end()
->booleanNode('raw_subject')->defaultFalse()->info('Strips RE: from email subject')->end()
->end()
->end()

->arrayNode('attachment')
->addDefaultsIfNotSet()
->children()
->booleanNode('handle_attachment')->defaultTrue()->info('Bool, Attachment download is disabled by default')->end()
->scalarNode('file_upload_size')->defaultValue('3M')->info('string, Upload size, 1M, 5M etc., see Symfony File Validator for more info')->end()
->booleanNode('handle_attachment')->defaultFalse()->info('Bool, Attachment download is disabled by default')->end()
->scalarNode('file_upload_size')->cannotBeEmpty()->defaultValue('3M')->info('string, Upload size, 1M, 5M etc., see Symfony File Validator for more info')->end()
->booleanNode('php_injection')->defaultFalse()->info('Bool, Checks for malicious php code')->end()
->arrayNode('mime_types')
->scalarPrototype()->end()
Expand Down
5 changes: 1 addition & 4 deletions src/DependencyInjection/FrankspressSgParserExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public function load(array $configs, ContainerBuilder $container)
$loader->load('services.xml');

$configuration = $this->getConfiguration($configs, $container);

$config = $this->processConfiguration($configuration, $configs);

$definition = $container->getDefinition('sg_parser_bundle.api_parser');
Expand All @@ -41,10 +42,6 @@ public function load(array $configs, ContainerBuilder $container)
$definition->setArgument(3, $config['email']['raw_response']);
$definition->setArgument(4, $config['email']['raw_subject']);

// It's a reference to a service @
//// $definition->setArgument(0, new Reference($config['word_provider']));
// $container->setAlias('frank_bundle.frank_word_provider', $config['word_provider']);


}
}
23 changes: 0 additions & 23 deletions src/Handler/UploadHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,29 +72,6 @@ private function fileValidator(File $file = null )

public function addAttachment() {


// $attachmentContainer = [];
// $attachmentList = json_decode( $this->request->getCurrentRequest()->get('attachment-info') );
//
// $file = $this->request->getCurrentRequest()->files->get('img');
//
// /** @var File $file */
//
// $attachment = new NewAttachment();
// $attachment->setFileName( pathinfo($file->getFilename(), PATHINFO_FILENAME) . '.' . $file->guessExtension() );
// $attachment->setType( $file->guessExtension() );
// $attachment->setFilePath( $file->getPathname() );
// $attachment->setSize( $file->getSize() );
//
//
// if ( ! $this->fileValidator($file) || ! $this->phpInjectionCheck($file) ) {
// $attachment->setError( $this->violationMessage );
// }
//
// $attachmentContainer [] = $attachment;
//
// return $attachmentContainer;

$attachmentContainer = [];
$attachmentList = json_decode( $this->request->getCurrentRequest()->get('attachment-info'));

Expand Down
1 change: 1 addition & 0 deletions src/Resources/config/routes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@

<route id="sg_api_parser" controller="sg_parser_bundle.api_parser:sgparser" path="/" >
</route>

</routes>
2 changes: 0 additions & 2 deletions src/Resources/config/services.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,5 @@
<argument type="service" id="event_dispatcher" on-invalid="null"/>
</service>



</services>
</container>

0 comments on commit 67494aa

Please sign in to comment.