Extcal_2_21   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 12
dl 0
loc 28
rs 10
c 1
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 21 4
1
<?php
2
/*
3
 * You may not change or alter any portion of this comment or credits
4
 * of supporting developers from this source code or any supporting source code
5
 * which is considered copyrighted (c) material of the original comment or credit authors.
6
 *
7
 * This program is distributed in the hope that it will be useful,
8
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10
 */
11
12
/**
13
 * @copyright    {@link https://xoops.org/ XOOPS Project}
14
 * @license      {@link https://www.gnu.org/licenses/gpl-2.0.html GNU GPL 2 or later}
15
 * @package      extcal
16
 * @since
17
 * @author       XOOPS Development Team,
18
 * @author       JJDai <http://xoops.kiolo.com>
19
 */
20
//----------------------------------------------------
21
class Extcal_2_21
22
{
23
    //----------------------------------------------------
24
    /**
25
     * @param \XoopsModule $module
26
     * @param              $options
27
     */
28
    public function __construct(\XoopsModule $module, $options)
0 ignored issues
show
Unused Code introduced by
The parameter $options is not used and could be removed. ( Ignorable by Annotation )

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

28
    public function __construct(\XoopsModule $module, /** @scrutinizer ignore-unused */ $options)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $module is not used and could be removed. ( Ignorable by Annotation )

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

28
    public function __construct(/** @scrutinizer ignore-unused */ \XoopsModule $module, $options)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
29
    {
30
        global $xoopsDB;
31
32
        // Create eXtcal upload directory if don't exist
33
        $dir = XOOPS_ROOT_PATH . '/uploads/extcal';
34
        if (!is_dir($dir)) {
35
            if (!mkdir($dir) && !is_dir($dir)) {
36
                throw new \RuntimeException(sprintf('Directory "%s" was not created', $dir));
37
            }
38
39
            // Copy index.html files on uploads folders
40
            $indexFile = __DIR__ . '/index.html';
41
            copy($indexFile, XOOPS_ROOT_PATH . '/uploads/extcal/index.html');
42
        }
43
44
        // Create who's not going table to fix bug. If the table exist, the query will faile
45
        $sql = 'CREATE TABLE `'
46
               . $xoopsDB->prefix('extcal_eventnotmember')
47
               . "` (`eventnotmember_id` INT(11) NOT NULL AUTO_INCREMENT,`event_id` INT(11) NOT NULL DEFAULT '0',`uid` INT(11) NOT NULL DEFAULT '0',PRIMARY KEY  (`eventnotmember_id`),UNIQUE KEY `eventnotmember` (`event_id`,`uid`)) COMMENT='eXtcal By Zoullou' ;";
48
        $xoopsDB->query($sql);
49
    }
50
    //-----------------------------------------------------------------
51
}   // fin de la classe
52