Code Duplication    Length = 8-8 lines in 2 locations

include/onupdate.inc.php 2 locations

@@ 52-59 (lines=8) @@
49
        // delete old html template files
50
        $templateDirectory = $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname', 'n') . '/templates/');
51
        $templateList      = array_diff(scandir($templateDirectory), array('..', '.'));
52
        foreach ($templateList as $k => $v) {
53
            $fileInfo = new SplFileInfo($templateDirectory . $v);
54
            if ($fileInfo->getExtension() === 'html' && $fileInfo->getFilename() !== 'index.html') {
55
                if (file_exists($templateDirectory . $v)) {
56
                    unlink($templateDirectory . $v);
57
                }
58
            }
59
        }
60
        // delete old block html template files
61
        $templateDirectory = $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname', 'n') . '/templates/blocks/');
62
        $templateList      = array_diff(scandir($templateDirectory), array('..', '.'));
@@ 63-70 (lines=8) @@
60
        // delete old block html template files
61
        $templateDirectory = $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname', 'n') . '/templates/blocks/');
62
        $templateList      = array_diff(scandir($templateDirectory), array('..', '.'));
63
        foreach ($templateList as $k => $v) {
64
            $fileInfo = new SplFileInfo($templateDirectory . $v);
65
            if ($fileInfo->getExtension() === 'html' && $fileInfo->getFilename() !== 'index.html') {
66
                if (file_exists($templateDirectory . $v)) {
67
                    unlink($templateDirectory . $v);
68
                }
69
            }
70
        }
71
72
        //delete .html entries from the tpl table
73
        $sql = 'DELETE FROM ' . $xoopsDB->prefix('tplfile') . " WHERE `tpl_module` = '" . $xoopsModule->getVar('dirname', 'n') . "' AND `tpl_file` LIKE '%.html%'";