71
andrey3761
Re: dhtmltextarea and preview

Has replaced this line, does not work...



72
andrey3761
dhtmltextarea and preview

Hello!
Has updated XOOPS from version 2.4.2 to version 2.4.3. When in the editor dhtmltextarea I press "Preliminary viewing" Russian letters are not present. Instead of Russian letters - html the coding...
How to correct?

Resized Image



73
andrey3761
Re: XOOPS and innoDB

I know advantages. XOOPS will normally work with innoDB?



74
andrey3761
XOOPS and innoDB

For me XOOPS 2.4.2. A site with a great number of visitings. If to convert a database in ENGINE = innoDB, XOOPS it will be correct to work? Whether if advantages to use this engine?



75
andrey3761
Re: Converting from latin1 to utf8

Conversion of all database XOOPS in utf8

<?php

ini_set 
('max_execution_time''6000');
include_once 
'mainfile.php';
// ??????????? ??????
if( ! empty( $_POST['convert'] ) ) {

    include 
XOOPS_ROOT_PATH.'/header.php';
    
    
$old_prefix XOOPS_DB_PREFIX;

    
$srs $xoopsDB->queryF'SHOW TABLE STATUS FROM `'.XOOPS_DB_NAME.'`' ) ;

    if( ! 
$xoopsDB->getRowsNum$srs ) ) die( "You are not allowed to copy tables" ) ;

    
$count 0;
    while( 
$row_table $xoopsDB->fetchArray$srs ) ) {
        
$count ++ ;
        
$old_table $row_table['Name'] ;
        
// ???? ?????? ??????? ?? ???????? ???????? ??????, ?? ??????????...
        
if( substr$old_table strlen$old_prefix ) + ) !== $old_prefix '_' ) continue ;
        
        
// ???????????? ??????? ? utf8
        
$sql 'ALTER TABLE `'.$old_table.'` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci';
        if(
$xoopsDB->queryF($sql)) {
            echo 
'ok - '.$sql.'<br />';
        } else {
            echo 
$xoopsDB->error().' - '.$sql.'<br />';
        }
        
// ????????????? ????????? ????????????? ??????
        
$sql 'ALTER TABLE `'.$old_table.'` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci';
        if(
$xoopsDB->queryF($sql)) {
            echo 
'ok - '.$sql.'<br />';
        } else {
            echo 
$xoopsDB->error().' - '.$sql.'<br />';
        }

    }
    
    
// ????????????? ????????? ???? ??????
    
$sql 'ALTER DATABASE `'.XOOPS_DB_NAME.'` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci';
    if(
$xoopsDB->queryF($sql)) {
        echo 
'ok - '.$sql.'<br />';
    } else {
        echo 
$xoopsDB->error().' - '.$sql.'<br />';
    }
    include 
XOOPS_ROOT_PATH.'/footer.php';

// ????? ?????
} else {
    include 
XOOPS_ROOT_PATH.'/header.php';
    
xoops_confirm(array('convert' => 1), 'convert.php''Convert in utf8?');
    include 
XOOPS_ROOT_PATH.'/footer.php';
}



?>



76
andrey3761
Re: Converting from latin1 to utf8

For database conversion in the coding utf8 it is necessary to fulfil queres:

ALTER TABLE table1 CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci
ALTER TABLE table1 
DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci

ALTER TABLE tableN CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci
ALTER TABLE tableN 
DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci

ALTER DATABASE 
`database` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci


In mainfile.php to replace the connection coding:

define('XOOPS_DB_CHARSET''utf8');


I have made a script of automatic conversion of a database. If it is necessary, I can place on a site.



77
andrey3761
Re: stinky server configuration for xoops 2.3 - 2.4

Quote:
Thank you for this valuable checklist, I will go through it as i migrate to a new server (Virtual Private Server, woohoo!)


For me XOOPS it is installed on Virtual Private Server.
Now I do caching Smarty in memcahe...

Quote:
Andrey: Can you clarify on that? Can I not run XOOPS with php sade mode enabled? I think I've done it before.


Sending email from a server will not work...



78
andrey3761
Re: stinky server configuration for xoops 2.3 - 2.4

Quote:
safe_mode On


safe_mode Off !



79
andrey3761
Re: XoopsCache class.

