@@ -29,13 +29,13 @@ discard block |
||
29 | 29 | */ |
30 | 30 | protected function configure() |
31 | 31 | { |
32 | - $this->setName( 'aimeos:account'); |
|
33 | - $this->setDescription( 'Creates new (admin) accounts' ); |
|
34 | - $this->addArgument( 'email', InputArgument::REQUIRED, 'E-mail address of the account that should be created' ); |
|
35 | - $this->addArgument( 'site', InputArgument::OPTIONAL, 'Site codes to create accounts for like "default unittest" (none for all)' ); |
|
36 | - $this->addOption( 'password', null, InputOption::VALUE_REQUIRED, 'Optional password for the account (will ask for if not given)' ); |
|
37 | - $this->addOption( 'admin', null, InputOption::VALUE_NONE, 'If account should have administrator privileges' ); |
|
38 | - $this->addOption( 'editor', null, InputOption::VALUE_NONE, 'If account should have limited editor privileges' ); |
|
32 | + $this->setName('aimeos:account'); |
|
33 | + $this->setDescription('Creates new (admin) accounts'); |
|
34 | + $this->addArgument('email', InputArgument::REQUIRED, 'E-mail address of the account that should be created'); |
|
35 | + $this->addArgument('site', InputArgument::OPTIONAL, 'Site codes to create accounts for like "default unittest" (none for all)'); |
|
36 | + $this->addOption('password', null, InputOption::VALUE_REQUIRED, 'Optional password for the account (will ask for if not given)'); |
|
37 | + $this->addOption('admin', null, InputOption::VALUE_NONE, 'If account should have administrator privileges'); |
|
38 | + $this->addOption('editor', null, InputOption::VALUE_NONE, 'If account should have limited editor privileges'); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | |
@@ -45,32 +45,32 @@ discard block |
||
45 | 45 | * @param InputInterface $input Input object |
46 | 46 | * @param OutputInterface $output Output object |
47 | 47 | */ |
48 | - protected function execute( InputInterface $input, OutputInterface $output ) |
|
48 | + protected function execute(InputInterface $input, OutputInterface $output) |
|
49 | 49 | { |
50 | - $code = $input->getArgument( 'email' ); |
|
51 | - if( ( $password = $input->getOption( 'password' ) ) === null ) |
|
50 | + $code = $input->getArgument('email'); |
|
51 | + if (($password = $input->getOption('password')) === null) |
|
52 | 52 | { |
53 | - $helper = $this->getHelper( 'question' ); |
|
54 | - $question = new Question( 'Password' ); |
|
55 | - $question->setHidden( true ); |
|
53 | + $helper = $this->getHelper('question'); |
|
54 | + $question = new Question('Password'); |
|
55 | + $question->setHidden(true); |
|
56 | 56 | |
57 | - $password = $helper->ask( $input, $output, $question ); |
|
57 | + $password = $helper->ask($input, $output, $question); |
|
58 | 58 | } |
59 | 59 | |
60 | - $context = $this->getContainer()->get( 'aimeos_context' )->get( false, 'command' ); |
|
61 | - $context->setEditor( 'aimeos:account' ); |
|
60 | + $context = $this->getContainer()->get('aimeos_context')->get(false, 'command'); |
|
61 | + $context->setEditor('aimeos:account'); |
|
62 | 62 | |
63 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context ); |
|
64 | - $context->setLocale( $localeManager->createItem() ); |
|
63 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context); |
|
64 | + $context->setLocale($localeManager->createItem()); |
|
65 | 65 | |
66 | - $user = $this->createCustomerItem( $context, $code, $password ); |
|
66 | + $user = $this->createCustomerItem($context, $code, $password); |
|
67 | 67 | |
68 | - if( $input->getOption( 'admin' ) ) { |
|
69 | - $this->addGroup( $input, $output, $context, $user, 'admin' ); |
|
68 | + if ($input->getOption('admin')) { |
|
69 | + $this->addGroup($input, $output, $context, $user, 'admin'); |
|
70 | 70 | } |
71 | 71 | |
72 | - if( $input->getOption( 'editor' ) ) { |
|
73 | - $this->addGroup( $input, $output, $context, $user, 'editor' ); |
|
72 | + if ($input->getOption('editor')) { |
|
73 | + $this->addGroup($input, $output, $context, $user, 'editor'); |
|
74 | 74 | } |
75 | 75 | } |
76 | 76 | |
@@ -84,24 +84,24 @@ discard block |
||
84 | 84 | * @param \Aimeos\MShop\Customer\Item\Iface $user Aimeos customer object |
85 | 85 | * @param string $group Unique customer group code |
86 | 86 | */ |
87 | - protected function addGroup( InputInterface $input, OutputInterface $output, |
|
88 | - \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Customer\Item\Iface $user, $group ) |
|
87 | + protected function addGroup(InputInterface $input, OutputInterface $output, |
|
88 | + \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Customer\Item\Iface $user, $group) |
|
89 | 89 | { |
90 | - $output->writeln( sprintf( 'Add "%1$s" group to user "%2$s" for sites', $group, $user->getCode() ) ); |
|
90 | + $output->writeln(sprintf('Add "%1$s" group to user "%2$s" for sites', $group, $user->getCode())); |
|
91 | 91 | |
92 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context ); |
|
92 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context); |
|
93 | 93 | |
94 | - foreach( $this->getSiteItems( $context, $input ) as $siteItem ) |
|
94 | + foreach ($this->getSiteItems($context, $input) as $siteItem) |
|
95 | 95 | { |
96 | - $localeItem = $localeManager->bootstrap( $siteItem->getCode(), '', '', false ); |
|
96 | + $localeItem = $localeManager->bootstrap($siteItem->getCode(), '', '', false); |
|
97 | 97 | |
98 | 98 | $lcontext = clone $context; |
99 | - $lcontext->setLocale( $localeItem ); |
|
99 | + $lcontext->setLocale($localeItem); |
|
100 | 100 | |
101 | - $output->writeln( '- ' . $siteItem->getCode() ); |
|
101 | + $output->writeln('- '.$siteItem->getCode()); |
|
102 | 102 | |
103 | - $groupItem = $this->getGroupItem( $lcontext, $group ); |
|
104 | - $this->addListItem( $lcontext, $user->getId(), $groupItem->getId() ); |
|
103 | + $groupItem = $this->getGroupItem($lcontext, $group); |
|
104 | + $this->addListItem($lcontext, $user->getId(), $groupItem->getId()); |
|
105 | 105 | } |
106 | 106 | } |
107 | 107 | |
@@ -113,31 +113,31 @@ discard block |
||
113 | 113 | * @param string $userid Unique user ID |
114 | 114 | * @param string $groupid Unique group ID |
115 | 115 | */ |
116 | - protected function addListItem( \Aimeos\MShop\Context\Item\Iface $context, $userid, $groupid ) |
|
116 | + protected function addListItem(\Aimeos\MShop\Context\Item\Iface $context, $userid, $groupid) |
|
117 | 117 | { |
118 | - $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager( $context )->getSubmanager( 'lists' ); |
|
119 | - $typeid = $manager->getSubmanager( 'type' )->findItem( 'default', array(), 'customer/group' )->getId(); |
|
118 | + $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager($context)->getSubmanager('lists'); |
|
119 | + $typeid = $manager->getSubmanager('type')->findItem('default', array(), 'customer/group')->getId(); |
|
120 | 120 | |
121 | 121 | $search = $manager->createSearch(); |
122 | 122 | $expr = array( |
123 | - $search->compare( '==', 'customer.lists.parentid', $userid ), |
|
124 | - $search->compare( '==', 'customer.lists.refid', $groupid ), |
|
125 | - $search->compare( '==', 'customer.lists.domain', 'customer/group' ), |
|
126 | - $search->compare( '==', 'customer.lists.typeid', $typeid ), |
|
123 | + $search->compare('==', 'customer.lists.parentid', $userid), |
|
124 | + $search->compare('==', 'customer.lists.refid', $groupid), |
|
125 | + $search->compare('==', 'customer.lists.domain', 'customer/group'), |
|
126 | + $search->compare('==', 'customer.lists.typeid', $typeid), |
|
127 | 127 | ); |
128 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
129 | - $search->setSlice( 0, 1 ); |
|
128 | + $search->setConditions($search->combine('&&', $expr)); |
|
129 | + $search->setSlice(0, 1); |
|
130 | 130 | |
131 | - if( count( $manager->searchItems( $search ) ) === 0 ) |
|
131 | + if (count($manager->searchItems($search)) === 0) |
|
132 | 132 | { |
133 | 133 | $item = $manager->createItem(); |
134 | - $item->setDomain( 'customer/group' ); |
|
135 | - $item->setParentId( $userid ); |
|
136 | - $item->setTypeId( $typeid ); |
|
137 | - $item->setRefId( $groupid ); |
|
138 | - $item->setStatus( 1 ); |
|
134 | + $item->setDomain('customer/group'); |
|
135 | + $item->setParentId($userid); |
|
136 | + $item->setTypeId($typeid); |
|
137 | + $item->setRefId($groupid); |
|
138 | + $item->setStatus(1); |
|
139 | 139 | |
140 | - $manager->saveItem( $item, false ); |
|
140 | + $manager->saveItem($item, false); |
|
141 | 141 | } |
142 | 142 | } |
143 | 143 | |
@@ -152,23 +152,23 @@ discard block |
||
152 | 152 | * @param string $password New user password |
153 | 153 | * @return \Aimeos\MShop\Customer\Item\Iface Aimeos customer item object |
154 | 154 | */ |
155 | - protected function createCustomerItem( \Aimeos\MShop\Context\Item\Iface $context, $email, $password ) |
|
155 | + protected function createCustomerItem(\Aimeos\MShop\Context\Item\Iface $context, $email, $password) |
|
156 | 156 | { |
157 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer' ); |
|
157 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer'); |
|
158 | 158 | |
159 | 159 | try { |
160 | - $item = $manager->findItem( $email ); |
|
161 | - } catch( \Aimeos\MShop\Exception $e ) { |
|
160 | + $item = $manager->findItem($email); |
|
161 | + } catch (\Aimeos\MShop\Exception $e) { |
|
162 | 162 | $item = $manager->createItem(); |
163 | 163 | } |
164 | 164 | |
165 | - $item->setCode( $email ); |
|
166 | - $item->setLabel( $email ); |
|
167 | - $item->getPaymentAddress()->setEmail( $email ); |
|
168 | - $item->setPassword( $password ); |
|
169 | - $item->setStatus( 1 ); |
|
165 | + $item->setCode($email); |
|
166 | + $item->setLabel($email); |
|
167 | + $item->getPaymentAddress()->setEmail($email); |
|
168 | + $item->setPassword($password); |
|
169 | + $item->setStatus(1); |
|
170 | 170 | |
171 | - $manager->saveItem( $item ); |
|
171 | + $manager->saveItem($item); |
|
172 | 172 | |
173 | 173 | return $item; |
174 | 174 | } |
@@ -181,21 +181,21 @@ discard block |
||
181 | 181 | * @param string $code Unique customer group code |
182 | 182 | * @return \Aimeos\MShop\Customer\Item\Group\Iface Aimeos customer group item object |
183 | 183 | */ |
184 | - protected function getGroupItem( \Aimeos\MShop\Context\Item\Iface $context, $code ) |
|
184 | + protected function getGroupItem(\Aimeos\MShop\Context\Item\Iface $context, $code) |
|
185 | 185 | { |
186 | - $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager( $context )->getSubmanager( 'group' ); |
|
186 | + $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager($context)->getSubmanager('group'); |
|
187 | 187 | |
188 | 188 | try |
189 | 189 | { |
190 | - $item = $manager->findItem( $code ); |
|
190 | + $item = $manager->findItem($code); |
|
191 | 191 | } |
192 | - catch( \Aimeos\MShop\Exception $e ) |
|
192 | + catch (\Aimeos\MShop\Exception $e) |
|
193 | 193 | { |
194 | 194 | $item = $manager->createItem(); |
195 | - $item->setLabel( $code ); |
|
196 | - $item->setCode( $code ); |
|
195 | + $item->setLabel($code); |
|
196 | + $item->setCode($code); |
|
197 | 197 | |
198 | - $manager->saveItem( $item ); |
|
198 | + $manager->saveItem($item); |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | return $item; |
@@ -30,18 +30,18 @@ discard block |
||
30 | 30 | * @param string $classname Name of the setup task class |
31 | 31 | * @return boolean True if class is found, false if not |
32 | 32 | */ |
33 | - public static function autoload( $classname ) |
|
33 | + public static function autoload($classname) |
|
34 | 34 | { |
35 | - if( strncmp( $classname, 'Aimeos\\MW\\Setup\\Task\\', 21 ) === 0 ) |
|
35 | + if (strncmp($classname, 'Aimeos\\MW\\Setup\\Task\\', 21) === 0) |
|
36 | 36 | { |
37 | - $fileName = substr( $classname, 21 ) . '.php'; |
|
38 | - $paths = explode( PATH_SEPARATOR, get_include_path() ); |
|
37 | + $fileName = substr($classname, 21).'.php'; |
|
38 | + $paths = explode(PATH_SEPARATOR, get_include_path()); |
|
39 | 39 | |
40 | - foreach( $paths as $path ) |
|
40 | + foreach ($paths as $path) |
|
41 | 41 | { |
42 | - $file = $path . DIRECTORY_SEPARATOR . $fileName; |
|
42 | + $file = $path.DIRECTORY_SEPARATOR.$fileName; |
|
43 | 43 | |
44 | - if( file_exists( $file ) === true && ( include_once $file ) !== false ) { |
|
44 | + if (file_exists($file) === true && (include_once $file) !== false) { |
|
45 | 45 | return true; |
46 | 46 | } |
47 | 47 | } |
@@ -56,13 +56,13 @@ discard block |
||
56 | 56 | */ |
57 | 57 | protected function configure() |
58 | 58 | { |
59 | - $this->setName( 'aimeos:setup'); |
|
60 | - $this->setDescription( 'Initialize or update the Aimeos database tables' ); |
|
61 | - $this->addArgument( 'site', InputArgument::OPTIONAL, 'Site for updating database entries', 'default' ); |
|
62 | - $this->addArgument( 'tplsite', InputArgument::OPTIONAL, 'Template site for creating or updating database entries', 'default' ); |
|
63 | - $this->addOption( 'option', null, InputOption::VALUE_REQUIRED, 'Optional setup configuration, name and value are separated by ":" like "setup/default/demo:1"', array() ); |
|
64 | - $this->addOption( 'action', null, InputOption::VALUE_REQUIRED, 'Action name that should be executed, i.e. "migrate", "rollback", "clean"', 'migrate' ); |
|
65 | - $this->addOption( 'task', null, InputOption::VALUE_REQUIRED, 'Name of the setup task that should be executed', null ); |
|
59 | + $this->setName('aimeos:setup'); |
|
60 | + $this->setDescription('Initialize or update the Aimeos database tables'); |
|
61 | + $this->addArgument('site', InputArgument::OPTIONAL, 'Site for updating database entries', 'default'); |
|
62 | + $this->addArgument('tplsite', InputArgument::OPTIONAL, 'Template site for creating or updating database entries', 'default'); |
|
63 | + $this->addOption('option', null, InputOption::VALUE_REQUIRED, 'Optional setup configuration, name and value are separated by ":" like "setup/default/demo:1"', array()); |
|
64 | + $this->addOption('action', null, InputOption::VALUE_REQUIRED, 'Action name that should be executed, i.e. "migrate", "rollback", "clean"', 'migrate'); |
|
65 | + $this->addOption('task', null, InputOption::VALUE_REQUIRED, 'Name of the setup task that should be executed', null); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | |
@@ -72,51 +72,51 @@ discard block |
||
72 | 72 | * @param InputInterface $input Input object |
73 | 73 | * @param OutputInterface $output Output object |
74 | 74 | */ |
75 | - protected function execute( InputInterface $input, OutputInterface $output ) |
|
75 | + protected function execute(InputInterface $input, OutputInterface $output) |
|
76 | 76 | { |
77 | - $ctx = $this->getContainer()->get( 'aimeos_context' )->get( false, 'command' ); |
|
78 | - $ctx->setEditor( 'aimeos:setup' ); |
|
77 | + $ctx = $this->getContainer()->get('aimeos_context')->get(false, 'command'); |
|
78 | + $ctx->setEditor('aimeos:setup'); |
|
79 | 79 | |
80 | 80 | $config = $ctx->getConfig(); |
81 | - $site = $input->getArgument( 'site' ); |
|
82 | - $tplsite = $input->getArgument( 'tplsite' ); |
|
81 | + $site = $input->getArgument('site'); |
|
82 | + $tplsite = $input->getArgument('tplsite'); |
|
83 | 83 | |
84 | - $config->set( 'setup/site', $site ); |
|
85 | - $dbconfig = $this->getDbConfig( $config ); |
|
86 | - $this->setOptions( $config, $input ); |
|
84 | + $config->set('setup/site', $site); |
|
85 | + $dbconfig = $this->getDbConfig($config); |
|
86 | + $this->setOptions($config, $input); |
|
87 | 87 | |
88 | - $taskPaths = $this->getContainer()->get( 'aimeos' )->get()->getSetupPaths( $tplsite ); |
|
88 | + $taskPaths = $this->getContainer()->get('aimeos')->get()->getSetupPaths($tplsite); |
|
89 | 89 | |
90 | 90 | $includePaths = $taskPaths; |
91 | 91 | $includePaths[] = get_include_path(); |
92 | 92 | |
93 | - if( set_include_path( implode( PATH_SEPARATOR, $includePaths ) ) === false ) { |
|
94 | - throw new \Exception( 'Unable to extend include path' ); |
|
93 | + if (set_include_path(implode(PATH_SEPARATOR, $includePaths)) === false) { |
|
94 | + throw new \Exception('Unable to extend include path'); |
|
95 | 95 | } |
96 | 96 | |
97 | - spl_autoload_register( '\Aimeos\ShopBundle\Command\SetupCommand::autoload', true ); |
|
97 | + spl_autoload_register('\Aimeos\ShopBundle\Command\SetupCommand::autoload', true); |
|
98 | 98 | |
99 | - $manager = new \Aimeos\MW\Setup\Manager\Multiple( $ctx->getDatabaseManager(), $dbconfig, $taskPaths, $ctx ); |
|
99 | + $manager = new \Aimeos\MW\Setup\Manager\Multiple($ctx->getDatabaseManager(), $dbconfig, $taskPaths, $ctx); |
|
100 | 100 | |
101 | - $output->writeln( sprintf( 'Initializing or updating the Aimeos database tables for site <info>%1$s</info>', $site ) ); |
|
101 | + $output->writeln(sprintf('Initializing or updating the Aimeos database tables for site <info>%1$s</info>', $site)); |
|
102 | 102 | |
103 | - if( ( $task = $input->getOption( 'task' ) ) && is_array( $task ) ) { |
|
104 | - $task = reset( $task ); |
|
103 | + if (($task = $input->getOption('task')) && is_array($task)) { |
|
104 | + $task = reset($task); |
|
105 | 105 | } |
106 | 106 | |
107 | - switch( $input->getOption( 'action' ) ) |
|
107 | + switch ($input->getOption('action')) |
|
108 | 108 | { |
109 | 109 | case 'migrate': |
110 | - $manager->migrate( $task ); |
|
110 | + $manager->migrate($task); |
|
111 | 111 | break; |
112 | 112 | case 'rollback': |
113 | - $manager->rollback( $task ); |
|
113 | + $manager->rollback($task); |
|
114 | 114 | break; |
115 | 115 | case 'clean': |
116 | - $manager->clean( $task ); |
|
116 | + $manager->clean($task); |
|
117 | 117 | break; |
118 | 118 | default: |
119 | - throw new \Exception( sprintf( 'Invalid setup action "%1$s"', $input->getOption( 'action' ) ) ); |
|
119 | + throw new \Exception(sprintf('Invalid setup action "%1$s"', $input->getOption('action'))); |
|
120 | 120 | } |
121 | 121 | } |
122 | 122 | |
@@ -127,14 +127,14 @@ discard block |
||
127 | 127 | * @param \Aimeos\MW\Config\Iface $conf Config object |
128 | 128 | * @return array Multi-dimensional associative list of database configuration parameters |
129 | 129 | */ |
130 | - protected function getDbConfig( \Aimeos\MW\Config\Iface $conf ) |
|
130 | + protected function getDbConfig(\Aimeos\MW\Config\Iface $conf) |
|
131 | 131 | { |
132 | - $dbconfig = $conf->get( 'resource', array() ); |
|
132 | + $dbconfig = $conf->get('resource', array()); |
|
133 | 133 | |
134 | - foreach( $dbconfig as $rname => $dbconf ) |
|
134 | + foreach ($dbconfig as $rname => $dbconf) |
|
135 | 135 | { |
136 | - if( strncmp( $rname, 'db', 2 ) !== 0 ) { |
|
137 | - unset( $dbconfig[$rname] ); |
|
136 | + if (strncmp($rname, 'db', 2) !== 0) { |
|
137 | + unset($dbconfig[$rname]); |
|
138 | 138 | } |
139 | 139 | } |
140 | 140 | |
@@ -150,12 +150,12 @@ discard block |
||
150 | 150 | * @param array Associative list of database configurations |
151 | 151 | * @throws \RuntimeException If the format of the options is invalid |
152 | 152 | */ |
153 | - protected function setOptions( \Aimeos\MW\Config\Iface $conf, InputInterface $input ) |
|
153 | + protected function setOptions(\Aimeos\MW\Config\Iface $conf, InputInterface $input) |
|
154 | 154 | { |
155 | - foreach( (array) $input->getOption( 'option' ) as $option ) |
|
155 | + foreach ((array) $input->getOption('option') as $option) |
|
156 | 156 | { |
157 | - list( $name, $value ) = explode( ':', $option ); |
|
158 | - $conf->set( str_replace( '\\', '/', $name ), $value ); |
|
157 | + list($name, $value) = explode(':', $option); |
|
158 | + $conf->set(str_replace('\\', '/', $name), $value); |
|
159 | 159 | } |
160 | 160 | } |
161 | 161 | } |
@@ -29,19 +29,19 @@ discard block |
||
29 | 29 | protected function configure() |
30 | 30 | { |
31 | 31 | $names = ''; |
32 | - $aimeos = new \Aimeos\Bootstrap( array() ); |
|
33 | - $cntlPaths = $aimeos->getCustomPaths( 'controller/jobs' ); |
|
34 | - $controllers = \Aimeos\Controller\Jobs\Factory::getControllers( $this->getBareContext(), $aimeos, $cntlPaths ); |
|
32 | + $aimeos = new \Aimeos\Bootstrap(array()); |
|
33 | + $cntlPaths = $aimeos->getCustomPaths('controller/jobs'); |
|
34 | + $controllers = \Aimeos\Controller\Jobs\Factory::getControllers($this->getBareContext(), $aimeos, $cntlPaths); |
|
35 | 35 | |
36 | - foreach( $controllers as $key => $controller ) { |
|
37 | - $names .= str_pad( $key, 30 ) . $controller->getName() . PHP_EOL; |
|
36 | + foreach ($controllers as $key => $controller) { |
|
37 | + $names .= str_pad($key, 30).$controller->getName().PHP_EOL; |
|
38 | 38 | } |
39 | 39 | |
40 | - $this->setName( 'aimeos:jobs' ); |
|
41 | - $this->setDescription( 'Executes the job controllers' ); |
|
42 | - $this->addArgument( 'jobs', InputArgument::REQUIRED, 'One or more job controller names like "admin/job customer/email/watch"' ); |
|
43 | - $this->addArgument( 'site', InputArgument::OPTIONAL, 'Site codes to execute the jobs for like "default unittest" (none for all)' ); |
|
44 | - $this->setHelp( "Available jobs are:\n" . $names ); |
|
40 | + $this->setName('aimeos:jobs'); |
|
41 | + $this->setDescription('Executes the job controllers'); |
|
42 | + $this->addArgument('jobs', InputArgument::REQUIRED, 'One or more job controller names like "admin/job customer/email/watch"'); |
|
43 | + $this->addArgument('site', InputArgument::OPTIONAL, 'Site codes to execute the jobs for like "default unittest" (none for all)'); |
|
44 | + $this->setHelp("Available jobs are:\n".$names); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | |
@@ -51,26 +51,26 @@ discard block |
||
51 | 51 | * @param InputInterface $input Input object |
52 | 52 | * @param OutputInterface $output Output object |
53 | 53 | */ |
54 | - protected function execute( InputInterface $input, OutputInterface $output ) |
|
54 | + protected function execute(InputInterface $input, OutputInterface $output) |
|
55 | 55 | { |
56 | 56 | $context = $this->getContext(); |
57 | - $aimeos = $this->getContainer()->get( 'aimeos' )->get(); |
|
57 | + $aimeos = $this->getContainer()->get('aimeos')->get(); |
|
58 | 58 | |
59 | - $jobs = explode( ' ', $input->getArgument( 'jobs' ) ); |
|
60 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context ); |
|
59 | + $jobs = explode(' ', $input->getArgument('jobs')); |
|
60 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context); |
|
61 | 61 | |
62 | - foreach( $this->getSiteItems( $context, $input ) as $siteItem ) |
|
62 | + foreach ($this->getSiteItems($context, $input) as $siteItem) |
|
63 | 63 | { |
64 | - $localeItem = $localeManager->bootstrap( $siteItem->getCode(), '', '', false ); |
|
65 | - $localeItem->setLanguageId( null ); |
|
66 | - $localeItem->setCurrencyId( null ); |
|
64 | + $localeItem = $localeManager->bootstrap($siteItem->getCode(), '', '', false); |
|
65 | + $localeItem->setLanguageId(null); |
|
66 | + $localeItem->setCurrencyId(null); |
|
67 | 67 | |
68 | - $context->setLocale( $localeItem ); |
|
68 | + $context->setLocale($localeItem); |
|
69 | 69 | |
70 | - $output->writeln( sprintf( 'Executing the Aimeos jobs for "<info>%s</info>"', $siteItem->getCode() ) ); |
|
70 | + $output->writeln(sprintf('Executing the Aimeos jobs for "<info>%s</info>"', $siteItem->getCode())); |
|
71 | 71 | |
72 | - foreach( $jobs as $jobname ) { |
|
73 | - \Aimeos\Controller\Jobs\Factory::createController( $context, $aimeos, $jobname )->run(); |
|
72 | + foreach ($jobs as $jobname) { |
|
73 | + \Aimeos\Controller\Jobs\Factory::createController($context, $aimeos, $jobname)->run(); |
|
74 | 74 | } |
75 | 75 | } |
76 | 76 | } |
@@ -85,15 +85,15 @@ discard block |
||
85 | 85 | { |
86 | 86 | $ctx = new \Aimeos\MShop\Context\Item\Standard(); |
87 | 87 | |
88 | - $conf = new \Aimeos\MW\Config\PHPArray( array(), array() ); |
|
89 | - $ctx->setConfig( $conf ); |
|
88 | + $conf = new \Aimeos\MW\Config\PHPArray(array(), array()); |
|
89 | + $ctx->setConfig($conf); |
|
90 | 90 | |
91 | - $locale = \Aimeos\MShop\Factory::createManager( $ctx, 'locale' )->createItem(); |
|
92 | - $locale->setLanguageId( 'en' ); |
|
93 | - $ctx->setLocale( $locale ); |
|
91 | + $locale = \Aimeos\MShop\Factory::createManager($ctx, 'locale')->createItem(); |
|
92 | + $locale->setLanguageId('en'); |
|
93 | + $ctx->setLocale($locale); |
|
94 | 94 | |
95 | - $i18n = new \Aimeos\MW\Translation\None( 'en' ); |
|
96 | - $ctx->setI18n( array( 'en' => $i18n ) ); |
|
95 | + $i18n = new \Aimeos\MW\Translation\None('en'); |
|
96 | + $ctx->setI18n(array('en' => $i18n)); |
|
97 | 97 | |
98 | 98 | return $ctx; |
99 | 99 | } |
@@ -108,19 +108,19 @@ discard block |
||
108 | 108 | { |
109 | 109 | $container = $this->getContainer(); |
110 | 110 | $aimeos = $container->get('aimeos')->get(); |
111 | - $context = $container->get( 'aimeos_context' )->get( false, 'command' ); |
|
111 | + $context = $container->get('aimeos_context')->get(false, 'command'); |
|
112 | 112 | |
113 | - $tmplPaths = $aimeos->getCustomPaths( 'controller/jobs/templates' ); |
|
114 | - $tmplPaths = array_merge( $tmplPaths, $aimeos->getCustomPaths( 'client/html/templates' ) ); |
|
115 | - $view = $container->get('aimeos_view')->create( $context, $tmplPaths ); |
|
113 | + $tmplPaths = $aimeos->getCustomPaths('controller/jobs/templates'); |
|
114 | + $tmplPaths = array_merge($tmplPaths, $aimeos->getCustomPaths('client/html/templates')); |
|
115 | + $view = $container->get('aimeos_view')->create($context, $tmplPaths); |
|
116 | 116 | |
117 | - $langManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context )->getSubManager( 'language' ); |
|
118 | - $langids = array_keys( $langManager->searchItems( $langManager->createSearch( true ) ) ); |
|
119 | - $i18n = $this->getContainer()->get( 'aimeos_i18n' )->get( $langids ); |
|
117 | + $langManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context)->getSubManager('language'); |
|
118 | + $langids = array_keys($langManager->searchItems($langManager->createSearch(true))); |
|
119 | + $i18n = $this->getContainer()->get('aimeos_i18n')->get($langids); |
|
120 | 120 | |
121 | - $context->setEditor( 'aimeos:jobs' ); |
|
122 | - $context->setView( $view ); |
|
123 | - $context->setI18n( $i18n ); |
|
121 | + $context->setEditor('aimeos:jobs'); |
|
122 | + $context->setView($view); |
|
123 | + $context->setI18n($i18n); |
|
124 | 124 | |
125 | 125 | return $context; |
126 | 126 | } |
@@ -28,9 +28,9 @@ discard block |
||
28 | 28 | */ |
29 | 29 | protected function configure() |
30 | 30 | { |
31 | - $this->setName( 'aimeos:cache' ); |
|
32 | - $this->setDescription( 'Clears the content cache' ); |
|
33 | - $this->addArgument( 'site', InputArgument::OPTIONAL, 'Site codes to clear the cache like "default unittest" (none for all)' ); |
|
31 | + $this->setName('aimeos:cache'); |
|
32 | + $this->setDescription('Clears the content cache'); |
|
33 | + $this->addArgument('site', InputArgument::OPTIONAL, 'Site codes to clear the cache like "default unittest" (none for all)'); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | |
@@ -40,26 +40,26 @@ discard block |
||
40 | 40 | * @param InputInterface $input Input object |
41 | 41 | * @param OutputInterface $output Output object |
42 | 42 | */ |
43 | - protected function execute( InputInterface $input, OutputInterface $output ) |
|
43 | + protected function execute(InputInterface $input, OutputInterface $output) |
|
44 | 44 | { |
45 | - $context = $this->getContainer()->get( 'aimeos_context' )->get( false, 'command' ); |
|
46 | - $context->setEditor( 'aimeos:cache' ); |
|
45 | + $context = $this->getContainer()->get('aimeos_context')->get(false, 'command'); |
|
46 | + $context->setEditor('aimeos:cache'); |
|
47 | 47 | |
48 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context ); |
|
48 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context); |
|
49 | 49 | |
50 | - foreach( $this->getSiteItems( $context, $input ) as $siteItem ) |
|
50 | + foreach ($this->getSiteItems($context, $input) as $siteItem) |
|
51 | 51 | { |
52 | - $localeItem = $localeManager->bootstrap( $siteItem->getCode(), '', '', false ); |
|
52 | + $localeItem = $localeManager->bootstrap($siteItem->getCode(), '', '', false); |
|
53 | 53 | |
54 | 54 | $lcontext = clone $context; |
55 | - $lcontext->setLocale( $localeItem ); |
|
55 | + $lcontext->setLocale($localeItem); |
|
56 | 56 | |
57 | - $cache = new \Aimeos\MAdmin\Cache\Proxy\Standard( $lcontext ); |
|
58 | - $lcontext->setCache( $cache ); |
|
57 | + $cache = new \Aimeos\MAdmin\Cache\Proxy\Standard($lcontext); |
|
58 | + $lcontext->setCache($cache); |
|
59 | 59 | |
60 | - $output->writeln( sprintf( 'Clearing the Aimeos cache for site <info>%1$s</info>', $siteItem->getCode() ) ); |
|
60 | + $output->writeln(sprintf('Clearing the Aimeos cache for site <info>%1$s</info>', $siteItem->getCode())); |
|
61 | 61 | |
62 | - \Aimeos\MAdmin\Cache\Manager\Factory::createManager( $lcontext )->getCache()->flush(); |
|
62 | + \Aimeos\MAdmin\Cache\Manager\Factory::createManager($lcontext)->getCache()->flush(); |
|
63 | 63 | } |
64 | 64 | } |
65 | 65 | } |
@@ -29,26 +29,26 @@ |
||
29 | 29 | public function getConfigTreeBuilder() |
30 | 30 | { |
31 | 31 | $treeBuilder = new TreeBuilder(); |
32 | - $rootNode = $treeBuilder->root( 'aimeos_shop' ); |
|
32 | + $rootNode = $treeBuilder->root('aimeos_shop'); |
|
33 | 33 | |
34 | 34 | $rootNode |
35 | 35 | ->children() |
36 | - ->booleanNode('disable_sites')->defaultValue( true )->end() |
|
37 | - ->booleanNode('apc_enable')->defaultValue( false )->end() |
|
38 | - ->scalarNode('apc_prefix')->defaultValue( 'sf2:' )->end() |
|
36 | + ->booleanNode('disable_sites')->defaultValue(true)->end() |
|
37 | + ->booleanNode('apc_enable')->defaultValue(false)->end() |
|
38 | + ->scalarNode('apc_prefix')->defaultValue('sf2:')->end() |
|
39 | 39 | ->scalarNode('extdir')->end() |
40 | 40 | ->scalarNode('uploaddir')->end() |
41 | - ->variableNode('admin')->defaultValue( array() )->end() |
|
42 | - ->variableNode('client')->defaultValue( array() )->end() |
|
43 | - ->variableNode('controller')->defaultValue( array() )->end() |
|
44 | - ->variableNode('i18n')->defaultValue( array() )->end() |
|
45 | - ->variableNode('madmin')->defaultValue( array() )->end() |
|
46 | - ->variableNode('mshop')->defaultValue( array() )->end() |
|
47 | - ->variableNode('resource')->defaultValue( array() )->end() |
|
48 | - ->variableNode('page')->defaultValue( array() )->end() |
|
49 | - ->variableNode('backend')->defaultValue( array() )->end() |
|
50 | - ->variableNode('frontend')->defaultValue( array() )->end() |
|
51 | - ->variableNode('command')->defaultValue( array() )->end() |
|
41 | + ->variableNode('admin')->defaultValue(array())->end() |
|
42 | + ->variableNode('client')->defaultValue(array())->end() |
|
43 | + ->variableNode('controller')->defaultValue(array())->end() |
|
44 | + ->variableNode('i18n')->defaultValue(array())->end() |
|
45 | + ->variableNode('madmin')->defaultValue(array())->end() |
|
46 | + ->variableNode('mshop')->defaultValue(array())->end() |
|
47 | + ->variableNode('resource')->defaultValue(array())->end() |
|
48 | + ->variableNode('page')->defaultValue(array())->end() |
|
49 | + ->variableNode('backend')->defaultValue(array())->end() |
|
50 | + ->variableNode('frontend')->defaultValue(array())->end() |
|
51 | + ->variableNode('command')->defaultValue(array())->end() |
|
52 | 52 | ->end() |
53 | 53 | ; |
54 | 54 |