getgrav / grav-plugin-email

Grav Email Plugin
http://getgrav.org
MIT License
37 stars 29 forks source link

Invalid resource theme:// #128

Closed MorphBonehunter closed 4 years ago

MorphBonehunter commented 4 years ago

I've run 2 (very) small websites with grav and today i tried to enable/configure the email plugin in the admin panel on both of the installations. But every time i try to test the Plugin i got the following error (i obfuscate the settings a little bit):

bin/plugin email test-email -t <name>@<domain>.de

Current Configuration:

array:16 [
  "enabled" => true
  "from" => "<name>@<domain>.net"
  "from_name" => null
  "to" => "<name>@<domain>.com"
  "to_name" => null
  "queue" => array:4 [
    "enabled" => false
    "flush_frequency" => "* * * * *"
    "flush_msg_limit" => 10
    "flush_time_limit" => 100
  ]
  "mailer" => array:3 [
    "engine" => "smtp"
    "smtp" => array:5 [
      "server" => "<name>.<domain>.net"
      "port" => 25
      "encryption" => "none"
      "user" => null
      "password" => null
    ]
    "sendmail" => array:1 [
      "bin" => "/usr/sbin/sendmail -bs"
    ]
  ]
  "content_type" => "text/html"
  "debug" => false
  "charset" => null
  "cc" => null
  "cc_name" => null
  "bcc" => null
  "reply_to" => null
  "reply_to_name" => null
  "body" => null
]

In UniformResourceLocator.php line 435:

  Invalid resource theme://  

test-email [-t|--to TO] [-e|--env [ENV]] [-s|--subject [SUBJECT]] [-b|--body [BODY]]

Both sites use the Quark theme and i have no clue what the problem could be.

mahagr commented 4 years ago

Are you using Grav 1.6?

MorphBonehunter commented 4 years ago

Yes, the grav version is 1.6.21, the email plugin version is 3.0.6.

valentin-harrang commented 4 years ago

I have same problem, @MorphBonehunter Have you found a solution?

pawelandrzejewski89 commented 4 years ago

Same issue for Grav 1.6.21 and 'Static site generator' plugin.

It looks like its Grav core problem, and it's not related to any of plugins.

valentin-harrang commented 4 years ago

How can the problem be corrected?

If I go to system/src/Grav/Common/Twig at line 211 and if I edit theme to themes, it works.

'theme_dir'         => $locator->findResource('theme://'),
'theme_url'         => $this->grav['base_url'] . '/' . $locator->findResource('theme://', false),

The problem is theme:// it is written in singular instead of plurial.

rhukster commented 4 years ago

I’ll take a look at this today.

randoum commented 4 years ago

Exact same problem here

pawelandrzejewski89 commented 4 years ago

In case of a different plugin with same error: 'Static site generator' on Grav 1.6.21 there was easy workaround -> downgrade to 1.6.20. In Grav 1.6.21 there's some inconsistency in documentation/vendors.

Can you confirm that downgrade to 1.6.20 also work in this case and its not plugin issue?

randoum commented 4 years ago

Grav 1.6.21 - Email 3.0.6 (tried 3.0.5, same result) Though it works with Grav 1.6.20 (Email 3.0.6)

Backtrace (edited) :

In UniformResourceLocator.php line 435:

  [InvalidArgumentException]  
  Invalid resource theme://   

Exception trace:
 () at /vendor/rockettheme/toolbox/ResourceLocator/src/UniformResourceLocator.php:435
 RocketTheme\Toolbox\ResourceLocator\UniformResourceLocator->find() at /vendor/rockettheme/toolbox/ResourceLocator/src/UniformResourceLocator.php:403
 RocketTheme\Toolbox\ResourceLocator\UniformResourceLocator->findCached() at /vendor/rockettheme/toolbox/ResourceLocator/src/UniformResourceLocator.php:290
 RocketTheme\Toolbox\ResourceLocator\UniformResourceLocator->findResource() at /system/src/Grav/Common/Twig/Twig.php:91
 Grav\Common\Twig\Twig->init() at /user/plugins/email/classes/Utils.php:33
 Grav\Plugin\Email\Utils::sendEmail() at /user/plugins/email/cli/TestEmailCommand.php:91
 Grav\Plugin\Console\TestEmailCommand->serve() at /system/src/Grav/Console/ConsoleCommand.php:41
 Grav\Console\ConsoleCommand->execute() at /vendor/symfony/console/Command/Command.php:255
 Symfony\Component\Console\Command\Command->run() at /vendor/symfony/console/Application.php:917
 Symfony\Component\Console\Application->doRunCommand() at /vendor/symfony/console/Application.php:269
 Symfony\Component\Console\Application->doRun() at /vendor/symfony/console/Application.php:145
 Symfony\Component\Console\Application->run() at /bin/plugin:152
mahagr commented 4 years ago

The issue is caused by this change (see CLI): https://github.com/getgrav/grav/blob/1.7/UPGRADE-1.7.md#cli-1

mahagr commented 4 years ago

Here is the change itself https://github.com/getgrav/grav/commit/48170d2fa01cdeab8d60d0dd6cd563ba9316970b

mahagr commented 4 years ago

So.. Basically the reason why this (and some other plugins) CLI commands broke is because of Grav initialization was broken in older versions and they were initializing theme too early, causing issues which could not be fixed without breaking some of the CLI commands.

MorphBonehunter commented 4 years ago

Confirm that the issue is fixed with 3.0.7: Message sent successfully!