Develop and Download Open Source Software

Browse CVS Repository

Diff of /xoonips-library/xnpbulletin/install_funcs.php

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.2 by yamaji, Mon Apr 3 07:19:40 2006 UTC revision 1.3 by yamaji, Wed Apr 12 04:46:14 2006 UTC
# Line 1  Line 1 
1  <?php  <?php
2  //  Install script for bulletin module                                             //  //  Install script for bulletin module                                          //
3  //  $Revision$                                                                  //  //  $Revision$                                                            //
4  //  --------------------------------------------------------------------------  //  //  --------------------------------------------------------------------------  //
5  //  XooNIps Xoops modules for Neuroinformatics Platforms                        //  //  XooNIps Xoops modules for Neuroinformatics Platforms                        //
6  //  Copyright (C) 2005 RIKEN, Japan. All rights reserved.                       //  //  Copyright (C) 2005 RIKEN, Japan. All rights reserved.                       //
# Line 67  function xoops_module_install_xnpbulleti Line 67  function xoops_module_install_xnpbulleti
67    
68  function xoops_module_uninstall_xnpbulletin( $xoopsMod ) {  function xoops_module_uninstall_xnpbulletin( $xoopsMod ) {
69          global $xoopsDB;          global $xoopsDB;
70            
71            $item_type_id = -1;
72            $table = $xoopsDB->prefix('xoonips_item_type');
73            $mid = $xoopsMod->getVar('mid');
74            $sql = "SELECT item_type_id FROM $table where mid = $mid";
75            $result = $xoopsDB->query($sql);
76            if ( $result ){
77                    list($item_type_id) = $xoopsDB->fetchRow($result);
78            }else{
79                    echo mysql_error();
80                    echo $sql;
81                    return false;
82            }
83        
84            // Set "Deleted" status in the item_status table for repository
85            $table = $xoopsDB->prefix('xoonips_item_basic');
86            $sql = "SELECT item_id from ${table} WHERE item_type_id = $item_type_id";
87            $result = $xoopsDB->query($sql);
88            if ( !$result ){
89                    echo mysql_error();
90                    echo $sql;
91                    return false;
92            }
93            $ids = array( );
94            while( list( $item_id ) = $xoopsDB->fetchRow($result) ){
95                    $ids[] = $item_id;
96            }
97            if( count( $ids ) > 0 ){
98                    $table = $xoopsDB->prefix('xoonips_item_status');
99                    $sql = "UPDATE ${table} SET deleted_timestamp=UNIX_TIMESTAMP(NOW()), is_deleted=1 WHERE item_id in ( ".implode( ",", $ids ).")";
100                    if ( $xoopsDB->query($sql) == FALSE ){
101                            echo mysql_error();
102                            echo $sql;
103                            return false;
104                    }
105            }
106        
107            // remove basic information
108            $table = $xoopsDB->prefix('xoonips_item_basic');
109            $sql = "DELETE FROM $table where item_type_id = $item_type_id";
110            if ( $xoopsDB->query($sql) == FALSE ){
111                    echo mysql_error();
112                    echo $sql;
113                    return false;
114            }
115        
116          // unregister itemtype          // unregister itemtype
117          $table = $xoopsDB->prefix('xoonips_item_type');          $table = $xoopsDB->prefix('xoonips_item_type');
118          $mid = $xoopsMod->getVar('mid');          $mid = $xoopsMod->getVar('mid');

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26