New site creating commands works in terminal but not from shell_exec() PHP command
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
New site creating commands works in terminal but not from shell_exec() PHP command
New site creating commands works in terminal but not from shell_exec() PHP command
command*
$output = shell_exec("cd .. && php artisan aimeos:setup $companyName ");
PHP version 7.3.1
laravel 7
OS - windows
command*
$output = shell_exec("cd .. && php artisan aimeos:setup $companyName ");
PHP version 7.3.1
laravel 7
OS - windows
Re: New site creating commands works in terminal but not from shell_exec() PHP command
You can use the code for the database setup directly instead of using shell_exec():
https://github.com/aimeos/aimeos-larave ... hp#L60-L72
https://github.com/aimeos/aimeos-larave ... hp#L60-L72
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
Re: New site creating commands works in terminal but not from shell_exec() PHP command
can you mention the code example for that create a new site with the default attributes under the above situation
Re: New site creating commands works in terminal but not from shell_exec() PHP command
Code: Select all
$site = '<your new site code>';
$ctx = $this->getLaravel()->make( 'aimeos.context' )->get( false, 'command' );
$config = $ctx->getConfig()->set( 'setup/site', $site );
$dbconfig = $conf->get( 'resource', [] );
foreach( $dbconfig as $rname => $dbconf )
{
if( strncmp( $rname, 'db', 2 ) !== 0 ) {
unset( $dbconfig[$rname] );
} else {
$conf->set( 'resource/' . $rname . '/limit', 5 );
}
}
$taskPaths = $this->getLaravel()->make( 'aimeos' )->get()->getSetupPaths( 'default' );
$manager = new \Aimeos\MW\Setup\Manager\Multiple( $ctx->getDatabaseManager(), $dbconfig, $taskPaths, $ctx );
$manager->migrate( $task );
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
Re: New site creating commands works in terminal but not from shell_exec() PHP command
Code: Select all
$site = $this->argument( 'site' );
$ctx = $this->getLaravel()->make( 'aimeos.context' )->get( false, 'command' );
$config = $ctx->getConfig()->set( 'setup/site', $site );
$dbconfig = $conf->get( 'resource', [] );
foreach( $dbconfig as $rname => $dbconf )
{
if( strncmp( $rname, 'db', 2 ) !== 0 ) {
unset( $dbconfig[$rname] );
} else {
$conf->set( 'resource/' . $rname . '/limit', 5 );
}
}
$taskPaths = $this->getLaravel()->make( 'aimeos' )->get()->getSetupPaths( 'default' );
$manager = new \Aimeos\MW\Setup\Manager\Multiple( $ctx->getDatabaseManager(), $dbconfig, $taskPaths, $ctx );
$manager->migrate( $task );
Last edited by dinindu98 on 05 Jan 2021, 05:08, edited 1 time in total.
Re: New site creating commands works in terminal but not from shell_exec() PHP command
What do you mean? What are "attributes of the default site"?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
Re: New site creating commands works in terminal but not from shell_exec() PHP command
In the admin panel, there is tab called types in that tab contain the attribute, catalog lists, media, plugins, and lot more... and each table contain their own attributes [ex:- Domain:media, code:default, label:Standard].
php artisan aimeos:setup <new site code>
when I create a new site using this command, the new site is generated with those attributes which are in the default site that I mentioned above. but I want to generate a new site with those attributes in a single button click. to achieve that goal I tried running this shell command
$output = shell_exec("cd .. && php artisan aimeos:setup $companyName ");
hopefully, the site is generated with attributes but it didn't work and shows error 404 not found.
I don't know the easiest way to achieve this.
php artisan aimeos:setup <new site code>
when I create a new site using this command, the new site is generated with those attributes which are in the default site that I mentioned above. but I want to generate a new site with those attributes in a single button click. to achieve that goal I tried running this shell command
$output = shell_exec("cd .. && php artisan aimeos:setup $companyName ");
hopefully, the site is generated with attributes but it didn't work and shows error 404 not found.
I don't know the easiest way to achieve this.
Re: New site creating commands works in terminal but not from shell_exec() PHP command
It should work because of this line:
It uses the setup tasks for "default" which also creates the types.
The latest Aimeos distribution includes seller registration out of the box and you can use this code as reference:
https://github.com/aimeos/aimeos/blob/m ... er.php#L75
Code: Select all
$taskPaths = $this->getLaravel()->make( 'aimeos' )->get()->getSetupPaths( 'default' );
The latest Aimeos distribution includes seller registration out of the box and you can use this code as reference:
https://github.com/aimeos/aimeos/blob/m ... er.php#L75
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star