Avoid Theme Compilation during module activation in Shopware 6 - shopware

We are activating a couple of modules using a series of commands like this:
php bin/console plugin:install -a 'Modulenamea'
php bin/console plugin:update 'Modulenamea'
php bin/console plugin:install -a 'Modulenameb'
php bin/console plugin:update 'Modulenameb'
this seems to rebuild the theme each time.
We do a final bin/build-storefront.sh anyways, so a lot of time is wasted here.
Is there a way to activate the plugins without building the theme?

TLDR; you should be able to pass the --skip-asset-build option in these commands:
plugin:install
plugin:uninstall
plugin:activate
plugin:deactivate
plugin:update
Looking at the code, it looks promising:
if ($input->getOption('skip-asset-build')) {
$context->addState(PluginLifecycleService::STATE_SKIP_ASSET_BUILDING);
}
Then I can track it to the "activate" part of your install command install -a:
public function pluginActivate(PluginPreActivateEvent $event): void
{
if ($this->skipCompile($event->getContext()->getContext())) {
return;
}
...
$this->themeLifecycleHandler->handleThemeInstallOrUpdate(
$storefrontPluginConfig,
$configurationCollection,
$event->getContext()->getContext()
);
...
}
...
private function skipCompile(Context $context): bool
{
return $context->hasState(Plugin\PluginLifecycleService::STATE_SKIP_ASSET_BUILDING);
}

Related

Ignore flake8 warning in SublimeLinter

I have installed SublimeLinter-flake8. I would like to exclude the W191 warning when I am using SublimeLinter with flake8. I have checked the SublimeLinter docs and tried adding "--ignore W191" to my user settings file and reloaded plugins but I still get warned about the usage of tabs.
The following is my Packages/User/SublimeLinter.sublime-settings file.
// SublimeLinter Settings - User
{
"linters": {
"linter_name" : {
"args" : "--ignore W191"
}
}
}
I checked this answer on StackOverflow but I would like it to be applied from the settings file.
The linter_name has to be the specific plugin you're looking to configure (in this case flake8) -- try this:
{
"linters": {
"flake8" : {
"args" : "--ignore W191"
}
}
}
though realistically, it is probably better to configure your flake8 settings in flake8's configuration such that contributors to your project can work on your project without your specific sublimetext settings. I believe sublimetext's invocation of flake8 should be compatible with those configurations if I'm reading their code correctly
disclaimer: though I'm not sure it's super relevant here, I currently maintain flake8

What is the proper syntax for using subcontrollers with Ufront?

In my main controller I followed the instructions in the Controller documentation and I have the following meta data:
#:route(GET, "/about/*")
var aboutController:AboutController;
Then in my AboutController file I have:
package controller;
import api.TestApi;
import api.PortfolioItem;
using ufront.MVC;
using ufront.web.result.AddClientActionResult;
class AboutController extends Controller
{
#:route(GET, "/graphicDesign")
public function graphicDesign()
{
// return new PartialViewResult({… etcetera
}
}
When I visit the /about/graphicDesign path in my browser, the PHP server generates an error:
PHP Fatal error: Call to a member function execute() on null in /Users/allan/Documents/Freelance/Confidant/Website/3d confidant site/ufront/www/lib/controller/HomeController.class.php on line 70
The PHP lines 69-71 have:
public function execute_aboutController() {
return $this->context->injector->_instantiate(_hx_qtype("controller.AboutController"))->execute();
}
So, do I need different syntax so that the controller instantiates properly?
fyi i upgraded to 3.4 i don't have the same issues.
yes remoting does not work but only when targeting php7 . in fact even when not targeting php7 and running in a php7 apache environment doesn't work either. also in works with Mamp & php 5.6.
i had no probs with sub controllers though.
my answer is . did you try on another php environment ?

Yii 2 Running a Cron in the basic template

