Author Topic: advanced_search  (Read 1278 times)

Offline Dmitry42

  • Full Member
  • ***
  • Posts: 232
advanced_search
« on: January 17, 2023, 06:36:20 AM »
Hi a try use texxasrulez/advanced_search plugin on RC 1.6 but have error below:

Quote
Jan 17 14:02:39 mail roundcube: PHP Fatal error:  Uncaught Error: Call to undefined method rcmail::build_folder_tree() in /var/www/html/webmail/plugins/advanced_search/advanced_search.php:561
Jan 17 14:02:39 mail roundcube: Stack trace:
Jan 17 14:02:39 mail roundcube: #0 /var/www/html/webmail/plugins/advanced_search/advanced_search.php(445): advanced_search->folder_selector()
Jan 17 14:02:39 mail roundcube: #1 /var/www/html/webmail/plugins/advanced_search/advanced_search.php(422): advanced_search->generate_searchbox()
Jan 17 14:02:39 mail roundcube: #2 /var/www/html/webmail/program/lib/Roundcube/rcube_plugin_api.php(575): advanced_search->display_advanced_search()
Jan 17 14:02:39 mail roundcube: #3 /var/www/html/webmail/program/include/rcmail.php(248): rcube_plugin_api->exec_action()
Jan 17 14:02:39 mail roundcube: #4 /var/www/html/webmail/index.php(278): rcmail->action_handler()
Jan 17 14:02:39 mail roundcube: #5 {main}
Jan 17 14:02:39 mail roundcube:   thrown in /var/www/html/webmail/plugins/advanced_search/advanced_search.php on line 561

Im totally not a PHP developer , but I try find answer for this problem.

1. As i can see build_folder_tree() exist and described it RC file rcmail_action.php:
protected static function build_folder_tree(&$arrFolders, $folder, $delm = '/', $path = '')

2. plugin use this function in:
class advanced_search extends rcube_plugin
      foreach ($list as $folder) {
            $this->rc->build_folder_tree($a_mailboxes, $folder, $delimiter);
        }

As I understand function "build_folder_tree" exist and must be accessible for plugin, but option "protected static" not allow use it from outside of RC main class.
So can you explain to me - its possible call this function by other way or i must think about try to rewrite this function in plugin code ?

PS. Im sorry if this stupid question, but im totally not PHP developer - I just read google for understanding this situation with "protected static"

Thank you!
« Last Edit: January 17, 2023, 06:56:44 AM by Dmitry42 »

Offline Dmitry42

  • Full Member
  • ***
  • Posts: 232
Re: advanced_search
« Reply #1 on: January 17, 2023, 07:05:10 AM »
So I test one thing:

I change protected to public in RC file, but it's still not work....so I think may be problem not in protected option.

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,880
    • SKaero - Custom Roundcube development
Re: advanced_search
« Reply #2 on: January 17, 2023, 11:02:44 AM »
It doesn't look like the plugin has been updated for a while so that is why there is incompatibility with newer version of Roundcube. It looks like there is a open PR for support for Roundcube 1.5.1 and it does replace the call to build_folder_tree so it may work better then the released version: https://github.com/texxasrulez/advanced_search/pull/1

Offline Dmitry42

  • Full Member
  • ***
  • Posts: 232
Re: advanced_search
« Reply #3 on: January 17, 2023, 11:35:23 PM »
Quote
It doesn't look like the plugin has been updated for a while so that is why there is incompatibility with newer version of Roundcube.
Unfortunately yes...

Quote
It looks like there is a open PR for support for Roundcube 1.5.1 and it does replace the call to build_folder_tree so it may work better then the released version

Thank you! I try test it now.

Offline Dmitry42

  • Full Member
  • ***
  • Posts: 232
Re: advanced_search
« Reply #4 on: January 18, 2023, 02:11:40 AM »
Thank you again!
it work with RC 1.6

Here is working version https://github.com/mariuszkrzaczkowski/advanced_search/tree/patch-1