XPressME Integration Kit

Trac

Changeset 384


Ignore:
Timestamp:
Sep 12, 2009, 10:35:47 AM (15 years ago)
Author:
toemon
Message:

インストール・アップデート失敗時の中断処理追加 fixed #204

Location:
trunk/xpressme_integration_kit/include
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/xpressme_integration_kit/include/oninstall.php

    r352 r384  
    2929                $root =& XCube_Root::getSingleton(); 
    3030                $root->mDelegateManager->add( 'Legacy.Admin.Event.ModuleInstall.' . ucfirst($mydirname) . '.Success' , 'xpress_message_append_oninstall' ) ; 
     31                $root->mDelegateManager->add( 'Legacy.Admin.Event.ModuleInstall.' . ucfirst($mydirname) . '.Fail' , 'xpress_message_append_oninstall_err' ) ; 
    3132                $ret = array() ; 
    3233        } else { 
     
    3637        $db =& Database::getInstance() ; 
    3738        $mid = $module->getVar('mid') ; 
     39 
     40        if( defined( 'XOOPS_CUBE_LEGACY' ) ) { 
     41                $ret[] = "********************************* Install Log ********************************<br />"; 
     42        } else { 
     43                $ret[] = '<h4 style="border-bottom: 1px dashed rgb(0, 0, 0); text-align: left; margin-bottom: 0px;">Install Log</h4>'; 
     44    } 
    3845 
    3946//xpress 
     
    4754        $site_name = ucfirst($mydirname) . ' ' . _MI_XP2_NAME; 
    4855         
     56// permission and wordpress files check 
     57        require_once ($path . 'include/pre_check.php'); 
     58        if(! xp_permission_check($mydirname, $mydirpath)){ 
     59                if( ! defined( 'XOOPS_CUBE_LEGACY' ) ) { 
     60                        $ret = $GLOBALS["err_log"]; 
     61                        $ret[] = "<br /><span style=\"color:#ff0000;\">The uninstallation of the module is executed now. </span><br />"; 
     62                        $ret[] = xoops_module_uninstall($mydirname); 
     63                } 
     64                return false; 
     65        } 
     66         
    4967// install WordPress 
    5068        if (file_exists($path . 'wp-load.php')) { 
     
    5674        wp_cache_flush(); 
    5775        make_db_current_silent(); 
    58         $ret[] = "The data base of wordpress was made by prefix $table_prefix."; 
     76        $ret[] = "The data base of wordpress was made by prefix $table_prefix.<br />"; 
    5977         
    6078        $option_desc = __('WordPress web address'); 
     
    84102                KEY post_id (post_id) 
    85103                )$charset_collate;"; 
    86  
    87104        dbDelta($views_queries); 
    88         $ret[] = "$views_table table of XPressME was made."; 
    89  
     105        $ret[] = "$views_table table of XPressME was made.<br />"; 
    90106         
    91107        $d3forum_link = XOOPS_DB_PREFIX . '_' . $xp_prefix .'_d3forum_link' ; 
     
    97113                )$charset_collate;"; 
    98114        dbDelta($views_queries); 
    99         $ret[] = "$d3forum_link table of XPressME was made."; 
     115        $ret[] = "$d3forum_link table of XPressME was made.<br />"; 
    100116         
    101117        $group_role = XOOPS_DB_PREFIX . '_' . $xp_prefix .'_group_role' ; 
     
    110126                )$charset_collate;"; 
    111127        dbDelta($views_queries); 
    112         $ret[] = "$group_role table of XPressME was made."; 
     128        $ret[] = "$group_role table of XPressME was made.<br />"; 
    113129         
    114130        $notify_reserve = XOOPS_DB_PREFIX . '_' . $xp_prefix .'_notify_reserve' ; 
     
    126142                )TYPE=MyISAM"; 
    127143        dbDelta($queries); 
    128         $ret[] = "$notify_reserve table of XPressME was made."; 
     144        $ret[] = "$notify_reserve table of XPressME was made.<br />"; 
    129145 
    130146        $sql = "INSERT INTO $group_role (groupid, role) VALUES (1, 'administrator')"; 
     
    163179        $sql = "UPDATE $wpdb->users SET user_pass ='$pass_md5' WHERE ID = $user_id"; 
    164180        $wpdb->query($sql); 
    165         $ret[] = 'The password of XOOPS was copied.'; 
     181        $ret[] = 'The password of XOOPS was copied.<br />'; 
    166182         
    167183         
     
    175191                } 
    176192                 
    177                 $ret[] = 'The first sample post & comment was written.'; 
     193                $ret[] = 'The first sample post & comment was written.<br />'; 
    178194                 
    179195                // Rewrite Option for Xpress 
     
    195211                        update_option("what_to_show", "posts"); 
    196212                        update_option('default_pingback_flag', 0); 
    197                         $ret[] = 'The initial data was written in the data base of wordpress.'; 
     213                        $ret[] = 'The initial data was written in the data base of wordpress.<br />'; 
    198214                         
    199215                        update_option("template", "xpress_default"); 
    200216                        update_option("stylesheet", "xpress_default"); 
    201                         $ret[] = 'The default theme of wordpress was set to xpress_default.'; 
     217                        $ret[] = 'The default theme of wordpress was set to xpress_default.<br />'; 
    202218                //      update_option('uploads_use_yearmonth_folders', 1); 
    203219                        update_option('upload_path', 'wp-content/uploads'); 
     
    220236        require_once dirname( __FILE__ ).'/xpress_active_plugin.php'; 
    221237        if (xpress_pulugin_activation('xpressme/xpressme.php')){ 
    222                 $ret[] = 'The xpressme plug-in was activated.'; 
     238                $ret[] = 'The xpressme plug-in was activated.<br />'; 
     239        } else { 
     240                $GLOBALS["err_log"][] =  '<span style="color:#ff0000;">failed in the activation of xpressme plug-in.</span><br />'; 
     241                return false; 
    223242        } 
    224243 
     
    241260} 
    242261endif; 
     262 
     263if( ! function_exists( 'xpress_message_append_oninstall_err' ) ) : 
     264function xpress_message_append_oninstall_err( &$module_obj , &$log ) 
     265{ 
     266        if( is_array( @$GLOBALS["err_log"] ) ) { 
     267                foreach( $GLOBALS["err_log"] as $message ) { 
     268                        $log->add( strip_tags($message)) ; 
     269                } 
     270        } 
     271 
     272        // use mLog->addWarning() or mLog->addError() if necessary 
     273} 
     274endif; 
     275 
    243276 
    244277if( ! function_exists( 'wp_install_old_defaults' ) ) : 
     
    274307} 
    275308endif; 
    276  
    277309?> 
  • trunk/xpressme_integration_kit/include/onupdate.php

    r352 r384  
    1515                $root =& XCube_Root::getSingleton(); 
    1616                $root->mDelegateManager->add( 'Legacy.Admin.Event.ModuleUpdate.' . ucfirst($mydirname) . '.Success', 'xpress_message_append_onupdate' ) ; 
     17                $root->mDelegateManager->add( 'Legacy.Admin.Event.ModuleUpdate.' . ucfirst($mydirname) . '.Fail', 'xpress_message_append_onupdate' ) ; 
    1718                $msgs = array() ; 
    1819        } else { 
     
    2223        $db =& Database::getInstance() ; 
    2324        $mid = $module->getVar('mid') ; 
     25         
     26 
    2427 
    2528//XPressME Update 
     
    2831        $mydirpath = XOOPS_ROOT_PATH . '/modules/' . $mydirname; 
    2932        $path = $mydirpath . '/'; 
    30          
     33 
     34// permission and wordpress files check 
     35        require_once ($path . 'include/pre_check.php'); 
     36        if(! xp_permission_check($mydirname, $mydirpath)){ 
     37                $msgs = $GLOBALS["err_log"]; 
     38                return false; 
     39        } 
     40 
    3141//Site_url and home of an optional table are repaired.  
    3242        $site_url= XOOPS_URL."/modules/".$mydirname; 
  • trunk/xpressme_integration_kit/include/xpress_templates_make.php

    r137 r384  
    2222                                $rcd = copy($file_path, $target_file_path); 
    2323                                if ($rcd){ 
    24                                         $msgs[] = 'Template <b>'.htmlspecialchars($target_file_path).'</b> copy from ' . htmlspecialchars($file); 
     24                                        $msgs[] = 'Template <b>'.htmlspecialchars($target_file_path).'</b> copy from ' . htmlspecialchars($file) . '<br />'; 
    2525                                } else { 
    26                                         $msgs[] = '<span style="color:#ff0000;">ERROR: Could not copy template <b>'.htmlspecialchars($target_file_name).'</b> from ' . htmlspecialchars($file). '(check templates directory permision (777))</span>'; 
     26                                        $msgs[] = '<span style="color:#ff0000;">ERROR: Could not copy template <b>'.htmlspecialchars($target_file_name).'</b> from ' . htmlspecialchars($file). '(check templates directory permision (777))</span><br />'; 
    2727                                }                                        
    2828                                $tplfile =& $tplfile_handler->create() ; 
Note: See TracChangeset for help on using the changeset viewer.