XPressME Integration Kit

Trac

Changeset 551


Ignore:
Timestamp:
Mar 17, 2010, 11:38:11 AM (14 years ago)
Author:
toemon
Message:

mySQL接続上限警告 対策 Fixes#315

Location:
trunk/xpressme_integration_kit
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/xpressme_integration_kit/admin/index.php

    r518 r551  
    166166        global $xoopsModule; 
    167167        include(dirname(__FILE__) . '/../wp-includes/version.php'); 
    168         require_once dirname(dirname( __FILE__ )).'/class/config_from_xoops.class.php' ; 
     168        require_once dirname(dirname( __FILE__ )).'/include/memory_limit.php' ; 
    169169 
    170170        if ($is_report) { 
     
    196196                echo  ini_get( 'memory_limit' ); 
    197197                echo "<br />\n"; 
    198                 $xoops_config = new ConfigFromXoops; 
    199                 $xoops_config->xpress_set_memory_limmit(); 
     198                xpress_set_memory_limmit(); 
    200199                echo "change memory_limit:   " ; 
    201200                echo  ini_get( 'memory_limit' ); 
     
    270269                echo  ini_get( 'memory_limit' ); 
    271270                echo "</text><br />"; 
    272                 $xoops_config = new ConfigFromXoops; 
    273                 $xoops_config->xpress_set_memory_limmit(); 
     271                xpress_set_memory_limmit(); 
    274272                echo "<label>change memory_limit:</label><text>"; 
    275273                echo  ini_get( 'memory_limit' ); 
  • trunk/xpressme_integration_kit/class/config_from_xoops.class.php

    r531 r551  
    101101                $this->set_module_version(); 
    102102                $this->set_wp_version(); 
    103                 $this->xpress_get_module_id(); 
    104                 $this->xoops_language = $this->xpress_get_xoops_config('language'); 
    105                 $this->xpress_get_module_config(); 
    106103    } 
    107104 
     
    300297    } 
    301298     
    302         function xpress_get_xoops_config($config_name = '',$mid = 0){ 
    303                 $ret = ''; 
    304                 $cn = mysql_connect($this->xoops_db_host, $this->xoops_db_user, $this->xoops_db_pass); 
    305                 if (!$cn) return $ret; 
    306                  
    307                 $db_selected = mysql_select_db($this->xoops_db_name, $cn); 
    308                 if ($db_selected){ 
    309                         $table_name = $this->xoops_db_prefix . '_config'; 
    310                         $sql = "SELECT conf_value AS value FROM $table_name WHERE `conf_modid` = $mid AND `conf_name` = '$config_name'"; 
    311                         if($result = mysql_query($sql)){ 
    312                                 $row = mysql_fetch_assoc($result); 
    313                                 $ret = $row['value']; 
    314                         } else { 
    315                                 $ret = $sql; 
    316                         } 
    317                 } 
    318                 if( ! defined( 'XOOPS_ROOT_PATH' ) ) mysql_close($cn); 
    319                 return $ret; 
    320         } 
    321  
    322         function xpress_get_module_config(){ 
    323                 $this->module_config= array(); 
    324                 $cn = mysql_connect($this->xoops_db_host, $this->xoops_db_user, $this->xoops_db_pass); 
    325                 if (!$cn) return $ret; 
    326                  
    327                 $db_selected = mysql_select_db($this->xoops_db_name, $cn); 
    328                 if ($db_selected){ 
    329                         $table_name = $this->xoops_db_prefix . '_config'; 
    330                         $sql = "SELECT conf_name AS name, conf_value AS value FROM $table_name WHERE `conf_modid` = $this->module_id"; 
    331                         if($result = mysql_query($sql)){ 
    332                                 while ($row = mysql_fetch_assoc($result)) { 
    333                                 $this->module_config[$row['name']] = $row['value']; 
    334                                 } 
    335                         } 
    336                 } 
    337                 if( ! defined( 'XOOPS_ROOT_PATH' ) ) mysql_close($cn); 
    338                 return $this->module_config; 
    339         } 
    340  
    341         function xpress_get_module_id(){ 
    342                 $this->module_id = ''; 
    343                 $cn = mysql_connect($this->xoops_db_host, $this->xoops_db_user, $this->xoops_db_pass); 
    344                 if ($cn){ 
    345                         $db_selected = mysql_select_db($this->xoops_db_name, $cn); 
    346                         if ($db_selected){ 
    347                                 $table_name = $this->xoops_db_prefix . '_modules'; 
    348                                 $sql = "SELECT mid FROM $table_name WHERE `dirname` = '$this->module_name'"; 
    349                                 if($result = mysql_query($sql)){ 
    350                                         $row = mysql_fetch_assoc($result); 
    351                                         $this->module_id = $row['mid']; 
    352                                 } 
    353                         } 
    354                         if( ! defined( 'XOOPS_ROOT_PATH' ) ) mysql_close($cn); 
    355                 } 
    356                 return $this->module_id; 
    357         } 
    358          
    359          
    360         // Set XPressME memory limit 
    361         function xpress_set_memory_limmit(){ 
    362                 $memory = $this->module_config['memory_limit']; 
    363                 if (empty($memory)) return; 
    364                 if ( !defined('WP_MEMORY_LIMIT') ) 
    365                         define('WP_MEMORY_LIMIT', $memory . 'M'); 
    366                 if ( function_exists('memory_get_usage') && ( (int) @ini_get('memory_limit') < abs(intval(WP_MEMORY_LIMIT)) ) ) 
    367                         @ini_set('memory_limit', WP_MEMORY_LIMIT); 
    368         } 
    369  
    370  
    371  
    372299} 
    373300?> 
  • trunk/xpressme_integration_kit/include/add_xpress_config.php

    r491 r551  
    33require_once dirname(dirname( __FILE__ )).'/class/config_from_xoops.class.php' ; 
    44$xoops_config = new ConfigFromXoops; 
    5 $xoops_config->xpress_set_memory_limmit(); 
    65require_once dirname( __FILE__ ).'/set_cash_cookie_path.php' ; 
    76?> 
  • trunk/xpressme_integration_kit/include/add_xpress_process.php

    r549 r551  
    107107 
    108108require_once( dirname( __FILE__ ).'/request_url.php'); 
     109require_once( dirname( __FILE__ ).'/memory_limit.php'); 
    109110if (is_xpress_index_page_call()){ 
    110111        //$_SERVER['REQUEST_METHOD'] = 'POST' is 
     
    115116        require_once $xoops_config->xoops_mainfile_path; //It is necessary to execute it for the user attestation before wp-settings.php.  
    116117        $_SERVER['REQUEST_METHOD'] = $request_method; 
    117          
     118        xpress_set_memory_limmit(); // Set memory limmit.(Limmit Value from XPressMe modele config.) 
    118119        unset($offset);         //This Trap is provides the case where $offset is defined on the XOOPS side. 
    119120        require_once(ABSPATH.'wp-settings.php'); 
     
    181182if (is_admin_post_call()) require_once $xoops_config->xoops_mainfile_path;              // for Notification_triggerEvent 
    182183if (is_xpress_comments_post_call()) require_once $xoops_config->xoops_mainfile_path;    // for Notification_triggerEvent 
     184xpress_set_memory_limmit(); // Set memory limmit.(Limmit Value from XPressMe modele config.) 
    183185?> 
Note: See TracChangeset for help on using the changeset viewer.