Code Duplication    Length = 21-21 lines in 2 locations

src/Eccube/Controller/Admin/Content/BlockController.php 1 location

@@ 175-195 (lines=21) @@
172
173
        // ユーザーが作ったブロックのみ削除する
174
        // テンプレートが変更されていた場合、DBからはブロック削除されるがtwigファイルは残る
175
        if ($Block->getDeletableFlg() > 0) {
176
            $tplDir = $app['config']['block_realdir'];
177
            $file = $tplDir . '/' . $Block->getFileName() . '.twig';
178
            $fs = new Filesystem();
179
            if ($fs->exists($file)) {
180
                $fs->remove($file);
181
            }
182
            $app['orm.em']->remove($Block);
183
            $app['orm.em']->flush();
184
185
            $event = new EventArgs(
186
                array(
187
                    'Block' => $Block,
188
                ),
189
                $request
190
            );
191
            $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_CONTENT_BLOCK_DELETE_COMPLETE, $event);
192
193
            $app->addSuccess('admin.delete.complete', 'admin');
194
            \Eccube\Util\Cache::clear($app, false);
195
        }
196
197
198
        return $app->redirect($app->url('admin_content_block'));

src/Eccube/Controller/Admin/Content/PageController.php 1 location

@@ 185-205 (lines=21) @@
182
        }
183
184
        // ユーザーが作ったページのみ削除する
185
        if ($PageLayout->getEditFlg() == PageLayout::EDIT_FLG_USER) {
186
            $templatePath = $app['eccube.repository.page_layout']->getWriteTemplatePath(true);
187
            $file = $templatePath.'/'.$PageLayout->getFileName().'.twig';
188
            $fs = new Filesystem();
189
            if ($fs->exists($file)) {
190
                $fs->remove($file);
191
            }
192
            $app['orm.em']->remove($PageLayout);
193
            $app['orm.em']->flush();
194
195
            $event = new EventArgs(
196
                array(
197
                    'DeviceType' => $DeviceType,
198
                    'PageLayout' => $PageLayout,
199
                ),
200
                $request
201
            );
202
            $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_CONTENT_PAGE_DELETE_COMPLETE, $event);
203
204
            $app->addSuccess('admin.delete.complete', 'admin');
205
        }
206
207
        return $app->redirect($app->url('admin_content_page'));
208
    }