Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

How to properly add an additional vendor library to vanilla 2.0.3 ?

edited August 2010 in Vanilla 2.0 - 2.8
Hi, I want to plug Vanilla (2.0.3 ) to an amazon SDB user storage, I have already done it on an existing drupal website, and I used the Cloudfusion (http://getcloudfusion.com) library to achieve this.
My Idea was to add this library then code one or two plugins that use classes of this library.
I have read the docs and the code of bootstrap.php and I already tried the following :

1) I simply put the cloudfusion/ dir inside library/vendors, with a working config.inc.php file and hope that there would be some magic around the vendors dir and class creation after bootstrap of the framework that would allow me to use for example
$sdb = new AmazonSDB();
In my plugin => fail (I was expecting that :p ) !

2) I created a bootstrap.after.php after reading the bootstrap.php code and put it in the conf/ dir. the content of this file was
<?php require_once(PATH_ROOT.DS.'library'.DS.'vendors'.DS.'cloudfusion'.DS.'cloudfusion.class.php');
it fails too but seems strange : by doing so I got the "bonk" page and then debug it to have a better idea of the error.
the reason of the bonk was The "DiscussionModel" class could not be found.

Any suggestions ?


Thanks in advance for your help


David

Comments

  • Fixed !

    The problem is that Vanilla use an __autoload method (as already reported here : http://vanillaforums.org/discussion/10459).
    So in my plugin I had to first register your __autoload method on the stack before including cloudfusion which include his autloader with a spl_autoload_register.

    so the code in my plugin is finally :

    spl_autoload_register('__autoload'); require_once('vendors/cloudfusion/cloudfusion.class.php');

    And now i can use Cloudfusion new classes every where in a plugin code :)
Sign In or Register to comment.