anggiawan wrote:

Maybe punbb use xml to make user easy to use it (just install and uninstall)

Yes - it's easy to install. In seccond solution it is still easy. You can add php files to your extensions directory, and include them using

require $ext_info['path'].'/your_file_path.php




I'll give more detailed example wink





Solution 1 all code in one file :
punbb/extensions/extension1/manifest.xml

<hook id="some_hook_id"><![CDATA[
php_code_line_1;
php_code_line_2;
php_code_line_3;
php_code_line_4;
php_code_line_5;
php_code_line_6;
php_code_line_7;
]]></hook>



OR Solution 2 code separated from manifest.xml :
punbb/extensions/extension1/manifest.xml

<hook id="some_hook_id"><![CDATA[
require $ext_info['path'].'/my_code.php
]]></hook>

punbb/extensions/extension1/my_code.php

<?php
php_code_line_1;
php_code_line_2;
php_code_line_3;
php_code_line_4;
php_code_line_5;
php_code_line_6;
php_code_line_7;
?>

Hello

I have many extensions in my plans. I need to transform all changes which I made from 1.2.x to 1.3.x. One important question to PunBB Developers:

What is better for code performance? put all code to manifest.xml or move as much as possible to external PHP files?

External PHP files are better while creating extension (you don't need to uninstall/install extension after every tiny change). But what is better for final release?

I noticed, that all extensions are cached in cache_hooks.php file. So this one file can be really big after adding many extensions. Will moving code to external files be better?

Thanks smile

(I hope that everybody understand my poor-grammar English wink )

128

(15 replies, posted in PunBB 1.3 extensions)

jamiet757 wrote:

Thanks, but you are supposed to upload it on this site!:o

ok, but where and how? ;P

thru wiki? :
http://punbb.informer.com/wiki/_media/p … policy.zip

129

(3 replies, posted in PunBB 1.3 troubleshooting)

It finaly worked after:
1. manualy changed posts and users table collation to utf8_general_ci
2. manualy changed fileds collation in these tables to utf8_general_ci
3. run unchanged db_update
4. manualy changed rest of fields collations to utf8_general_ci

do anyone else have similar problem? If yes, then I'll prepare some modified db_update file. just let me know thru PM

130

(3 replies, posted in PunBB 1.3 troubleshooting)

Still nothing
The problem is ONLY with special chars like "€". National chars are converted ok.

Now I'll try:
1. disable dcr2utf8 function, leaving those chars as &#xxxx;
2. After conversion change collate to utf
3. Apply dcr2utf8 fuction

131

(3 replies, posted in PunBB 1.3 troubleshooting)

Nobody? sad

Today I'll try to add temporary utf-8 field, copy content from message field, and work on this copy... I'll see.

But I'm still wondering why my pre_convert_table_utf8 function is not working. Any ideas?

132

(3 replies, posted in PunBB 1.3 troubleshooting)

Hello

I have problem with my DB conversion. Existing DB is in ISO-8859-2 (latin-2 / Polish) coding, but has many UTF-8 chars stored as &#xxxx; (like &#8364; = €)

I'm loosing those chars after conversion, and geting "?" in its place.

One more thing. Conversion is not changing collate parameter in tables. So after it I have utf8_general_ci tables with latin2_general_ci fields. I found out, that leaving this, unabling you to add special chars like € (for example to Forum Rules).

Can you give me any clue how to sort it out? roll





What did I try? :

- move conv_tables stage to begin
- creating new stage "pre_start" with changing all latin2_general_ci collatings to utf_general_ci (which is not working at all ??)

function pre_convert_table_utf8($table)
{
    global $forum_db;

    $result = $forum_db->query('SHOW FULL COLUMNS FROM `'.$table.'`') or error(__FILE__, __LINE__);
    while ($cur_column = $forum_db->fetch_assoc($result))
        if ($cur_column['Collation'] && $cur_column['Collation'] !== 'utf8_general_ci')
        {
            $allow_null = ($cur_column['Null'] == 'YES');
            $forum_db->alter_field($table, $cur_column['Field'], $cur_column['Type'].' CHARACTER SET utf8 COLLATE utf8_general_ci', $allow_null, $cur_column['Default']);
        }
}

- changing collate manualy before conversion

Powerdrift wrote:

When I click "Start update" in db_upgrade.php, the request is sent, but the page eventually times out.

I just converted my test database (400MB). Before autoreload page appears, I was waiting for about 3 minutes.
Maybe you have some short php-timeout on your server?

Anyway my conversion didn't do everything. Tables changed from ISO-8859-2 to UTF-8, but fileds not. Now I've problems for example in config table. I couldn't set any Unicode char (forum desription, rules).
I changed it manualy, and it start work like it should, but many of converted posts are brooken. I'll analize this db_update file and try to fix it smile

Hello

This is my first extension. But I have many more in plans smile

Extension adds FAQ and Privacy policy section to your forum. You can use one or both of them. Privacy policy link is placed in footer. FAQ link is placed in main menu (depends of configuration before Rules / after User list / after Index)
Please check and comment. There should be no bugs, but who knows wink

add_faq_policy.zip version 1.0

Version 1.1
-fixed bug with language file path
-use forum_link()
add_faq_policy_1.1.zip version 1.1

Version 1.1.2
-fixed lang issue on message screens
add_faq_policy_1.1.2.zip

(I recommend to apply this modification/fix: http://punbb.informer.com/forums/topic/ … -php-css/)


***
add_faq_policy_1.1.zip
add_faq_policy_1.1.2.zip
(added by KeyDog as links above dead)

135

(1 replies, posted in PunBB 1.3 bug reports)

Hello

Version 1.3.2

Administrator can not disable rules agreement requirement without turning them off completly.
Unposible to left textarea blank too. ("Leaving empty disables the use of rules.")

Probably just options description mistake.

Require agreement -> Users must agree to forum rules before registering.
Compose rules -> You may use HTML as text is not parsed. Leaving empty disables the use of rules.

should be:

Use rules -> Users must agree to forum rules before registering.
Compose rules -> You may use HTML as text is not parsed.

There is so many places where you can talk about "?>" wink
Maybe someone will answer my question. Have my plugin correct english?


btw. I do not use "?>" wink

yonash wrote:

I'll build plugin for my self, and then give it to you all smile

I've done it smile

Please help me to check language. My english isn't great.

<?php
/***********************************************************************
  
  Copyright (C) 2007 YonasH (yonash@yonash.pl)

  This software is free software; you can redistribute it and/or modify it
  under the terms of the GNU General Public License as published
  by the Free Software Foundation; either version 2 of the License,
  or (at your option) any later version.

  This software 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 General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  MA  02111-1307  USA

************************************************************************/

// Make sure no one attempts to run this script "directly"
if (!defined('PUN'))
    exit;

// Tell admin_loader.php that this is indeed a plugin and that it is loaded
define('PUN_PLUGIN_LOADED', 1);
define('PLUGIN_VERSION', '1.0');

// If you want to backup search tables as default
//define('PUN_BACKUP_SEARCH', 1);

// If you want to backup online table as default
//define('PUN_BACKUP_ONLINE', 1);

// Default compression 0 - none ; 1 - zip ; 2 - gzip
define('PUN_BACKUP_COMP', 1);

// Default backup dir
define('PUN_BACKUP_DIR', 'backup');

//
// Increase maximum execution time, but don't complain about it if it isn't
// allowed.
//
@set_time_limit(0);

if (isset($_POST['backup']))
{
    $skip_tables = (!empty($_POST['skip_table'])) ? ($_POST['skip_table']) : array();
    $compress = (isset($_POST['compression'])) ? ($_POST['compression']) : 'none';
    $backup_host = (strpos($db_host,':')) ? substr($db_host,0,strpos($db_host,':')) : $db_host;
    $backup_port = (strpos($db_host,':')) ? substr($db_host,strpos($db_host,':')+1,255) : '3306';
    $backup_file = PUN_BACKUP_DIR."/";
    $backup_file .= ($db_prefix) ? $db_prefix : $db_name."_";
    $backup_file .= date('ymd');
    
    $skip_temp = '';
    for($i = 0; $i < count($skip_tables); $i++)
        $skip_temp .= "--ignore-table=".$db_name.".".$skip_tables[$i]." ";
    
    if(system("mysqldump --host=".$backup_host." --port=".$backup_port." --user=".$db_username." --password=".$db_password." --quick ".$skip_temp.$db_name." > ".$backup_file.".sql",$rtrn) === false)
        message('Shell mysqldump error: '.$rtrn);
    
    if ($compress == 'zip')
        if(system("zip -q ".$backup_file.".zip ".$backup_file.".sql",$rtrn) === false)
            message('Shell zip error: '.$rtrn);

    if ($compress == 'gzip')
        if(system("gzip ".$backup_file.".gz ".$backup_file.".sql",$rtrn) === false)
            message('Shell gzip error: '.$rtrn);
        
    if ($compress != 'none')
        system("rm ".$backup_file.".sql",$rtrn);

generate_admin_menu($plugin);
?>
    <div class="block">
        <h2><span>Database Shell Backup - v<?php echo PLUGIN_VERSION ?></span></h2>
        <div class="box">
            <div class="inbox">
                <p>Database backup successed.</p>
            </div>
        </div>
    </div>
<?php
}
else
{
generate_admin_menu($plugin);
?>
    <div class="block">
        <h2><span>Database Shell Backup - v<?php echo PLUGIN_VERSION ?></span></h2>
        <div class="box">
            <div class="inbox">
                <p>Lets you perform complete database backup. You must have permit to use PHP "system" command.<br />Created by: YonasH (with some use of DB Management plugin code)</p>
            </div>
        </div>
    </div>
    <div class="blockform">
        <h2 class="block2"><span>Database Backup</span></h2>
        <div class="box">
            <form method="post" action="<?php echo $_SERVER['REQUEST_URI'] ?>">
                <div class="inform">
                    <fieldset>
                        <legend>Backup options</legend>
                        <div class="infldset">
                            <p>Here you can back up all your PunBB-related data. If your server supports it you may also compress the file to reduce its size before download.</p>
                            <table cellspacing="0">
                                <tr>
                                    <th scope="row">Select tables to SKIP</th>
                                    <td>
<?php
$sql = 'SHOW TABLE STATUS';
if (!$result = $db->query($sql))
{
    message('Tables error');
}
//autoskip some tables
$pun_skip_tables = array();
if (!defined('PUN_BACKUP_SEARCH'))
    $pun_skip_tables = array('search_cache', 'search_matches', 'search_words');
if (!defined('PUN_BACKUP_ONLINE'))
    $pun_skip_tables[] = 'online';

//default compression metod autocheck
$comp_temp = array();
$comp_temp[PUN_BACKUP_COMP] = ' checked="checked"';

while ($row = $db->fetch_assoc($result))
{
    $name_tabl = $row['Name'];
    $name_temp = ($db->prefix) ? substr($name_tabl,strlen($db->prefix),255) : $name_tabl; //name without prefix

    if (in_array($name_temp,$pun_skip_tables))
        echo "\t\t\t\t\t\t\t\t\t\t".'<input name="skip_table[]" type="checkbox" value="'.$name_tabl.'" checked="checked" /> '.$name_tabl.'<br />'."\n";
    else
        echo "\t\t\t\t\t\t\t\t\t\t".'<input name="skip_table[]" type="checkbox" value="'.$name_tabl.'" /> '.$name_tabl.'<br />'."\n";
}
?>
                                    </td>
                                </tr>
                                <tr>
                                    <th scope="row">Compression type</th>
                                    <td>
                                        <input type="radio" name="compression" value="none"<?php echo $comp_temp[0] ?> /> None<br />
                                        <input type="radio" name="compression" value="zip"<?php echo $comp_temp[1] ?> /> Zip<br />
                                        <input type="radio" name="compression" value="gzip"<?php echo $comp_temp[2] ?> /> Gzip<br />
                                    </td>
                                </tr>
                            </table>
                        </div>
                    </fieldset>
                </div>
            <p class="submitend"><input type="submit" name="backup" value="Start backup" class="mainoption" /></p>
            </form>
        </div>
    </div>
<?php
}
yonash wrote:

Have you any idea for backup my 'tiny' database wink

solve: http://punbb.org/forums/viewtopic.php?id=14755

Smartys wrote:

Yes tongue

Thank you for you help tongue

backup.php

<?
echo "Database backup....<br>";
system("mysqldump --host=myhost --port=myport --user=myuser --password=mypass --quick --ignore-table=mybase.(prefix)search_cache --ignore-table=mybase.(prefix)search_matches --ignore-table=mybase.(prefix)search_words --ignore-table=mybase.(prefix)online mybase > myfile.sql");
system("zip myfile.zip myfile.sql");
echo "<br>Done.";
?>

I'll build plugin for my self, and then give it to you all smile

it works smile

I made backup.php file:

<?
system("mysqldump --host=myhost --port=myport --user=myuser --password=mypass mydatabase > myfile.sql");
echo "done";
?>

How to backup only selected tables? (I don't need to backup *search* tables)
Can I do this using mysqldump?
Just write yes/no wink I'll find solution and write it here smile

Hello

Have you any idea for daily backup my 'tiny' database wink

PunBB 1.2.14
Operating system: Linux
PHP: 5.1.6 - Show info
Accelerator: N/A (?? gzip works fine)
MySQL 5.0.26-log
Rows: 4186412
Size: 187.35 MB

I still can do this with MySQL-Front, but sometimes it exced time limit hmm
When I tried to use DB Management or DB Backup plugin, my server gives me Internal Error hmm (about after 5 seconds)

Some datas from phpinfo()

max_execution_time 30s
max_input_time 600s
memory_limit 20M
safe_mode Off

mysql.connect_timeout 60s

Hello

Have you any idea for backup my 'tiny' database wink

PunBB 1.2.14
Operating system: Linux
PHP: 5.1.6 - Show info
Accelerator: N/A (?? gzip works fine)
MySQL 5.0.26-log
Rows: 4186412
Size: 187.35 MB

I still can do this with MySQL-Front, but sometimes it exced time limit hmm
When I try to use this or DB Backup plugin, my server give me Internal Error hmm (about after 5 seconds)

Some datas from phpinfo()

max_execution_time 30s
max_input_time 600s
memory_limit 20M
safe_mode Off

mysql.connect_timeout 60s