I’m attempting to implement a phpBB library into Kohana.
I have created a vendor folder in my module and load the library like this and initialise it:
require_once Kohana::find_file('vendor/phpbb_library', 'phpbb_library');
$phpbb = new Phpbb_library();
However once the library starts attempting to include the phpBB files:
// Include needed files
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'config.' . $phpEx);
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
include($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx);
include($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
I then receive the following error:
ErrorException [ Fatal Error ]: Class user contains 5 abstract methods and must therefore be declared abstract or implement the remaining methods (Kohana_Session::_read, Kohana_Session::_regenerate, Kohana_Session::_write, ...)
Now the included files are those used by phpBB so obviously I can’t just go modifying them.
Solved 01/02/2012
Following the solution proposed by Michal M I have created my own versions of the Kohana Session class and saved them in a module. The files I had to copy, rename and edit were:
/system/classes/session.php
/system/classes/session/cookie.php
/system/classes/session/exception.php
/system/classes/session/native.php
/system/classes/kohana/session.php
/system/classes/kohana/session/cookie.php
/system/classes/kohana/session/exception.php
/system/classes/kohana/session/native.php
In all files the main edits involved changing class names Session to MySiteSession and Kohana_Session to Kohana_MySite_Session. Although there were a few usages of the variables in the /system/classes/kohana files which also needed the name change.
Now to use the session I simply call MySiteSession::instance().
PHPBB now works as an include as I am no longer using the Session class.
CI has different class naming. All CI classes begin with
CI_while Kohana doesn’t use any prefixes*.The only solution I can think of for you would be to refactor Kohana Session class (rename it everywhere) or do it with phpBB libraries. Neither is ideal though.
*) Just to clarify, Kohana does use
Kohana_, but all their classes are extended by classes without prefixes.