Uploaded image for project: 'translate5'
  1. translate5
  2. TRANSLATE-5064

problems with TermImport config etc.

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Unresolved
    • None
    • None
    • TermTagger integration

      Problem 1

      According to https://confluence.translate5.net/display/CON/TermImport%3A+SFTP+support it is possible to have a port configured for runtimeOptions.plugins.TermImport.filesystemConfig
      But when I do this with the GUI like this:

      this ends up in an error:

      Array
      (
          [type] => 1
          [message] => Uncaught TypeError: League\Flysystem\PhpseclibV2\SftpConnectionProvider::__construct(): Argument #6 ($port) must be of type int, string given, called in /var/www/translate5/vendor/league/flysystem-sftp/SftpConnectionProvider.php on line 183 and defined in /var/www/translate5/vendor/league/flysystem-sftp/SftpConnectionProvider.php:77
      Stack trace:
      #0 /var/www/translate5/vendor/league/flysystem-sftp/SftpConnectionProvider.php(183): League\Flysystem\PhpseclibV2\SftpConnectionProvider->__construct('www.translate5....', 'sylvi', 'V1au...', NULL, NULL, '4848', false, 10, 4, NULL, NULL)
      #1 /var/www/translate5/application/modules/editor/src/Tools/FlysystemFactory.php(96): League\Flysystem\PhpseclibV2\SftpConnectionProvider::fromArray(Array)
      #2 /var/www/translate5/application/modules/editor/src/Tools/FlysystemFactory.php(65): MittagQI\Translate5\Tools\FlysystemFactory::createSftp(Object(stdClass))
      #3 /var/www/translate5/Translate5/MaintenanceCli/Command/FilesystemExternalCheckCommand.php(156): MittagQI\Translate5\Tools\FlysystemFactory::create('sftp', Object(stdClass))
      #4 /var/www/translate5/Translate5/MaintenanceCli/Command/FilesystemExternalCheckCommand.php(185): Translate5\MaintenanceCli\Command\FilesystemExternalCheckCommand->checkFlySystemConfig('{\n    "username...')
      #5 /var/www/translate5/Translate5/MaintenanceCli/Command/FilesystemExternalCheckCommand.php(118): Translate5\MaintenanceCli\Command\FilesystemExternalCheckCommand->makeTableRow(Object(Symfony\Component\Console\Helper\Table), '-na- (Main Conf...', '{"username":"sy...', 'MittagQI\\Transl...')
      #6 /var/www/translate5/vendor/symfony/console/Command/Command.php(298): Translate5\MaintenanceCli\Command\FilesystemExternalCheckCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
      #7 /var/www/translate5/vendor/symfony/console/Application.php(1040): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
      #8 /var/www/translate5/vendor/symfony/console/Application.php(301): Symfony\Component\Console\Application->doRunCommand(Object(Translate5\MaintenanceCli\Command\FilesystemExternalCheckCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
      #9 /var/www/translate5/vendor/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
      #10 /var/www/translate5/Translate5/maintenance-cli.php(302): Symfony\Component\Console\Application->run()
      #11 {main}
        thrown
          [file] => /var/www/translate5/vendor/league/flysystem-sftp/SftpConnectionProvider.php
          [line] => 77
      )
      

      Reason: Flysystem expects port as an int, but its submitted as String from Translate5 config.

      Btw. This happens for ALL values that should be int. Same for "timeout" etc.

      Solution 1

      General solution would be that JSON-based config should not handle all values as string. In concrete case it may also be OK to convert value of "port" into a (int) before passing it to Flysystem

      Problem 2

      I had configured a certain rootpath to the SFTP directory. It starts with a leading slash like /this/is/my/path
      The test-command:

      t5 filesystem:external:check 
      

      says everything is correct with the configuration of runtimeOptions.plugins.TermImport.filesystemConfig
      BUT
      Terms where not imported. After some investigation I found out the my configured roopath should have been WITHOUT leading slash.

      Solution 2

      I'm not sure if a leading slash in the rootpath is ever needed. If not please simply drop it.
      And, I would have expect that the test t5 filesystem:external:check really tests the config. But test is positiv with or without the leading slash. Seems like under the hood different functions are used and came to different results.
      So please use the same function to test which is also used for real usage.

      Problem 3

      Reindex a termcollection leads to error.
      Concrete:
      using t5 termportal:reindex ends up in the following error:

      t5 term:re
      
      Translate5 termportal: re-index term DB table.
      ==============================================
      
      PHP Fatal error:  Uncaught Error: Call to a member function query() on null in /var/www/translate5/Translate5/MaintenanceCli/Command/TermportalReindexCommand.php:63
      Stack trace:
      #0 /var/www/translate5/vendor/symfony/console/Command/Command.php(298): Translate5\MaintenanceCli\Command\TermportalReindexCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
      #1 /var/www/translate5/vendor/symfony/console/Application.php(1040): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
      #2 /var/www/translate5/vendor/symfony/console/Application.php(301): Symfony\Component\Console\Application->doRunCommand(Object(Translate5\MaintenanceCli\Command\TermportalReindexCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
      #3 /var/www/translate5/vendor/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
      #4 /var/www/translate5/Translate5/maintenance-cli.php(302): Symfony\Component\Console\Application->run()
      #5 {main}
        thrown in /var/www/translate5/Translate5/MaintenanceCli/Command/TermportalReindexCommand.php on line 63
      
      Fatal error: Uncaught Error: Call to a member function query() on null in /var/www/translate5/Translate5/MaintenanceCli/Command/TermportalReindexCommand.php:63
      Stack trace:
      #0 /var/www/translate5/vendor/symfony/console/Command/Command.php(298): Translate5\MaintenanceCli\Command\TermportalReindexCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
      #1 /var/www/translate5/vendor/symfony/console/Application.php(1040): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
      #2 /var/www/translate5/vendor/symfony/console/Application.php(301): Symfony\Component\Console\Application->doRunCommand(Object(Translate5\MaintenanceCli\Command\TermportalReindexCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
      #3 /var/www/translate5/vendor/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
      #4 /var/www/translate5/Translate5/maintenance-cli.php(302): Symfony\Component\Console\Application->run()
      #5 {main}
        thrown in /var/www/translate5/Translate5/MaintenanceCli/Command/TermportalReindexCommand.php on line 63
      

      this may only is the case because I do have an empty TermCollection. Anyway, this error should not happen
      this always happens, no matter if language resource is empty or not.

      Solution 3

      cant say.

            pavelperminov Pavel Perminov
            Stephan Stephan Bergmann
            Leon Kiz
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: