/** * @param Schema $schema */ public function down(Schema $schema) { $app = \Eccube\Application::getInstance(); $em = $app['orm.em']; $this->delete_dtb_csv($em); $em->flush(); }
/** * @param Schema $schema */ public function up(Schema $schema) { // this up() migration is auto-generated, please modify it to your needs if (!$schema->hasTable(self::NAME)) { return true; } $app = \Eccube\Application::getInstance(); $em = $app["orm.em"]; $CsvType = new CsvType(); $CsvType->setId(1); $CsvType->setName('商品CSV'); $CsvType->setRank(3); $em->persist($CsvType); $CsvType = new CsvType(); $CsvType->setId(2); $CsvType->setName('会員CSV'); $CsvType->setRank(4); $em->persist($CsvType); $CsvType = new CsvType(); $CsvType->setId(3); $CsvType->setName('受注CSV'); $CsvType->setRank(1); $em->persist($CsvType); $CsvType = new CsvType(); $CsvType->setId(4); $CsvType->setName('配送CSV'); $CsvType->setRank(2); $em->persist($CsvType); $CsvType = new CsvType(); $CsvType->setId(5); $CsvType->setName('カテゴリCSV'); $CsvType->setRank(5); $em->persist($CsvType); $em->flush(); }
public static function getEvents() { $events = array(); // YamlでParseしてがんばる $basePath = __DIR__ . '/../../../app/Plugin'; $finder = Finder::create()->in($basePath)->directories()->depth(0); $app = \Eccube\Application::getInstance(); foreach ($finder as $dir) { $code = $dir->getBaseName(); $path = $dir->getRealPath(); try { $app['eccube.service.plugin']->checkPluginArchiveContent($path); } catch (\Eccube\Exception\PluginException $e) { $app['monolog']->warning("skip {$code} form events loading. config.yml not foud or invalid.", array('path' => $path, 'original-message' => $e->getMessage())); continue; } $config = $app['eccube.service.plugin']->readYml($path . '/config.yml'); if (isset($config['form'])) { foreach ($config['form'] as $event => $class) { $events[$event][] = '\\Plugin\\' . $config['code'] . '\\' . $class; } } } return $events; }
/** * @param Schema $schema */ public function up(Schema $schema) { $app = \Eccube\Application::getInstance(); $PageLayout = $app['eccube.repository.page_layout']->findOneBy(array('url' => 'forgot_reset', 'name' => 'パスワード変更((完了ページ)')); if ($PageLayout) { $PageLayout->setName('パスワード変更(完了ページ)'); $app['orm.em']->flush(); } }
/** * @param Schema $schema */ public function down(Schema $schema) { $app = \Eccube\Application::getInstance(); $em = $app["orm.em"]; $DeliveryDate = $app['eccube.repository.delivery_date']->find(9); if ($DeliveryDate->getValue() === -1) { $DeliveryDate->setValue(0); $em->flush($DeliveryDate); } }
/** * @param Schema $schema */ public function up(Schema $schema) { $app = \Eccube\Application::getInstance(); /** @var EntityManager $em */ $em = $app["orm.em"]; $DeviceType = $app['eccube.repository.master.device_type']->find(10); $PageLayout = new PageLayout(); $PageLayout->setDeviceType($DeviceType)->setName('MYページ/お届け先編集')->setUrl('mypage_delivery_edit')->setFileName('Mypage/delivery_edit')->setEditFlg(2)->setMetaRobots('noindex'); $em->persist($PageLayout); $em->flush(); }
/** * Create recommend table. * * @param Schema $schema * * @return bool */ protected function createCategoryContent(Schema $schema) { if ($schema->hasTable(self::NAME)) { return true; } $app = Application::getInstance(); $em = $app['orm.em']; $classes = array($em->getClassMetadata('Plugin\\CategoryContent\\Entity\\CategoryContent')); $tool = new SchemaTool($em); $tool->createSchema($classes); return true; }
/** * @param Schema $schema */ public function up(Schema $schema) { // this up() migration is auto-generated, please modify it to your needs // pageを追加 $app = \Eccube\Application::getInstance(); $em = $app["orm.em"]; $DeviceType = $app['eccube.repository.master.device_type']->find(10); $PageLayout = new PageLayout(); $PageLayout->setDeviceType($DeviceType); $PageLayout->setName('商品購入/配送方法選択'); $PageLayout->setUrl('shopping_delivery'); $PageLayout->setFileName('Shopping/index'); $PageLayout->setEditFlg(2); $PageLayout->setMetaRobots('noindex'); $em->persist($PageLayout); $PageLayout = new PageLayout(); $PageLayout->setDeviceType($DeviceType); $PageLayout->setName('商品購入/支払方法選択'); $PageLayout->setUrl('shopping_payment'); $PageLayout->setFileName('Shopping/index'); $PageLayout->setEditFlg(2); $PageLayout->setMetaRobots('noindex'); $em->persist($PageLayout); $PageLayout = new PageLayout(); $PageLayout->setDeviceType($DeviceType); $PageLayout->setName('商品購入/お届け先変更'); $PageLayout->setUrl('shopping_shipping_change'); $PageLayout->setFileName('Shopping/index'); $PageLayout->setEditFlg(2); $PageLayout->setMetaRobots('noindex'); $em->persist($PageLayout); $PageLayout = new PageLayout(); $PageLayout->setDeviceType($DeviceType); $PageLayout->setName('商品購入/お届け先変更'); $PageLayout->setUrl('shopping_shipping_edit_change'); $PageLayout->setFileName('Shopping/index'); $PageLayout->setEditFlg(2); $PageLayout->setMetaRobots('noindex'); $em->persist($PageLayout); $PageLayout = new PageLayout(); $PageLayout->setDeviceType($DeviceType); $PageLayout->setName('商品購入/お届け先の複数指定'); $PageLayout->setUrl('shopping_shipping_multiple_change'); $PageLayout->setFileName('Shopping/index'); $PageLayout->setEditFlg(2); $PageLayout->setMetaRobots('noindex'); $em->persist($PageLayout); $em->flush(); }
/** * @param Schema $schema */ public function up(Schema $schema) { // this up() migration is auto-generated, please modify it to your needs // path.ymlの更新 $app = Application::getInstance(); $file = $app['config']['root_dir'] . '/app/config/eccube/path.yml'; $config = Yaml::parse(file_get_contents($file)); if (!array_key_exists('public_path', $config)) { // public_pathが未定義なら作成 $config['public_path'] = '/html'; $config['public_path_realdir'] = $config['root_dir'] . $config['public_path']; $config['plugin_html_realdir'] = $config['root_dir'] . $config['public_path'] . '/plugin'; $config['plugin_urlpath'] = $config['root_urlpath'] . '/plugin'; file_put_contents($file, Yaml::dump($config)); } }
/** * @param Schema $schema */ public function up(Schema $schema) { $app = Application::getInstance(); $repository = $app['orm.em']->getRepository('Eccube\\Entity\\Master\\ProductListOrderBy'); // mtb_product_list_orderbyが初期状態から変更がある場合は、マイグレーションを適用しない $default = array(array('id' => 1, 'name' => '価格順', 'rank' => 0), array('id' => 2, 'name' => '新着順', 'rank' => 1)); $entities = $repository->createQueryBuilder('pl')->orderBy('pl.id', 'ASC')->getQuery()->getArrayResult(); if ($entities !== $default) { return; } // 価格が高い順を追加 $ProductListOrderBy = new ProductListOrderBy(); $ProductListOrderBy->setId(3); $ProductListOrderBy->setName('価格が高い順'); $ProductListOrderBy->setRank(2); $app['orm.em']->persist($ProductListOrderBy); $app['orm.em']->flush($ProductListOrderBy); // "価格順"の名称を"価格が低い順"へ変更 $ProductListOrderBy = $repository->find(1); if (!is_null($ProductListOrderBy) && $ProductListOrderBy->getName() === '価格順') { $ProductListOrderBy->setName('価格が低い順'); $app['orm.em']->persist($ProductListOrderBy); $app['orm.em']->flush($ProductListOrderBy); } // 価格が低い順->価格が高い順->新着順の順にrankを振り直す // 価格が低い順 $entity = $repository->find(1); $entity->setRank(0); $app['orm.em']->flush($entity); // 価格が高い順 $entity = $repository->find(3); $entity->setRank(1); $app['orm.em']->flush($entity); // 新着順 $entity = $repository->find(2); $entity->setRank(2); $app['orm.em']->flush($entity); }
public static function getEvents() { $events = array(); // YamlでParseしてがんばる $basePath = __DIR__ . '/../../../app/Plugin'; $finder = Finder::create()->in($basePath)->directories()->depth(0); $app = \Eccube\Application::getInstance(); foreach ($finder as $dir) { $config = Yaml::parse(file_get_contents($dir->getRealPath() . '/config.yml')); try { $app['eccube.service.plugin']->checkPluginArchiveContent($dir->getRealPath()); } catch (\Eccube\Exception\PluginException $e) { $app['monolog']->warning($e->getMessage()); continue; } $config = $app['eccube.service.plugin']->readYml($dir->getRealPath() . '/config.yml'); if (isset($config['form'])) { foreach ($config['form'] as $event => $class) { $events[$event][] = '\\Plugin\\' . $config['code'] . '\\' . $class; } } } return $events; }
* along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ use Symfony\Component\Debug\Debug; use Symfony\Component\Yaml\Yaml; // This check prevents access to debug front controllers that are deployed by accident to production servers. // Feel free to remove this, extend it, or make something more sophisticated. $allow = array('127.0.0.1', 'fe80::1', '::1'); if (isset($_SERVER['HTTP_CLIENT_IP']) || isset($_SERVER['HTTP_X_FORWARDED_FOR']) || !in_array(@$_SERVER['REMOTE_ADDR'], $allow)) { header('HTTP/1.0 403 Forbidden'); exit('You are not allowed to access this file. Check ' . basename(__FILE__) . ' for more information.'); } require_once __DIR__ . '/../autoload.php'; Debug::enable(); // load configs. $app = \Eccube\Application::getInstance(); // debug enable. $app['debug'] = true; // initialize servicies. $app->initialize(); $app->initializePlugin(); // load config dev $conf = $app['config']; $app['config'] = $app->share(function () use($conf) { $confarray = array(); $config_dev_file = __DIR__ . '/../app/config/eccube/config_dev.yml'; if (file_exists($config_dev_file)) { $config_dev = Yaml::parse(file_get_contents($config_dev_file)); if (isset($config_dev)) { $confarray = array_replace_recursive($confarray, $config_dev); }
function log_debug($message, array $context = array()) { $app = \Eccube\Application::getInstance(); if (isset($app['eccube.logger'])) { $app['eccube.logger']->debug($message, $context); } }
/** * {@inheritdoc} */ public function createApplication() { $app = Application::getInstance(); $app['debug'] = true; $app->initialize(); $app->initPluginEventDispatcher(); $app['session.test'] = true; $app['exception_handler']->disable(); $app['form.csrf_provider'] = $app->share(function () { return new CsrfTokenMock(); }); $app->boot(); return $app; }
/** * @return \Eccube\Application */ function createApplication() { $app = \Eccube\Application::getInstance(); $app['debug'] = true; $app->initDoctrine(); $app->initSecurity(); $app->register(new \Silex\Provider\FormServiceProvider()); $app->register(new \Eccube\ServiceProvider\EccubeServiceProvider()); $app->boot(); return $app; }
exit('You are not allowed to access this file. Check ' . basename(__FILE__) . ' for more information.'); } //[INFO]index.php,install.phpをEC-CUBEルート直下に移動させる場合は、コメントアウトしている行に置き換える require_once __DIR__ . '/../autoload.php'; //require_once __DIR__.'/autoload.php'; Debug::enable(); // see http://silex.sensiolabs.org/doc/web_servers.html#php-5-4 $filename = __DIR__ . preg_replace('#(\\?.*)$#', '', $_SERVER['REQUEST_URI']); if (php_sapi_name() === 'cli-server' && is_file($filename)) { return false; } // output_config_php = true に設定することで、Config Yaml ファイルを元に Config PHP ファイルが出力されます。 // app/config/eccube, src/Eccube/Resource/config 以下に書き込み権限が必要です。 // Config PHP ファイルが存在する場合は、 Config Yaml より優先されます。 // Yaml ファイルをパースする必要が無いため、高速化が期待できます。 $app = \Eccube\Application::getInstance(array('output_config_php' => false)); // debug enable. $app['debug'] = true; // initialize servicies. $app->initialize(); $app->initializePlugin(); // load config dev $conf = $app['config']; $app['config'] = $app->share(function () use($conf) { $confarray = array(); $config_dev_file = __DIR__ . '/../app/config/eccube/config_dev.yml'; if (file_exists($config_dev_file)) { $config_dev = Yaml::parse(file_get_contents($config_dev_file)); if (isset($config_dev)) { $confarray = array_replace_recursive($confarray, $config_dev); }
/** * {@inheritdoc} */ public function createApplication() { $app = Application::getInstance(); $app['debug'] = true; $app->initialize(); $app->initializePlugin(); $app['session.test'] = true; $app['exception_handler']->disable(); $app['form.csrf_provider'] = $app->share(function () { return new CsrfTokenMock(); }); $app->register(new \Eccube\Tests\ServiceProvider\FixtureServiceProvider()); $app->boot(); return $app; }
/** * Create product maker table. * * @param Schema $schema * * @return bool */ protected function createPlgProductMaker(Schema $schema) { if ($schema->hasTable(self::PRODUCTMAKER)) { return true; } $app = Application::getInstance(); $em = $app['orm.em']; $classes = array($em->getClassMetadata('Plugin\\Maker\\Entity\\ProductMaker')); $tool = new SchemaTool($em); $tool->createSchema($classes); return true; }
protected function deletePageLayout() { if (version_compare(\Eccube\Common\Constant::VERSION, '3.0.8', '<=')) { $app = new \Eccube\Application(); $app->initialize(); $app->boot(); } else { $app = \Eccube\Application::getInstance(); } $em = $app['orm.em']; /** @var $repos \Eccube\Repository\PageLayoutRepository */ $repos = $em->getRepository('Eccube\\Entity\\PageLayout'); $DeviceType = $app['eccube.repository.master.device_type']->find(DeviceType::DEVICE_TYPE_PC); $PageLayout = $this->findPageLayout($repos, $DeviceType, 'products_detail_review'); $em->remove($PageLayout); $PageLayout = $this->findPageLayout($repos, $DeviceType, 'products_detail_review_complete'); $em->remove($PageLayout); $PageLayout = $this->findPageLayout($repos, $DeviceType, 'products_detail_review_error'); $em->remove($PageLayout); $em->flush(); }
/** * @param Schema $schema */ public function up(Schema $schema) { // this up() migration is auto-generated, please modify it to your needs // pageを追加 $app = \Eccube\Application::getInstance(); $em = $app["orm.em"]; $DeviceType = $em->getRepository('\\Eccube\\Entity\\Master\\DeviceType')->find(10); $PageLayout = new PageLayout(); $PageLayout->setDeviceType($DeviceType); $PageLayout->setName('商品購入/お届け先の追加'); $PageLayout->setUrl('shopping_shipping_edit'); $PageLayout->setFileName('Shopping/shipping_edit'); $PageLayout->setEditFlg(2); $PageLayout->setMetaRobots('noindex'); $PageLayout->setCreateDate(new \DateTime()); $PageLayout->setUpdateDate(new \DateTime()); $em->persist($PageLayout); $PageLayout = new PageLayout(); $PageLayout->setDeviceType($DeviceType); $PageLayout->setName('商品購入/お届け先の複数指定(お届け先の追加)'); $PageLayout->setUrl('shopping_shipping_multiple_edit'); $PageLayout->setFileName('Shopping/shipping_multiple_edit'); $PageLayout->setEditFlg(2); $PageLayout->setMetaRobots('noindex'); $PageLayout->setCreateDate(new \DateTime()); $PageLayout->setUpdateDate(new \DateTime()); $em->persist($PageLayout); $PageLayout = new PageLayout(); $PageLayout->setDeviceType($DeviceType); $PageLayout->setName('商品購入/購入エラー'); $PageLayout->setUrl('shopping_error'); $PageLayout->setFileName('Shopping/shopping_error'); $PageLayout->setEditFlg(2); $PageLayout->setMetaRobots('noindex'); $PageLayout->setCreateDate(new \DateTime()); $PageLayout->setUpdateDate(new \DateTime()); $em->persist($PageLayout); $PageLayout = new PageLayout(); $PageLayout->setDeviceType($DeviceType); $PageLayout->setName('ご利用ガイド'); $PageLayout->setUrl('help_guide'); $PageLayout->setFileName('Help/guide'); $PageLayout->setEditFlg(2); $PageLayout->setCreateDate(new \DateTime()); $PageLayout->setUpdateDate(new \DateTime()); $em->persist($PageLayout); $PageLayout = new PageLayout(); $PageLayout->setDeviceType($DeviceType); $PageLayout->setName('パスワード再発行(入力ページ)'); $PageLayout->setUrl('forgot'); $PageLayout->setFileName('Forgot/index'); $PageLayout->setEditFlg(2); $PageLayout->setCreateDate(new \DateTime()); $PageLayout->setUpdateDate(new \DateTime()); $em->persist($PageLayout); $PageLayout = new PageLayout(); $PageLayout->setDeviceType($DeviceType); $PageLayout->setName('パスワード再発行(完了ページ)'); $PageLayout->setUrl('forgot_complete'); $PageLayout->setFileName('Forgot/complete'); $PageLayout->setEditFlg(2); $PageLayout->setMetaRobots('noindex'); $PageLayout->setCreateDate(new \DateTime()); $PageLayout->setUpdateDate(new \DateTime()); $em->persist($PageLayout); $PageLayout = new PageLayout(); $PageLayout->setDeviceType($DeviceType); $PageLayout->setName('パスワード変更((完了ページ)'); $PageLayout->setUrl('forgot_reset'); $PageLayout->setFileName('Forgot/reset'); $PageLayout->setEditFlg(2); $PageLayout->setMetaRobots('noindex'); $PageLayout->setCreateDate(new \DateTime()); $PageLayout->setUpdateDate(new \DateTime()); $em->persist($PageLayout); $em->flush(); // 文言、URLの修正 $this->addSql("UPDATE dtb_page_layout SET url = 'help_agreement', file_name = 'Help/agreement' WHERE file_name = 'Entry/kiyaku';"); $this->addSql("UPDATE dtb_page_layout SET url = 'shopping_shipping_multiple', file_name = 'Shopping/shipping_multiple' WHERE file_name = 'Shopping/multiple';"); $this->addSql("UPDATE dtb_page_layout SET page_name = '商品購入' WHERE page_name = '商品購入/ログイン';"); $this->addSql("UPDATE dtb_page_layout SET page_name = 'MYページ/お届け先一覧' WHERE page_name = 'MYページ/お届け先変更';"); $this->addSql("UPDATE dtb_page_layout SET file_name = 'Mypage/delivery_edit' WHERE page_name = 'MYページ/お届け先追加';"); // 不要なレコードを削除 $this->addSql("DELETE from dtb_page_layout WHERE file_name = 'Shopping/payment';"); $this->addSql("DELETE from dtb_page_layout WHERE file_name = 'Shopping/confirm';"); }
/** * {@inheritdoc} */ public function createApplication() { $app = Application::getInstance(); $app['debug'] = true; // ログの内容をERRORレベルでしか出力しないように設定を上書き $app['config'] = $app->share($app->extend('config', function ($config, \Silex\Application $app) { $config['log']['log_level'] = 'ERROR'; $config['log']['action_level'] = 'ERROR'; $config['log']['passthru_level'] = 'ERROR'; $channel = $config['log']['channel']; foreach (array('monolog', 'front', 'admin') as $key) { $channel[$key]['log_level'] = 'ERROR'; $channel[$key]['action_level'] = 'ERROR'; $channel[$key]['passthru_level'] = 'ERROR'; } $config['log']['channel'] = $channel; return $config; })); $app->initLogger(); $app->initialize(); $app->initializePlugin(); $app['session.test'] = true; $app['exception_handler']->disable(); $app['form.csrf_provider'] = $app->share(function () { return new CsrfTokenMock(); }); $app->register(new \Eccube\Tests\ServiceProvider\FixtureServiceProvider()); $app->boot(); return $app; }
/** * インストール済プラグインの一覧を表示する. * プラグインがインストールされていない場合は, マイグレーション実行画面へリダイレクトする. * * @param InstallApplication $app * @param Request $request * * @return \Symfony\Component\HttpFoundation\Response */ public function migration_plugin(InstallApplication $app, Request $request) { $eccube = \Eccube\Application::getInstance(); $eccube->initialize(); $eccube->boot(); $pluginRepository = $eccube['orm.em']->getRepository('Eccube\\Entity\\Plugin'); $Plugins = $pluginRepository->findBy(array('del_flg' => Constant::DISABLED)); if (empty($Plugins)) { // インストール済プラグインがない場合はマイグレーション実行画面へリダイレクト. return $app->redirect($app->url('migration_end')); } else { return $app['twig']->render('migration_plugin.twig', array('Plugins' => $Plugins, 'version' => Constant::VERSION, 'publicPath' => '..' . RELATIVE_PUBLIC_DIR_PATH . '/')); } }