Has found function for caching Smarty of templates in memcached.

/**
 * Project: Smarty memcached cache handler function
 * Author: Mads Sülau Jørgensen <php at mads dot sulau dot dk>
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
function memcache_cache_handler($action, &$smarty_obj, &$cache_content$tpl_file=null$cache_id=null$compile_id=null$exp_time=null) {
    
// ref to the memcache object
    
$m $GLOBALS['memcached_res'];
    
    
// the key to store cache_ids under, used for clearing
    
$key 'smarty_caches';
    
    
// check memcache object
    
if (get_class($m) != 'Memcache') {
        
$smarty_obj->trigger_error('cache_handler: $GLOBALS['memcached_res'] is not a memcached object');
        return 
false;
    }
    
    
// unique cache id
    
$cache_id md5($tpl_file.$cache_id.$compile_id);
    
    switch (
$action) {
    case 
'read':
        
// grab the key from memcached
        
$contents $m->get($cache_id);
        
        
// use compression
        
if($smarty_obj->use_gzip && function_exists("gzuncompress")) {
            
$cache_content gzuncompress($contents);
        } else {
            
$cache_content $contents;
        }
        
        
$return true;
        break;
    
    case 
'write':
        
// use compression
        
if($smarty_obj->use_gzip && function_exists("gzcompress")) {
            
$contents gzcompress($cache_content);
        } else {
            
$contents $cache_content;
        }
        
        
// add the cache_id to the $key string
        
$caches $m->get($key);
        if (!
is_array($caches)) {
            
$caches = array($cache_id);
            
$m->set($key$caches);
        } else if (!
in_array($cache_id$caches)) {
            
array_push($caches$cache_id);
            
$m->set($key$caches);
        }
        
        
// store the value in memcached
        
$stored $m->set($cache_id$contents);
        
        if(!
$stored) {
            
$smarty_obj->trigger_error("cache_handler: set failed.");
        }
        
        
$return true;
        break;
    
    case 
'clear':
        if(empty(
$cache_id) && empty($compile_id) && empty($tpl_file)) {
            
// get all cache ids
            
$caches $m->get($key);
            
            if (
is_array($caches)) {
                
$len count($caches);
                for (
$i=0$i<$len$i++) {
                    
// assume no errors
                    
$m->delete($caches[$i]);
                }
                
                
// delete the cache ids
                
$m->delete($key);
                
                
$result true;
            }
        } else {
            
$result $m->delete($cache_id);
        }
        if(!
$result) {
            
$smarty_obj->trigger_error("cache_handler: query failed.");
        }
        
$return true;
        break;
        
    default:
        
// error, unknown action
        
$smarty_obj->trigger_error("cache_handler: unknown action "$action"");
        
$return false;
        break;
    }
    
    return 
$return;
}

?>


I apply it so:

<?php


include_once 'memcache_cache_handler.php';
//
$GLOBALS['memcached_res'] = new Memcache;
$GLOBALS['memcached_res']->connect('localhost'11211) or die ("Could not connect");
//

$xoopsTpl->cache_handler_func 'memcache_cache_handler';

if (!
$xoopsTpl->is_cached('db:shoutbox_shoutbox.html')) {
    
$result 'test';
    
$xoopsTpl->assign('shout'$result);
}
$xoopsTpl->display('db:shoutbox_shoutbox.html');
            
?>


How in this function correctly to specify $cache_id?

$cache_id md5($tpl_file.$cache_id.$compile_id);



80
andrey3761
Re: XoopsCache class.

Help me.

I start this script, and in folder "/xoops_data/caches/xoops_cache" there is file "xoops_test_http%3A%2F%2Fradio-hobby_org.php", it cached in file, instead of in memcached. Where error? How to switch on cache in memcache?

<?php

include_once '../mainfile.php';

$val 'val';
$key 'test';

xoops_load('cache');
$cache XoopsCache::getInstance();
$cache->engine('memcache');
$cache->write($key$val100);
$ret $cache->read($key);
echo 
$ret;

?>




TopTop
« 1 ... 5 6 7 (8) 9 10 11 ... 13 »



Login

Who's Online

268 user(s) are online (161 user(s) are browsing Support Forums)


Members: 0


Guests: 268


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits