Issues (1796)

main/install/update-files-1.11.0-2.0.0.inc.php (2 issues)

1
<?php
2
3
/* For licensing terms, see /license.txt */
4
5
/**
6
 * Updates the Chamilo files from version 1.10.0 to version 1.11.0
7
 * This script operates only in the case of an update, and only to change the
8
 * active version number (and other things that might need a change) in the
9
 * current configuration file.
10
 */
11
error_log('Starting '.basename(__FILE__));
12
13
global $debug;
14
15
if (defined('SYSTEM_INSTALLATION')) {
16
    // Changes for 2.0.0
17
    $pluginPath = api_get_path(SYS_PLUGIN_PATH);
18
19
    // The ImsLti plugin has been integrated to core in 2.0
20
    $ltiPluginPath = $pluginPath.'ImsLti';
21
22
    if (is_dir($ltiPluginPath)) {
23
        @rrmdir($ltiPluginPath);
0 ignored issues
show
Security Best Practice introduced by
It seems like you do not handle an error condition for rrmdir(). This can introduce security issues, and is generally not recommended. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unhandled  annotation

23
        /** @scrutinizer ignore-unhandled */ @rrmdir($ltiPluginPath);

If you suppress an error, we recommend checking for the error condition explicitly:

// For example instead of
@mkdir($dir);

// Better use
if (@mkdir($dir) === false) {
    throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
Loading history...
Are you sure the usage of rrmdir($ltiPluginPath) is correct as it seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
24
    }
25
26
    // Copy configuration.php from app/config/configuration.php to config/configuration.php
27
    $old = api_get_path(SYMFONY_SYS_PATH).'app/config/configuration.php';
28
    $new = api_get_path(SYMFONY_SYS_PATH).'config/configuration.php';
29
    copy($old, $new);
30
31
    error_log('Finish script '.basename(__FILE__));
32
} else {
33
    echo 'You are not allowed here !'.__FILE__;
34
}
35