Code Duplication    Length = 3-4 lines in 6 locations

main/inc/lib/api.lib.php 2 locations

@@ 4539-4541 (lines=3) @@
4536
    // Simple delete for a file.
4537
    if (is_file($dirname) || is_link($dirname)) {
4538
        $res = unlink($dirname);
4539
        if ($res === false) {
4540
            error_log(__FILE__.' line '.__LINE__.': '.((bool)ini_get('track_errors') ? $php_errormsg : 'Error not recorded because track_errors is off in your php.ini'), 0);
4541
        }
4542
        return $res;
4543
    }
4544
@@ 4576-4578 (lines=3) @@
4573
4574
    if ($delete_only_content_in_folder == false) {
4575
        $res = rmdir($dirname);
4576
        if ($res === false) {
4577
            error_log(__FILE__.' line '.__LINE__.': '.((bool)ini_get('track_errors') ? $php_errormsg : 'error not recorded because track_errors is off in your php.ini'), 0);
4578
        }
4579
    }
4580
    return $res;
4581
}

src/Chamilo/CourseBundle/Component/CourseCopy/CourseArchiver.php 4 locations

@@ 85-88 (lines=4) @@
82
83
        $php_errormsg = '';
84
        $res = @mkdir($backup_dir, $perm_dirs);
85
        if ($res === false) {
86
            //TODO set and handle an error message telling the user to review the permissions on the archive directory
87
            error_log(__FILE__ . ' line ' . __LINE__ . ': ' . (ini_get('track_errors') != false ? $php_errormsg : 'error not recorded because track_errors is off in your php.ini') . ' - This error, occuring because your archive directory will not let this script write data into it, will prevent courses backups to be created', 0);
88
        }
89
        // Write the course-object to the file
90
        $fp = @fopen($course_info_file, 'w');
91
        if ($fp === false) {
@@ 91-93 (lines=3) @@
88
        }
89
        // Write the course-object to the file
90
        $fp = @fopen($course_info_file, 'w');
91
        if ($fp === false) {
92
            error_log(__FILE__ . ' line ' . __LINE__ . ': ' . (ini_get('track_errors') != false ? $php_errormsg : 'error not recorded because track_errors is off in your php.ini'), 0);
93
        }
94
95
        $res = @fwrite($fp, base64_encode(serialize($course)));
96
        if ($res === false) {
@@ 96-98 (lines=3) @@
93
        }
94
95
        $res = @fwrite($fp, base64_encode(serialize($course)));
96
        if ($res === false) {
97
            error_log(__FILE__ . ' line ' . __LINE__ . ': ' . (ini_get('track_errors') != false ? $php_errormsg : 'error not recorded because track_errors is off in your php.ini'), 0);
98
        }
99
100
        $res = @fclose($fp);
101
        if ($res === false) {
@@ 101-103 (lines=3) @@
98
        }
99
100
        $res = @fclose($fp);
101
        if ($res === false) {
102
            error_log(__FILE__ . ' line ' . __LINE__ . ': ' . (ini_get('track_errors') != false ? $php_errormsg : 'error not recorded because track_errors is off in your php.ini'), 0);
103
        }
104
105
        // Copy all documents to the temp-dir
106
        if (isset($course->resources[RESOURCE_DOCUMENT]) && is_array($course->resources[RESOURCE_DOCUMENT])) {