I have seen instructions on running a cron in the advanced template, but cant figure out how to do it on the basic template. I have the following controller in the basic controllers folder.
<?php
namespace app\controllers;
use yii\console\Controller;
/**
* Cron controller
*/
class CronController extends Controller {
public function actionIndex() {
echo "cron service runnning";
}
public function actionMail($to) {
echo "Sending mail to " . $to;
}
}
I have navigated to the root of my application and tried all these comands
yii cron
php yii cron
Im getting unknown comand "cron"
I know this is an old question but failed to find anyone with an actual answer to this.
If you look at the code for the Yii exec file you'll notice it requires /common/config/aliases.php file as well as console/config/main.php. You can naturally change these or copy over these from the advanced template.
Hope that solves the problem for anyone wanting to do the same thing.

How can I write a Gruntfile with different shell command behaviour for OS X vs. Linux?

I have a Gruntfile which I intend to use on both OS X and Linux (Ubuntu, to be precise). I have some logic wrapped up inside a grunt-shell task:
shell: {
somejob_linux: {
command: [
'firstlinuxcommand',
'secondlinuxcommand'
]
},
somejob_osx: {
command: [
'firstosxcommand',
'secondosxcommand'
]
}
}
I'd like to have the first target (somejob_linux) executed if the Gruntfile is being run on Linux, and somejob_osx for OS X.
Is there an elegant way for me to achieve this? Or is there another alternative for having different commands or Grunt task/targets run for each platform? I'd prefer to keep everything within the Gruntfile, rather than calling out to external scripts simply for this purpose.
I don't know of a way to do this in only config, but you could create a custom task to check the environment and then add the appropriate task to the queue:
grunt.registerTask('detectthenrun', 'Detect the environment, then run a task', function() {
if (/linux/.test(process.platform)) {
grunt.task.run( 'somejob_linux' );
} else if (/darwin/.test(process.platform)) {
grunt.task.run( 'somejob_osx' );
}
});

Which is the environment variable for Mono/C# library DLLs?

I'm running the frozen Debian 7.0 Testing/Wheezy.
Here is my C# sample code:
using System.Windows.Forms;
using System.Drawing;
public class Simple : Form
{
public Simple()
{
Text = "Simple";
Size = new Size(250, 200);
CenterToScreen();
}
static public void Main()
{
Application.Run(new Simple());
}
}
I got the above C# WinForms code sample working in Monodevelop by using the System.Drawing and System.Windows.Forms references as well as in the command line when compiling with the following command:
mcs /tmp/Simple.cs -r:/usr/lib/mono/4.0/System.Windows.Forms.dll \
-r:/usr/lib/mono/4.0/System.Drawing.dll
I'm trying to make the mcs command work without needing to use the -r switch/parameter (which, by the way, I cannot find information on by looking through man mcs - I basically found this switch/parameter on some random website and it worked).
To check if it worked temporarily, I issued
export PATH=$PATH:/usr/lib/mono/4.0/System.Windows.Forms.dll:/usr/lib/mono/4.0/System.Drawing.dll
prior to issuing mcs /tmp/Simple.cs, which failed with the errors within the following output:
deniz#debian:~$ cd /tmp
deniz#debian:/tmp$ export PATH=$PATH:/usr/lib/mono/4.0/System.Windows.Forms.dll:/usr/lib/mono/4.0/System.Drawing.dll
deniz#debian:/tmp$ mcs Simple.cs
Simple.cs(1,14): error CS0234: The type or namespace name `Windows' does not exist in the namespace `System'. Are you missing an assembly reference?
Simple.cs(2,14): error CS0234: The type or namespace name `Drawing' does not exist in the namespace `System'. Are you missing an assembly reference?
Compilation failed: 2 error(s), 0 warnings
deniz#debian:/tmp$
The above output tells me that the mcs compiler/utility is not seeing the dll files but I don't know what else to try.
Any help in getting the WinForms and Drawing libraries to be automatically “looked at” would be greatly appreciated!
I'm trying to make the mcs command work without needing to use the -r switch/parameter
This is not possible, mcs will not look for libraries unless you tell it to look for them (which is done with -r:...).

Resources