Code Duplication    Length = 26-26 lines in 2 locations

class/oledrion_utils.php 1 location

@@ 374-399 (lines=26) @@
371
    /**
372
     * Remove module's cache
373
     */
374
    public static function updateCache()
375
    {
376
        global $xoopsModule;
377
        $folder  = $xoopsModule->getVar('dirname');
378
        $tpllist = array();
379
        require_once XOOPS_ROOT_PATH . '/class/xoopsblock.php';
380
        require_once XOOPS_ROOT_PATH . '/class/template.php';
381
        $tplfileHandler = xoops_getHandler('tplfile');
382
        $tpllist        = $tplfileHandler->find(null, null, null, $folder);
383
        xoops_template_clear_module_cache($xoopsModule->getVar('mid')); // Clear module's blocks cache
384
385
        foreach ($tpllist as $onetemplate) { // Remove cache for each page.
386
            if ($onetemplate->getVar('tpl_type') === 'module') {
387
                //  Note, I've been testing all the other methods (like the one of Smarty) and none of them run, that's why I have used this code
388
                $files_del = array();
389
                $files_del = glob(XOOPS_CACHE_PATH . '/*' . $onetemplate->getVar('tpl_file') . '*');
390
                if (count($files_del) > 0 && is_array($files_del)) {
391
                    foreach ($files_del as $one_file) {
392
                        if (is_file($one_file)) {
393
                            unlink($one_file);
394
                        }
395
                    }
396
                }
397
            }
398
        }
399
    }
400
401
    /**
402
     * Redirect user with a message

class/utility.php 1 location

@@ 517-542 (lines=26) @@
514
    /**
515
     * Remove module's cache
516
     */
517
    public static function updateCache()
518
    {
519
        global $xoopsModule;
520
        $folder  = $xoopsModule->getVar('dirname');
521
        $tpllist = array();
522
        require_once XOOPS_ROOT_PATH . '/class/xoopsblock.php';
523
        require_once XOOPS_ROOT_PATH . '/class/template.php';
524
        $tplfileHandler = xoops_getHandler('tplfile');
525
        $tpllist        = $tplfileHandler->find(null, null, null, $folder);
526
        xoops_template_clear_module_cache($xoopsModule->getVar('mid')); // Clear module's blocks cache
527
528
        foreach ($tpllist as $onetemplate) { // Remove cache for each page.
529
            if ($onetemplate->getVar('tpl_type') === 'module') {
530
                //  Note, I've been testing all the other methods (like the one of Smarty) and none of them run, that's why I have used this code
531
                $files_del = array();
532
                $files_del = glob(XOOPS_CACHE_PATH . '/*' . $onetemplate->getVar('tpl_file') . '*');
533
                if (count($files_del) > 0 && is_array($files_del)) {
534
                    foreach ($files_del as $one_file) {
535
                        if (is_file($one_file)) {
536
                            unlink($one_file);
537
                        }
538
                    }
539
                }
540
            }
541
        }
542
    }
543
544
    /**
545
     * Redirect user with a message