Code Duplication    Length = 12-12 lines in 2 locations

plugins/System/src/Controller/Admin/PluginsController.php 1 location

@@ 68-79 (lines=12) @@
65
                $task = (bool)WebShellDispatcher::run("Installer.plugins install -s \"{$this->request->data['url']}\"{$activate}");
66
            } elseif (isset($this->request->data['file_system'])) {
67
                $task = (bool)WebShellDispatcher::run("Installer.plugins install -s \"{$this->request->data['path']}\"{$activate}");
68
            } else {
69
                $uploader = new PackageUploader($this->request->data['file']);
70
                if ($uploader->upload()) {
71
                    $task = (bool)WebShellDispatcher::run('Installer.plugins install -s "' . $uploader->dst() . '"' . $activate);
72
                } else {
73
                    $uploadError = true;
74
                    $this->Flash->set(__d('system', 'Plugins installed but some errors occur'), [
75
                        'element' => 'System.installer_errors',
76
                        'params' => ['errors' => $uploader->errors(), 'type' => 'warning'],
77
                    ]);
78
                }
79
            }
80
81
            if ($task) {
82
                $this->Flash->success(__d('system', 'Plugins successfully installed!'));

plugins/System/src/Controller/Admin/ThemesController.php 1 location

@@ 91-102 (lines=12) @@
88
                $task = (bool)WebShellDispatcher::run("Installer.plugins install -s \"{$this->request->data['url']}\" --theme -a");
89
            } elseif (isset($this->request->data['file_system'])) {
90
                $task = (bool)WebShellDispatcher::run("Installer.plugins install -s \"{$this->request->data['path']}\" --theme -a");
91
            } else {
92
                $uploader = new PackageUploader($this->request->data['file']);
93
                if ($uploader->upload()) {
94
                    $task = (bool)WebShellDispatcher::run('Installer.plugins install -s "' . $uploader->dst() . '" --theme -a');
95
                } else {
96
                    $uploadError = true;
97
                    $this->Flash->set(__d('system', 'Plugins installed but some errors occur'), [
98
                        'element' => 'System.installer_errors',
99
                        'params' => ['errors' => $uploader->errors(), 'type' => 'warning'],
100
                    ]);
101
                }
102
            }
103
104
            if ($task) {
105
                $this->Flash->success(__d('system', 'Theme successfully installed!'));