WebsiteBaker Community Forum

General Community => Global WebsiteBaker 2.8.x discussion => Topic started by: Martin Hecht on April 13, 2014, 09:36:38 PM

Title: some more WebsiteBaker 2.8.4 Releasetests
Post by: Martin Hecht on April 13, 2014, 09:36:38 PM
I have tested the 2.8.4 release Revision 2101

Tests were performed on my Ubuntu 12.04 LTS in a local installation with the following environment:
apache2: Server version: Apache/2.2.22 (Ubuntu)
php5.3: PHP 5.3.10-1ubuntu3.11 with Suhosin-Patch
mysqld  Ver 5.5.35-0ubuntu0.12.04.2
I must admit that my test-installation had only one page, but the focus was on testing some modules I'm using.

Upgrade from Wb 2.8.3 Sp1 went smoothly, but a few things still make problems:

I have switched to maintenance mode, but when I wanted to switch back to production, there was an error message:
Code: [Select]
Exception: "Error in SQL-Statement" >> Exception detected in: [/framework/WbDatabase.php]
The problem is in admin/settings/locking.php: a missing space before "WHERE" on line 36. It should read:
Code: [Select]
$sql .= $bUpdate ? ' WHERE `name` = \'system_locked\'' : '';

The droplets tool in the backend always pops up a message window telling "tablesorter not loaded".
I could solve this by updating to Droplets v1.72 (http://www.websitebakers.com/pages/droplets/module-wb-2.8.2.php)

Ckeditor 4.3.3 and WYSIWYG-admin 0.1.9.3 work fine. Backup 2.8.0.6, too.

The backends of "Output Filter Dashboard" and "Practical Module Functions" rely on the constants which were defined until 2.8.3 (DB_HOST, DB_USERNAME, DB_PASSWORD, DB_NAME). I believe there is a reason for changing this approach. I need a closer look what needs to be changed. I'll post it here, when I have an update.
Title: Re: some more WebsiteBaker 2.8.4 Releasetests
Post by: Stefek on April 13, 2014, 11:24:45 PM
Hallo Martin (sorry for using german here).
Du könntest Dich bei einem der Administratoren melden und eine Anfrage stellen, ob Du im Beter-Tester-Unterforum (welches normallerweise geschloßen ist) aufgenommen werden kannst.
Sonst geht Deine wertvolle arbeit entweder verloren oder Du machst etwaige Arbeit, die bereits getan wurde.

Schönen Gruß,
Stefek
Title: Re: some more WebsiteBaker 2.8.4 Releasetests
Post by: Martin Hecht on April 14, 2014, 10:59:40 AM
Hello Stefek,

thanks Stefek, I just used the contact form to drop a note about this thread to the core developers. Since I'm quite new here, it's not always clear to me what's the preferred way of reporting things.

Also a small update about PMF: Actually, it opens a separate connection to the database. One could either try to read the configurations file there a second time - or (which would be the better option, but much more work) change all the database functions of PMF such that it uses the global database class. Just using
Code: [Select]
global $database
makes the error disappear, but the backends of PMF and the dashboard are completely empty then. It seems there are some more things to do - first of all to find out why there is no output. Maybe the database works, but in addition something else might have changed , e.g. in the way the backend is called.

Martin
Title: Re: some more WebsiteBaker 2.8.4 Releasetests
Post by: dbs on April 14, 2014, 11:21:09 AM
Hi, in 2101 are not all fixed things included.
The developer will do this in short time.
Title: Re: some more WebsiteBaker 2.8.4 Releasetests
Post by: DarkViper on April 14, 2014, 12:28:07 PM

Hello Martin,
some of your questions will be answered in that thread:
Important hints from core-dev-team (http://www.WebsiteBaker.org/forum/index.php/topic,24049.0.html)
please take care for this hints!

If you really need the access data for the database, then you can make use of 2 functions from framework/initialize.php: (this file always is loaded by default, no additional include needed!)

Code: [Select]
<?php

$aDbConfig 
initGetDbConnectData(initReadSetupFile(), 'dsn');
// or 
$sDbConfig initGetDbConnectData(initReadSetupFile(), 'url');


the content of the result you can explore in initialize.php from line 193 to 209

In any case it's not a good idea to implement a own Db handling divergently to the class WbDatabase
I.e. in near future we like to change that class (without changing the interface) so all different methods can run in trouble.

!! all above is valid from WB-2.8.4 only and does not work with earlier versions !!
Title: Re: some more WebsiteBaker 2.8.4 Releasetests
Post by: Martin Hecht on April 16, 2014, 12:07:01 AM
Hi DarkViper,

some of your questions will be answered in that thread:
Important hints from core-dev-team (http://www.WebsiteBaker.org/forum/index.php/topic,24049.0.html)
please take care for this hints!

If you really need the access data for the database, then you can make use of 2 functions from framework/initialize.php: (this file always is loaded by default, no additional include needed!)
(...)

thank you, with these hints I could make "Practical Module Functions" and (at least the backend of) "output filter dashboard" work. The changes needed for PMF:

Code: [Select]
diff -u /tmp/functions_database.php.orig functions_database.php
--- /tmp/functions_database.php.orig    2014-04-27 22:38:58.985544514 +0200
+++ functions_database.php      2014-04-27 14:54:23.457133575 +0200
@@ -784,8 +784,15 @@
     die();
   } else {
     // WB 2.8
-    $data = array('host'=>DB_HOST, 'user'=>DB_USERNAME, 'pass'=>DB_PASSWORD, 'db'=>DB_NAME);
+    if(function_exists("initGetDbConnectData")){
+    $DbConfig = initGetDbConnectData(initReadSetupFile(), 'url');
+    $parsed = parse_url($DbConfig['url']);
+    $data = array('host'=>$parsed['host'], 'user'=>$parsed['user'], 'pass'=>$parsed['pass'], 'db'=>trim($parsed['path'],"/"));
     return($data);
+    } else {
+      $data = array('host'=>DB_HOST, 'user'=>DB_USERNAME, 'pass'=>DB_PASSWORD, 'db'=>DB_NAME);
+      return($data);
+    }
   }
   pmf_debug_fatal_message($sh, '(Read Config) An unknown error occurred!');
   die();
@@ -796,8 +803,15 @@
     // WB 2.9
     pmf_debug_fatal_message($sh, '(Read Config) WB 2.9 not supported, yet!');
     die();
+  } else if(version_compare(WB_VERSION, '2.8.3', '>')) {
+    // WB 2.8.4
+    $database = WbDatabase::getInstance();
+    if($res = $database->query("SHOW VARIABLES LIKE 'character_set_client'")) {
+      $row = $res->fetchRow();
+      return($row['Value']);
+    }
   } else {
-    // WB 2.8
+    // WB 2.8.x , x<4
     global $database;
     if($res = $database->query("SHOW VARIABLES LIKE 'character_set_client'")) {
       $row = $res->fetchRow();

I haven't tested this on WB 2.8.3, yet, but I hope this patch doesn't break backward compatibility.

In any case it's not a good idea to implement a own Db handling divergently to the class WbDatabase
I.e. in near future we like to change that class (without changing the interface) so all different methods can run in trouble.

Yes, I agree. It would be better to rewrite the database part of PMF. This code was written by thorn a couple of years ago, and probably a lot has changed since then. The code makes use of mysqli_query statements, which all need to be adapted for making it compatible with the new object oriented approach, which uses mysql internally instead of mysqli.

Next steps: We have to test the apove patch in different environments (also in earlier WB installations) and if this is all ok, it can be applied to PMF. How does this work? Shall I contact thorn via email and ask him if he can provide an updated package?

For "output filter dashboard" I have to check if the patch for the core files is still the same. By the way, this would really be of great advantage if those hooks described in the documentation (http://nettest.thekk.de/docs/opf/files/EN/intro-txt.html#Patch) were already included into the core. However, I'll check if they still have to look the same for WB 2.8.4
Title: Re: some more WebsiteBaker 2.8.4 Releasetests
Post by: Martin Hecht on April 16, 2014, 12:14:54 AM
Hi, in 2101 are not all fixed things included.
The developer will do this in short time.

but 2101 is the latest revision which I can check out from the svn.
So, the sql issue mentioned in my first post in this thread might not be fixed yet... (or it is fixed in a local copy which is not yet checked into the svn, which might be the case as well).
Title: Re: some more WebsiteBaker 2.8.4 Releasetests
Post by: Martin Hecht on April 16, 2014, 01:01:10 AM
Another thing I just noticed:

I see log messages in my web server log when I log into the backend:
PHP Catchable fatal error:  Object of class WbDatabase could not be converted to string in .../admin/start/index.php on line 108, referer: http://.../admin/start/index.php

It is the start page in the backend. Actually, it doesn't show anything at all except the menu bar, just like PMF before I have fixed the Database issue.

Actually, this is issue 1 in this post: http://www.WebsiteBaker.org/forum/index.php/topic,26660.msg186220.html#msg186220 (for a fix see there)
Ok, this is already known which I wasn't aware when I started to write this post. But well, since I have written it already, at least I can say "yes, I can confirm this issue".
Title: Re: some more WebsiteBaker 2.8.4 Releasetests
Post by: dbs on April 16, 2014, 09:29:10 AM
Quote
but 2101 is the latest revision which I can check out from the svn.
Yes, we other testers can also only this version checkout. The developer (DarkViper) has many work with fixing all things. He She will update the svn with a bundle of fixes.
Like Stefek wrote you should have access to the forum "Core Dev-Test"
http://www.WebsiteBaker.org/forum/index.php/board,98.0.html (Moderator badknight)

edit ;)
Title: Re: some more WebsiteBaker 2.8.4 Releasetests
Post by: Martin Hecht on April 16, 2014, 11:36:05 PM
Hi again,

I have tested the patch to "Practical Module Functions (PMF)" in one of my 2.8.3 sp1 installations, and I can confirm, this patch works: http://www.WebsiteBaker.org/forum/index.php/topic,27126.msg186903.html#msg186903 (same thread, some time ago).

"Output Filter Dashboard" seems to be working fine, too. Still I had to patch the core files. If some others could test this, it would really be a good step forward, if this patch could be included into the core distribution, too:

Code: [Select]
--- index.php.orig      2014-04-16 23:05:22.271835878 +0200
+++ index.php   2014-04-16 22:32:05.070009957 +0200
@@ -90,6 +90,17 @@
                        $output = executeFrontendOutputFilter($output);
                }
        }
+// Load OutputFilter functions
+if(file_exists(WB_PATH .'/modules/outputfilter_dashboard/functions.php')) {
+   require_once(WB_PATH .'/modules/outputfilter_dashboard/functions.php');
+   // use 'cache' instead of 'nocache' to enable page-cache.
+   // Do not use 'cache' in case you use dynamic contents (e.g. snippets)!
+   opf_controller('init', 'nocache');
+}
+// apply outputfilter
+if(function_exists('opf_apply_filters')) {
+   $output = opf_controller('page', $output);
+}
 // now send complete page to the browser
 echo $output;
 // end of wb-script
--- framework/frontend.functions.php.orig       2014-04-16 23:05:49.151896566 +0200
+++ framework/frontend.functions.php    2014-04-16 22:41:31.548028816 +0200
@@ -311,6 +311,9 @@
                                        require(WB_PATH.'/modules/'.$module.'/view.php');
                                        echo ($sSectionIdPrefix =='none') ? '' : "\n".'</div><!-- '.$module.$section_id.' -->'."\n";
                                        $content = ob_get_clean();
+                                       if(function_exists('opf_apply_filters')) {
+                                                $content = opf_controller('section', $content, $module, $page_id, $section_id);
+                                       }
                                } else {
                                        continue;
                                }
