Code Duplication    Length = 11-11 lines in 2 locations

include/onupdate.php 2 locations

@@ 78-88 (lines=11) @@
75
    if ($previousVersion < 111) {
76
        // delete old HTML template files ============================
77
        $templateDirectory = $GLOBALS['xoops']->path('modules/' . $module->getVar('dirname', 'n') . '/templates/');
78
        if (is_dir($templateDirectory)) {
79
            $templateList = array_diff(scandir($templateDirectory), array('..', '.'));
80
            foreach ($templateList as $k => $v) {
81
                $fileInfo = new SplFileInfo($templateDirectory . $v);
82
                if ($fileInfo->getExtension() === 'html' && $fileInfo->getFilename() !== 'index.html') {
83
                    if (file_exists($templateDirectory . $v)) {
84
                        unlink($templateDirectory . $v);
85
                    }
86
                }
87
            }
88
        }
89
        // delete old block html template files ============================
90
        $templateDirectory = $GLOBALS['xoops']->path('modules/' . $module->getVar('dirname', 'n')
91
                                                     . '/templates/blocks/');
@@ 92-102 (lines=11) @@
89
        // delete old block html template files ============================
90
        $templateDirectory = $GLOBALS['xoops']->path('modules/' . $module->getVar('dirname', 'n')
91
                                                     . '/templates/blocks/');
92
        if (is_dir($templateDirectory)) {
93
            $templateList = array_diff(scandir($templateDirectory), array('..', '.'));
94
            foreach ($templateList as $k => $v) {
95
                $fileInfo = new SplFileInfo($templateDirectory . $v);
96
                if ($fileInfo->getExtension() === 'html' && $fileInfo->getFilename() !== 'index.html') {
97
                    if (file_exists($templateDirectory . $v)) {
98
                        unlink($templateDirectory . $v);
99
                    }
100
                }
101
            }
102
        }
103
        //delete old files: ===================
104
        $oldFiles = array(
105
            '/assets/images/logo_module.png',