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.1.1.1 by yamaji, Thu Mar 30 02:46:15 2006 UTC revision 1.6 by yamaji, Thu Jul 6 12:55:38 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');
# Line 82  function xoops_module_uninstall_xnpbulle Line 127  function xoops_module_uninstall_xnpbulle
127                  // cannot unregister filetype                  // cannot unregister filetype
128                  return false;                  return false;
129          }          }
         $table = $xoopsDB->prefix('xnpbulletin_item_detail_child_author');  
         $sql = "DROP TABLE $table";  
         if ( $xoopsDB->query($sql) == FALSE ){  
                 // cannot unregister child_author  
                 return false;  
         }  
         $table = $xoopsDB->prefix('xnpbulletin_item_detail_child_keywords');  
         $sql = "DROP TABLE $table";  
         if ( $xoopsDB->query($sql) == FALSE ){  
                 // cannot unregister child_keywords  
                 return false;  
         }  
         $table = $xoopsDB->prefix('xnpbulletin_item_detail_child_free_keywords');  
         $sql = "DROP TABLE $table";  
         if ( $xoopsDB->query($sql) == FALSE ){  
                 // cannot unregister child_free_keywords  
                 return false;  
         }  
130          return true;          return true;
131  }  }
132    
# Line 107  function xoops_module_update_xnpbulletin Line 134  function xoops_module_update_xnpbulletin
134    
135          global $xoopsDB;          global $xoopsDB;
136          switch ($oldversion) { //remember that version is multiplied with 100 to get an integer          switch ($oldversion) { //remember that version is multiplied with 100 to get an integer
137            case 200:
138            $table = $xoopsDB->prefix("xnpbulletin_item_detail_child_author");
139                    $sql = "ALTER TABLE $table ADD author_affiliation_translation varchar(255) NOT NULL";
140                    $result = $xoopsDB->query($sql);
141                    if( !$result ){
142                            echo "ERROR: " . $xoopsDB->error();
143                            return false;
144                    }
145    
146            case 201:
147          default:          default:
148                  return true;                  return true;
149          }          }

Legend:
Removed from v.1.1.1.1  
changed lines
  Added in v.1.6

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