Completed
Pull Request — master (#4)
by Goffy
02:43
created

update_function.php ➔ xoops_module_update_lexikon_v152()   B

Complexity

Conditions 6
Paths 32

Size

Total Lines 48
Code Lines 31

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 6
eloc 31
nc 32
nop 1
dl 0
loc 48
rs 8.551
c 0
b 0
f 0
1
<?php
2
// $Id$
3
//  ------------------------------------------------------------------------ //
4
//                XOOPS - PHP Content Management System                      //
5
//                    Copyright (c) 2000 XOOPS.org                           //
6
//                       <http://www.xoops.org/>                             //
7
// ------------------------------------------------------------------------- //
8
//  This program is free software; you can redistribute it and/or modify     //
9
//  it under the terms of the GNU General Public License as published by     //
10
//  the Free Software Foundation; either version 2 of the License, or        //
11
//  (at your option) any later version.                                      //
12
//                                                                           //
13
//  You may not change or alter any portion of this comment or credits       //
14
//  of supporting developers from this source code or any supporting         //
15
//  source code which is considered copyrighted (c) material of the          //
16
//  original comment or credit authors.                                      //
17
//                                                                           //
18
//  This program is distributed in the hope that it will be useful,          //
19
//  but WITHOUT ANY WARRANTY; without even the implied warranty of           //
20
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
21
//  GNU General Public License for more details.                             //
22
//                                                                           //
23
//  You should have received a copy of the GNU General Public License        //
24
//  along with this program; if not, write to the Free Software              //
25
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
26
//  ------------------------------------------------------------------------ //
27
//
28
29
//error_reporting(E_ALL);
30
31
function xoops_module_update_lexikon(&$module, $prev_version = null)
32
{
33
    $ret = null;
34
    if ($prev_version < 152) {
35
        $ret = xoops_module_update_lexikon_v152($module);
36
    }
37
    $errors = $module->getErrors();
38
    if (!empty($errors)) {
39
        print_r($errors);
40
    }
41
42
    return $ret;
43
}
44
45
function xoops_module_update_lexikon_v152(&$xoopsModule) {
0 ignored issues
show
Unused Code introduced by
The parameter $xoopsModule is not used and could be removed.

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

Loading history...
46
       
47
    /**
48
     * Create default upload directories
49
     */
50
    // Copy base file
51
    $indexFile = XOOPS_UPLOAD_PATH.'/index.html';
52
    $blankFile = XOOPS_UPLOAD_PATH.'/blank.gif';
53
    // Making of uploads/lexikon folder
54
    $p_lexikon = XOOPS_UPLOAD_PATH.'/lexikon';
55
    if(!is_dir($p_lexikon)) {
56
        mkdir($p_lexikon, 0777);
57
        chmod($p_lexikon, 0777);
58
    }
59
    copy($indexFile, $p_lexikon.'/index.html');
60
    // Making of categories folder 
61
    $pl_categories = $p_lexikon.'/categories';
62
    if(!is_dir($pl_categories)) {
63
        mkdir($pl_categories, 0777);
64
        chmod($pl_categories, 0777);
65
    }
66
    copy($indexFile, $pl_categories.'/index.html');
67
    
68
    $plc_images = $pl_categories.'/images';
69
    if(!is_dir($plc_images)) {
70
        mkdir($plc_images, 0777);
71
        chmod($plc_images, 0777);
72
    }
73
    copy($indexFile, $plc_images.'/index.html');
74
    copy($blankFile, $plc_images.'/blank.gif');
75
    // Making of entries folder 
76
    $pl_entries = $p_lexikon.'/entries';
77
    if(!is_dir($pl_entries)) {
78
        mkdir($pl_entries, 0777);
79
        chmod($pl_entries, 0777);
80
    }
81
    copy($indexFile, $pl_entries.'/index.html');
82
    
83
    $ple_images = $pl_entries.'/images';
84
    if(!is_dir($ple_images)) {
85
        mkdir($ple_images, 0777);
86
        chmod($ple_images, 0777);
87
    }
88
    copy($indexFile, $ple_images.'/index.html');
89
    copy($blankFile, $ple_images.'/blank.gif');
90
    
91
    return true;
92
}
93