[8WR] XenCarta (Wiki) PRO

[8WR] XenCarta (Wiki) PRO [Paid] 1.4.8a

No permission to buy ($30.00)

Cheesegrits

Active member
OK, I'm completely wedged. No matter how I try to upgrade, as soon as I upload the new files, even with the addon disabled, the next page load errors out with that "Cannot declare class XFCP_EWRcarta_Model_Post". I don't even get a chance to run the XML.

Help?

-- hugh
 

Cheesegrits

Active member
OK, I finally got some time to throw xdebug at this, and the problem is in ...

library/EWRcarta/Listener/Model.php

... which always adds EWRcarta_Model_Post to $extend, regardless, so when some other addon (in my case Widget Framework) tries to do a XenForo_Model::create($class) on it's own class, XF fires load_class_model, and EWCarta adds itself to $extend.

Looks like you need to wrap those listener in a condition that only adds it when necessary.

For instance, if I look at the way bdTagMe does it ...

PHP:
    public static function load_class($class, array &$extend)
    {
        // load_class_datawriter is still kept separated to do legacy support
        // I don't want to break people's site when this upgrade this add-on
        static $classes = array(
            'XenForo_BbCode_Formatter_Base',
            'XenForo_BbCode_Formatter_HtmlEmail',
            'XenForo_BbCode_Formatter_Text',

            'XenForo_ControllerAdmin_UserGroup',
            'XenForo_ControllerPublic_Account',
            'XenForo_ControllerPublic_Member',

            'XenForo_DataWriter_DiscussionMessage_Post',
            'XenForo_DataWriter_DiscussionMessage_ProfilePost',
            'XenForo_DataWriter_ProfilePostComment',
            'XenForo_DataWriter_User',
            'XenForo_DataWriter_UserGroup',

            'XenForo_Model_Alert',
            'XenForo_Model_ForumWatch',
            'XenForo_Model_User',
            'XenForo_Model_UserTagging',

            'XenForo_Route_Prefix_Members',
        );

        if (in_array($class, $classes)) {
            $extend[] = 'bdTagMe_' . $class;
        }
    }

-- hugh
 

Cheesegrits

Active member
This seems to fix it:

PHP:
<?php

class EWRcarta_Listener_Model
{
    public static function post($class, array &$extend)
    {
        if ($class === 'XenForo_Model_Post') {
            // XenForo_Model_Post
            $extend[] = 'EWRcarta_Model_Post';
        }
    }
    
    public static function user($class, array &$extend)
    {
        if ($class === 'XenForo_Model_User') {
            // XenForo_Model_User
            $extend[] = 'EWRcarta_Model_User';
        }
    }
}

-- hugh
 

Jaxel

Well-known member
This seems to fix it:

PHP:
<?php

class EWRcarta_Listener_Model
{
    public static function post($class, array &$extend)
    {
        if ($class === 'XenForo_Model_Post') {
            // XenForo_Model_Post
            $extend[] = 'EWRcarta_Model_Post';
        }
    }
   
    public static function user($class, array &$extend)
    {
        if ($class === 'XenForo_Model_User') {
            // XenForo_Model_User
            $extend[] = 'EWRcarta_Model_User';
        }
    }
}

-- hugh
What version of XenForo are you running? This is already handled with the built in extension system using "hints"; which was added in later versions of XenForo. This is probably why you are the only person having this issue... because your XenForo is out of date.
 

Cheesegrits

Active member
Well yeah, the hints are there in the new XML, but the problem was a Catch 22 with running that XML. As I said in a previous post, the problem was applying the XML after uploading the files. As soon as I tried to update it (or do anything, front or backend), it errored out, because the hints weren't present in the version I was updating from, and something was causing the Post listener to run. I can't replicate it now (without reverting), but it's no doubt some addon I'm running that nobody else running XenCarta is.

But it looks like that's why (for example) the bdTagMe code still has those conditions. The comment:

// I don't want to break people's site when this upgrade this add-on

... would seem to indicate that this is not an isolated problem.

My suggestion would be to keep those conditions in the code during the transition to hints, just as "belt and braces". Won't hurt, and will prevent anyone else having this issue.

-- hugh
 

Gomez

Member
Anyone know if you can use xenforo variables in pages? Say for example to determine what groups a user belongs to? I'm trying to make public and private pages.
 

Floyd R Turbo

Well-known member
Well I just came across this one and I have to wonder, is it worth getting this now and then porting over to the XF2 version when that comes out, or should I just wait for the XF2 version?

I would venture to guess that there would be an XF1>2 importer of sorts?

Is there expected to be additional cost for the XF2 version outright (cost increase) or a version-bump charge (for upgrading from XF1 version to XF2 version)?

Same question goes for all your addons @Jaxel, I have a couple XenPorta2 copies as well as XenAtendo. Good to hear though that you do plan on updating all your addons :)
 

Zelkova

Member
Hi @Jaxel ,

I'm sure you probably don't want to deal with 1.x bugs anymore, however I'm hoping that you might help with this small one.

I recently upgraded to PHP 7.1 and am encountering a bug with the history function. Upon clicking the history button on a public facing page, I get this error.


I was wondering if there was a quick and simple fix I could put in place for it? I would be ok with just modifying my personal files if thats all the support you can provide.
 

dehness

Well-known member
@Jaxel I don't mean to sound impatient, but are you planning to update this for XF2 or has this add-on been abandoned on the new platform?

I see you already updated most of your add-ons a few weeks ago, I just wonder if you actually plan to update this for XF2, or if I should look elsewhere.
 
Top