@@ -327,8 +330,17 @@
                                        echo $content;
                                }
                        }
-               } else {
-                       require(PAGE_CONTENT);
+               } else { // Searchresults! But also some special pages, e.g. guestbook (add entry), news (add comment) uses this
+                  ob_start(); // fetch original content
+                  require(PAGE_CONTENT);
+                  $content = ob_get_contents();
+                  ob_end_clean();
+                  // Apply Filters
+                  if(function_exists('opf_apply_filters')) {
+                      $content = opf_controller('special', $content);
+                  }
+                  // Print Content
+                  echo $content;
                }
        return $retVal;
 

Stefek, I have seen, you are mentioned as author in output filter dashboard as well. Could you review this? And are you in contact with thorn because of the patch for PMF?

best regards,
Martin
Title: Re: some more WebsiteBaker 2.8.4 Releasetests
Post by: Martin Hecht on April 16, 2014, 11:51:37 PM
Like Stefek wrote you should have access to the forum "Core Dev-Test"
http://www.WebsiteBaker.org/forum/index.php/board,98.0.html (Moderator badknight)
...and how can I get access there?
Title: Re: some more WebsiteBaker 2.8.4 Releasetests
Post by: Stefek on April 17, 2014, 12:14:28 AM
Ask badknight, he should grant you the access.
Tell him dbs and stefek would like to welcome you to the team.

Kind regards,
Stefek
Title: Re: some more WebsiteBaker 2.8.4 Releasetests
Post by: Martin Hecht on April 27, 2014, 11:10:07 PM
I have corrected the patch for making pmf working with WB 2.8.4 in this post:
...thank you, with these hints I could make "Practical Module Functions" and (at least the backend of) "output filter dashboard" work. The changes needed for PMF...

in the original version the function name was not enclosed in double quotes
Code: [Select]
    if(function_exists("initGetDbConnectData")){
which worked but threw a warning in the web server's log.