XPressME Integration Kit

Trac

Changeset 491


Ignore:
Timestamp:
Dec 16, 2009, 1:22:13 PM (14 years ago)
Author:
toemon
Message:

Memory Limitを設定可能に Fixes #272

Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/extras/for_wordpressme2011/ja_EUC/language/japanese/modinfo.php

    r461 r491  
    2929XPressME¤Ïlibxml2¤Î¥Ð¡¼¥¸¥ç¥ó¤ò¼«Æ°Åª¤Ë¼èÆÀ¤·¡¢É¬ÍפǤ¢¤ì¤Ð¥Ñ¥Ã¥Á¤¬Å¬±þ¤µ¤ì¤Þ¤¹¡£ 
    3030XPressME¤¬libxml2¤Î¥Ð¡¼¥¸¥ç¥ó¤ò¼èÆÀ¤Ç¤­¤Ê¤¤¾ì¹ç¡¢¤³¤Î¥ª¥×¥·¥ç¥ó¤Ç¶¯À©Åª¤Ë¥Ñ¥Ã¥Á¤òŬ±þ¤µ¤»¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£"); 
     31         
     32        define("_MI_MEMORY_LIMIT","¥â¥¸¥å¡¼¥ë¤ËºÇÄã¸ÂɬÍפʥá¥â¥ê(MB)"); 
     33        define("_MI_MEMORY_LIMIT_DESC","php.ini¤Îmemory_limitÃͤ¬¤³¤ÎÃͤè¤ê¾®¤µ¤¤¤È¤­¡¢²Äǽ¤Ç¤¢¤ì¤Ðini_set('memory_limit', Value);¤ò¼Â¹Ô¤·memory_limit¤òºÆÀßÄꤹ¤ë"); 
    3134 
    3235        // Block Name 
  • trunk/extras/for_wordpressme2011/ja_UTF/language/ja_utf8/modinfo.php

    r461 r491  
    2929XPressMEはlibxml2のバージョンを自動的に取得し、必要であればパッチが適応されます。 
    3030XPressMEがlibxml2のバージョンを取得できない場合、このオプションで強制的にパッチを適応させることができます。"); 
     31         
     32        define("_MI_MEMORY_LIMIT","モジュールに最低限必要なメモリ(MB)"); 
     33        define("_MI_MEMORY_LIMIT_DESC","php.iniのmemory_limit値がこの値より小さいとき、可能であればini_set('memory_limit', Value);を実行しmemory_limitを再設定する"); 
    3134 
    3235        // Block Name 
  • trunk/extras/xpress_i18n/portuguese-br/xpressme_modules_root/language/pt-br_utf8/modinfo.php

    r461 r491  
    2929XPressME adquire uma versão de libxml2 automaticamente, e é adaptado um remendo se for necessário.  
    3030Quando XPressME não puder adquirir uma versão de libxml2, o senhor pode deixar um remendo isto ajustar violentamente com esta opção."); 
     31         
     32        define("_MI_MEMORY_LIMIT","Tamanho de memória (MB) pelo menos necessário para módulo"); 
     33        define("_MI_MEMORY_LIMIT_DESC","php.iniのmemory_limit値がこの値より小さいとき、可能であればini_set('memory_limit', Value);を実行しmemory_limitを再設定する"); 
    3134 
    3235        // Block Name 
  • trunk/extras/xpress_i18n/template/xpressme_modules_root/language/english/modinfo.php

    r468 r491  
    2929XPressME acquires a version of libxml2 automatically, and it is adapted a patch if it is necessary.  
    3030When XPressME cannot acquire a version of libxml2, you can let a patch fit it with this option forcibly."); 
     31         
     32        define("_MI_MEMORY_LIMIT","Memory size(MB) at least necessary for module"); 
     33        define("_MI_MEMORY_LIMIT_DESC","Se o memory_limit avaliam de php.ini é menor que este valor. Tente o re-colocação de memory_limit com ini_set ('memory_limit', Valor);."); 
    3134 
    3235        // Block Name 
  • trunk/xpressme_integration_kit/admin/index.php

    r416 r491  
    164164        global $xoopsModule; 
    165165        include(dirname(__FILE__) . '/../wp-includes/version.php'); 
    166          
     166        require_once dirname(dirname( __FILE__ )).'/class/config_from_xoops.class.php' ; 
     167 
    167168        if ($is_report) { 
    168169                echo "******** "  . _AM_XP2_SYSTEM_INFO . "********" . "<br />\n"; 
     
    190191                echo ( extension_loaded( 'xml' )) ? "ON" : "OFF"; 
    191192                echo "<br />\n"; 
    192                 echo "memory_limit:   " ; 
     193                echo "default memory_limit:   " ; 
    193194                echo  ini_get( 'memory_limit' ); 
    194195                echo "<br />\n"; 
     196                $xoops_config = new ConfigFromXoops; 
     197                $xoops_config->xpress_set_memory_limmit(); 
     198                echo "change memory_limit:   " ; 
     199                echo  ini_get( 'memory_limit' ); 
     200                echo "<br />\n"; 
     201                 
    195202                echo "post_max_size:   " ; 
    196203                echo  ini_get( 'post_max_size' ); 
     
    258265                echo ( extension_loaded( 'xml' )) ? "ON" : "OFF"; 
    259266                echo "</text><br />"; 
    260                 echo "<label>memory_limit:</label><text>"; 
     267                echo "<label>default memory_limit:</label><text>"; 
    261268                echo  ini_get( 'memory_limit' ); 
    262269                echo "</text><br />"; 
     270                $xoops_config = new ConfigFromXoops; 
     271                $xoops_config->xpress_set_memory_limmit(); 
     272                echo "<label>change memory_limit:</label><text>"; 
     273                echo  ini_get( 'memory_limit' ); 
     274                echo "</text><br />"; 
     275 
    263276                echo "<label>post_max_size:</label><text>"; 
    264277                echo  ini_get( 'post_max_size' ); 
     
    571584function xpress_block_state($is_report = false) 
    572585{ 
    573         require_once dirname(dirname( __FILE__ )).'/class/config_from_xoops.class.php' ; 
    574         $xoops_config = new ConfigFromXoops; 
    575          
     586        $mydirname = basename( dirname( dirname( __FILE__ ) ) ) ; 
     587 
    576588        include_once(dirname(dirname(__FILE__) ). '/class/check_blocks_class.php'); 
    577589        $xoops_block_check =& xoops_block_check::getInstance(); 
    578         $xoops_block_check->check_blocks($xoops_config->module_name); 
     590        $xoops_block_check->check_blocks($mydirname); 
    579591        if ($is_report){ 
    580592                echo "******** " . _AM_XP2_BLOCK_STATS . "********" . "<br />\n"; 
  • trunk/xpressme_integration_kit/class/config_from_xoops.class.php

    r360 r491  
    4343        var $wp_version; 
    4444        var $is_wp_me; 
     45        var $xoops_language; 
     46        var $module_id; 
     47        var $module_config= array(); 
    4548         
    4649        function __constructor()        //for PHP5 
     
    102105                $this->set_wp_version(); 
    103106                $this->set_mu_current_site(); 
     107                $this->xpress_get_module_id(); 
     108                $this->xoops_language = $this->xpress_get_xoops_config('language'); 
     109                $this->xpress_get_module_config(); 
    104110    } 
    105111 
     
    314320                } 
    315321    } 
    316      
     322 
     323        function xpress_get_xoops_config($config_name = '',$mid = 0){ 
     324                $ret = ''; 
     325                $cn = mysql_connect($this->xoops_db_host, $this->xoops_db_user, $this->xoops_db_pass); 
     326                if (!$cn) return $ret; 
     327                 
     328                $db_selected = mysql_select_db($this->xoops_db_name, $cn); 
     329                if ($db_selected){ 
     330                        $table_name = $this->xoops_db_prefix . '_config'; 
     331                        $sql = "SELECT conf_value AS value FROM $table_name WHERE `conf_modid` = $mid AND `conf_name` = '$config_name'"; 
     332                        if($result = mysql_query($sql)){ 
     333                                $row = mysql_fetch_assoc($result); 
     334                                $ret = $row['value']; 
     335                        } else { 
     336                                $ret = $sql; 
     337                        } 
     338                } 
     339                mysql_close($cn); 
     340                return $ret; 
     341        } 
     342 
     343        function xpress_get_module_config(){ 
     344                $this->module_config= array(); 
     345                $cn = mysql_connect($this->xoops_db_host, $this->xoops_db_user, $this->xoops_db_pass); 
     346                if (!$cn) return $ret; 
     347                 
     348                $db_selected = mysql_select_db($this->xoops_db_name, $cn); 
     349                if ($db_selected){ 
     350                        $table_name = $this->xoops_db_prefix . '_config'; 
     351                        $sql = "SELECT conf_name AS name, conf_value AS value FROM $table_name WHERE `conf_modid` = $this->module_id"; 
     352                        if($result = mysql_query($sql)){ 
     353                                while ($row = mysql_fetch_assoc($result)) { 
     354                                $this->module_config[$row['name']] = $row['value']; 
     355                                } 
     356                        } 
     357                } 
     358                mysql_close($cn); 
     359                return $this->module_config; 
     360        } 
     361 
     362        function xpress_get_module_id(){ 
     363                $this->module_id = ''; 
     364                $cn = mysql_connect($this->xoops_db_host, $this->xoops_db_user, $this->xoops_db_pass); 
     365                if ($cn){ 
     366                        $db_selected = mysql_select_db($this->xoops_db_name, $cn); 
     367                        if ($db_selected){ 
     368                                $table_name = $this->xoops_db_prefix . '_modules'; 
     369                                $sql = "SELECT mid FROM $table_name WHERE `dirname` = '$this->module_name'"; 
     370                                if($result = mysql_query($sql)){ 
     371                                        $row = mysql_fetch_assoc($result); 
     372                                        $this->module_id = $row['mid']; 
     373                                } 
     374                        } 
     375                        mysql_close($cn); 
     376                } 
     377                return $this->module_id; 
     378        } 
     379         
     380         
     381        // Set XPressME memory limit 
     382        function xpress_set_memory_limmit(){ 
     383                $memory = $this->module_config['memory_limit']; 
     384                if (empty($memory)) return; 
     385                if ( !defined('WP_MEMORY_LIMIT') ) 
     386                        define('WP_MEMORY_LIMIT', $memory . 'M'); 
     387                if ( function_exists('memory_get_usage') && ( (int) @ini_get('memory_limit') < abs(intval(WP_MEMORY_LIMIT)) ) ) 
     388                        @ini_set('memory_limit', WP_MEMORY_LIMIT); 
     389        } 
     390 
     391 
     392 
    317393} 
    318394?> 
  • trunk/xpressme_integration_kit/include/add_xpress_config.php

    r355 r491  
    33require_once dirname(dirname( __FILE__ )).'/class/config_from_xoops.class.php' ; 
    44$xoops_config = new ConfigFromXoops; 
     5$xoops_config->xpress_set_memory_limmit(); 
    56require_once dirname( __FILE__ ).'/set_cash_cookie_path.php' ; 
    67?> 
  • trunk/xpressme_integration_kit/language/english/modinfo.php

    r461 r491  
    2929XPressME acquires a version of libxml2 automatically, and it is adapted a patch if it is necessary.  
    3030When XPressME cannot acquire a version of libxml2, you can let a patch fit it with this option forcibly."); 
     31         
     32        define("_MI_MEMORY_LIMIT","Memory size(MB) at least necessary for module"); 
     33        define("_MI_MEMORY_LIMIT_DESC","If the memory_limit value of php.ini is smaller than this value. Try the re-setting of memory_limit with ini_set('memory_limit', Value);."); 
    3134 
    3235        // Block Name 
  • trunk/xpressme_integration_kit/language/ja_utf8/modinfo.php

    r461 r491  
    2929XPressMEはlibxml2のバージョンを自動的に取得し、必要であればパッチが適応されます。 
    3030XPressMEがlibxml2のバージョンを取得できない場合、このオプションで強制的にパッチを適応させることができます。"); 
     31         
     32        define("_MI_MEMORY_LIMIT","モジュールに最低限必要なメモリ(MB)"); 
     33        define("_MI_MEMORY_LIMIT_DESC","php.iniのmemory_limit値がこの値より小さいとき、可能であればini_set('memory_limit', Value);を実行しmemory_limitを再設定する"); 
    3134 
    3235        // Block Name 
  • trunk/xpressme_integration_kit/xoops_version.php

    r487 r491  
    134134        'default'               => 0 , 
    135135); 
     136$modversion['config'][] = array( 
     137        'name'                  => 'memory_limit' , 
     138        'title'                 =>  '_MI_MEMORY_LIMIT' , 
     139        'description'   =>  '_MI_MEMORY_LIMIT_DESC' , 
     140        'formtype'              => 'textbox' , 
     141        'valuetype'             => 'int' , 
     142        'default'               => 64 , 
     143); 
    136144 
    137145//BLOCKS 
Note: See TracChangeset for help on using the changeset viewer.