Passed
Pull Request — master (#18)
by Michael
02:01
created

MymenusUpdater::createUpdateTable()   D

Complexity

Conditions 9
Paths 13

Size

Total Lines 41
Code Lines 28

Duplication

Lines 14
Ratio 34.15 %

Importance

Changes 0
Metric Value
cc 9
eloc 28
nc 13
nop 3
dl 14
loc 41
rs 4.909
c 0
b 0
f 0
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
 * Mymenus module
13
 *
14
 * @copyright       XOOPS Project (https://xoops.org)
15
 * @license         GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
16
 * @package         mymenus
17
 * @since           1.5
18
 * @author          Xoops Development Team
19
 */
20
21
use XoopsModules\Mymenus;
22
23
defined('XOOPS_ROOT_PATH') || die('Restricted access');
24
25
//$moduleDirname = basename(dirname(__DIR__));
26
//require(XOOPS_ROOT_PATH . "/modules/$moduleDirname/include/common.php");
27
require __DIR__ . '/common.php';
28
$helper = Mymenus\Helper::getInstance($debug);
29
30
xoops_loadLanguage('admin', $helper->getDirname());
0 ignored issues
show
Bug introduced by
The function xoops_loadLanguage was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

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

30
/** @scrutinizer ignore-call */ 
31
xoops_loadLanguage('admin', $helper->getDirname());
Loading history...
31
32
/**
33
 * @param  object|\XoopsObject $xoopsModule
34
 * @param  int                $previousVersion
35
 * @return bool               FALSE if failed
36
 */
37
function xoops_module_update_mymenus(\XoopsObject $xoopsModule, $previousVersion)
0 ignored issues
show
Bug introduced by
The type XoopsObject was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
38
{
39
    if ($previousVersion < 151) {
40
        //if (!checkInfoTemplates($xoopsModule)) return false;
41
        if (!Mymenus\Updater::checkInfoTable($xoopsModule)) {
42
            return false;
43
        }
44
        //update_tables_to_150($xoopsModule);
45
    }
46
47
    return true;
48
}
49
50
51
if (!function_exists('InfoColumnExists')) {
52
    /**
53
     * @param $tablename
54
     * @param $spalte
55
     *
56
     * @return bool
57
     */
58
    function InfoColumnExists($tablename, $spalte)
59
    {
60
        if ('' === $tablename || '' === $spalte) {
61
            return true;
62
        } // Fehler!!
63
        $result = $GLOBALS['xoopsDB']->queryF('SHOW COLUMNS FROM ' . $tablename . " LIKE '" . $spalte . "'");
64
        $ret    = $GLOBALS['xoopsDB']->getRowsNum($result) > 0;
65
66
        return $ret;
67
    }
68
}
69
70
if (!function_exists('InfoTableExists')) {
71
    /**
72
     * @param $tablename
73
     *
74
     * @return bool
75
     */
76
    function InfoTableExists($tablename)
77
    {
78
        $result = $GLOBALS['xoopsDB']->queryF("SHOW TABLES LIKE '$tablename'");
79
        $ret    = $GLOBALS['xoopsDB']->getRowsNum($result) > 0;
80
81
        return $ret;
82
    }
83
}
84