hidden(); fail('shop:runMigration', 'shop:runMigration:failed'); desc('execute OXID Doctrine migrations'); task('shop:executeMigrations', function () { if (test("[ -f {{current_path}}/vendor/bin/oe-eshop-doctrine_migration ]")) { run('{{bin/php}} {{current_path}}/vendor/bin/oe-eshop-doctrine_migration migrations:migrate'); } })->hidden();; desc('set shops online'); task('shop:setShopsOnline', function() { if (has('bin/mysql') && strlen(get('bin/mysql')) && has('db_name') && strlen(get('db_name')) && has('db_conf_path') && strlen(get('db_conf_path')) && test("[ -f {{db_conf_path}} ]") ) { $query = "UPDATE oxshops SET oxactive = '1', OXREGISTERSUBJECT = SUBSTR(OXREGISTERSUBJECT, 3) WHERE oxactive = '0' AND OXREGISTERSUBJECT LIKE '..%';"; run('{{bin/mysql}} --defaults-extra-file={{db_conf_path}} {{db_name}} -e "'.$query.'"'); } else { info('missing config, task skipped'); } }); desc('create database coniguration file'); task('setup:createDbConfig', function () { try { if (!has('db_conf_path') || !strlen(get('db_conf_path'))) { throw new \RuntimeException('missing db_conf_path option, task stopped'); } if (!test('[ -d $(dirname "{{db_conf_path}}") ]')) { throw new \RuntimeException('configured path {{db_conf_path}} missing, task stopped'); } if (!test("[ -f {{db_conf_path}} ]")) { run("touch {{db_conf_path}}"); } if (test("[ -f {{db_conf_path}} ]")) { $db_host = ask('database host', 'localhost'); $db_port = ask('database port', '3306'); $db_user = ask('database user'); $db_pass = askHiddenResponse('database password'); run('printf "[mysql]\nuser='.$db_user.'\npassword=\"'.$db_pass.'\"\nhost='.$db_host.'\nport='.$db_port.'\n\n[mysqldump]\nuser='.$db_user.'\npassword=\"'.$db_pass.'\"\nhost='.$db_host.'\nport='.$db_port.'" > {{db_conf_path}}'); info('config successful created'); } else { throw new \RuntimeException('can not create {{db_conf_path}}, task stopped'); } } catch(\RuntimeException $e) { warning($e->getMessage()); } }); desc('show OXID shop version'); task('shop:getVersion', function () { if (test("[ -f {{current_path}}/composer.lock ]")) { cd('{{current_path}}'); info( run( '{{bin/composer}} show oxid-esales/oxideshop-ce | grep -ws "versions" | cut -d " " -f 4' ) ); } });