Not logged in. · Lost password · Register
Forum: General Help and Support Plugins RSS
Error occurs when install solr plugin
Avatar
yanbigong2 #1
Member for 2 weeks · 10 posts
Group memberships: Members
Show profile · Link to this post
Subject: Error occurs when install solr plugin
The front of my wiki shows:

Warning: Declaration of action_plugin_solr::register(&$controller) should be compatible with DokuWiki_Action_Plugin::register(Doku_Event_Handler $controller) in /Users/yanbingong/Sites/dokuwiki/lib/plugins/solr/action.php on line 432

Warning: Cannot modify header information - headers already sent by (output started at /Users/yanbingong/Sites/dokuwiki/lib/plugins/solr/action.php:432) in /Users/yanbingong/Sites/dokuwiki/inc/auth.php on line 1239

Warning: Cannot modify header information - headers already sent by (output started at /Users/yanbingong/Sites/dokuwiki/lib/plugins/solr/action.php:432) in /Users/yanbingong/Sites/dokuwiki/inc/actions.php on line 38

Warning: Cannot modify header information - headers already sent by (output started at /Users/yanbingong/Sites/dokuwiki/lib/plugins/solr/action.php:432) in /Users/yanbingong/Sites/dokuwiki/lib/tpl/dokuwiki/main.php on line 12



and after I replace <?php tpl_searchform(); ?> in tpl_header with
<?php
    $solr =& plugin_load("helper", "solr");
    $solr->tpl_searchform(true, false); // Search field with ajax and no autocomplete
  ?>

The fatal error occurs:
Fatal error: Cannot declare class DokuWiki_Plugin
 

Could you please help me to solve it?

Best Regards,
Mike
Avatar
schplurtz (Moderator) #2
Member since Nov 2009 · 242 posts · Location: France, Finistère
Group memberships: Global Moderators, Members
Show profile · Link to this post
Hello,

Quote by yanbigong2:
Warning: Declaration of action_plugin_solr::register(&$controller) should be compatible with DokuWiki_Action_Plugin::register(Doku_Event_Handler $controller) in /Users/yanbingong/Sites/dokuwiki/lib/plugins/solr/action.php on line 432
this plugin must be a bit old. You can probably fix this by editing file /Users/yanbingong/Sites/dokuwiki/lib/plugins/solr/action.php. Search and replace
function register(&$controller)
with
function register(Doku_Event_Handler $controller)

Additionnaly, you should report this as a bug to the author.
http://schplurtz.free.fr/wiki/
Avatar
schplurtz (Moderator) #3
Member since Nov 2009 · 242 posts · Location: France, Finistère
Group memberships: Global Moderators, Members
Show profile · Link to this post
I did not notice the fatal error part and replied too quickly.

I have no clue for this issue. Sorry.
http://schplurtz.free.fr/wiki/
Avatar
yanbigong2 #4
Member for 2 weeks · 10 posts
Group memberships: Members
Show profile · Link to this post
Thank you for your answer, it helps to solve the first problem.

I searched on my file for "class DokuWiki_Plugin", and I can only find it in the Plugin.php, I don't know why the error occurs.

Fatal error: Cannot declare class DokuWiki_Plugin, because the name is already in use in /Users/yanbingong/Sites/dokuwiki/inc/plugin.php on line 9

I don't think the "DokuWiki_Plugin" is redeclared. The only change from the original one is from

  <?php tpl_searchform(); ?>

to

<?php
    $solr =& plugin_load("helper", "solr");
    $solr->tpl_searchform(true, false); // Search field with ajax and no autocomplete
  ?>
Avatar
yanbigong2 #5
Member for 2 weeks · 10 posts
Group memberships: Members
Show profile · Link to this post
In addition, even though the author says: Open the `main.php` file of your template and look for the code

     <?php tpl_searchform(); ?>

I can only find this line in tql_header
Avatar
schplurtz (Moderator) #6
Member since Nov 2009 · 242 posts · Location: France, Finistère
Group memberships: Global Moderators, Members
Show profile · Link to this post
Quote by yanbigong2:
I can only find this line in tql_header
It depends on the template you are using. At the time the solr_plugin was written, main.php was the file you had to edit if you used the default template. You have to understand this more as a hint than as an absolute truth.

So, in the end, that's ok. You found the correct file.
http://schplurtz.free.fr/wiki/
Avatar
schplurtz (Moderator) #7
Member since Nov 2009 · 242 posts · Location: France, Finistère
Group memberships: Global Moderators, Members
Show profile · Link to this post
In reply to post #4
Quote by yanbigong2:
<?php
    $solr =& plugin_load("helper", "solr");
    $solr->tpl_searchform(true, false); // Search field with ajax and no autocomplete
  ?>

I'm not sure this will be of any help, but I think that the & syntax is deprecated both by PHP and DW. And I'm not a PHP/DW developper. Anyway, try to remove this &. ie replace
$solr =& plugin_load("helper", "solr");
with
$solr = plugin_load("helper", "solr");
http://schplurtz.free.fr/wiki/
Avatar
grosse #8
Member since Nov 2014 · 6 posts · Location: Berlin, Germany
Group memberships: Members, Wiki Managers
Show profile · Link to this post
Which DokuWiki version do you have?

I searched on my file for "class DokuWiki_Plugin", and I can only find it in the Plugin.php, I don't know why the error occurs.

Fatal error: Cannot declare class DokuWiki_Plugin, because the name is already in use in /Users/yanbingong/Sites/dokuwiki/inc/plugin.php on line 9

Your wiki should only ever have one of those files:
inc/plugin.php (Pre-Greebo)
inc/Plugin.php (Greebo and later)

If you have both, then there is something wrong.
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Go to forum
Imprint
This board is powered by the Unclassified NewsBoard software, 20150713-dev, © 2003-2015 by Yves Goergen
Current time: 2018-07-18, 08:46:41 (UTC +02:00)