We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

Blog plugin crash website | Forum

Christophe Tricaud
Christophe Tricaud Jun 20 '20
Hello,


I was very excited to install the blogs plugin.

On my active web site when I installed it it crashes immediately:


[Sat Jun 20 14:17:46 2020] [ow_core_log] [Warning] Message: call_user_func() expects parameter 1 to be a valid callback, class 'BLOGS_CMP_BlogWidget' not found File: C:\AMPPS\www\ox15\ow_system_plugins\base\components\drag_and_drop_panel.php Line:67


However the files of the plugins seemed to be installed with succes, but th site is unable to find the right classes.


Any ideas?


I installed it on a brand new website and the installation worked perfectly!!! But when I created a new blog and got a crash with the following query:


SELECT YEAR( FROM_UNIXTIME(`timestamp`) ) as `y`, MONTH( FROM_UNIXTIME(`timestamp`) ) as `m`

FROM `ow_blogs_post` WHERE isDraft = 0 AND `authorId` = ? GROUP BY `y` DESC, `m` DESC The group by desc is deprecated so I don't know what to do in this case? I just get the last version of blogs.

Thank you for any help for these 2 problems.

I installed two plugin I bought witout any problem yesterday.

ChristopheParis, France


PS: the same with the events plugin. Strange, it seems that it does not found the classes in the files


The Forum post is edited by Christophe Tricaud Jun 20 '20
dave Leader
dave Jun 22 '20

It looks like some of the widgets may not have been added to the db.


What version of php are you running so i can test this?


look in the activate file and make sure that any widgets are actually in the table.


Here is that widget code in the activate.php file


$widget['site'] = BOL_ComponentAdminService::getInstance()->addWidget('BLOGS_CMP_BlogWidget', false);

$placeWidget = BOL_ComponentAdminService::getInstance()->addWidgetToPlace($widget['site'], BOL_ComponentAdminService::PLACE_INDEX);


so that means that this widget item should have been written to the db, if it was not then it will get error.


Here is a snapshot of TWO tables in in the database..  Make sure you have these entries, my guess is that you are missing the one entry in there. 



and here is the third table




The Forum post is edited by dave Jun 22 '20
dave Leader
dave Jun 22 '20

Regarding the depricated GROUP BY, yes implicit GROUP BY is deprecated. That means that if you are relying ONLY on GROUP BY, the results may be surprising.  So the answer per the mysql reference page is to make sure you are using GROUP BY along with a valid SORT BY as well.   That is my understanding...


https://dev.mysql.com/doc/refman/5.6/en/group-by-optimization.html



Christophe Tricaud
Christophe Tricaud Jun 22 '20
Thank you Dave for the time you spent on these problems, I really appreciate.


1/ I am running PHP 7.3 and mysql 8.0 database.

However this is not the problem for installation since I am able to install the plugin on a fresh oxwall web site, and note on my production web server.


You are right however, I have only one widget installed I must have a look on the activate.php to undrstand why only one is installed in mmy production server: maybe a


Best regards


Christophe name conflic I have to resolve.


2/ Yes I understood that I have to change the query, but this query is inside the blogs component, and I was surprise of this notation which really bad usage. I will change manually the query in the code, but this will prevent me for any upgrade.

dave Leader
dave Jun 22 '20
I will work on a resolve for that issue and modify the blog plugin, its on my list.. However, if you want to save me some time and you find a query solution, please share it so that others can know how to solve until we can get it fixed.
Christophe Tricaud
Christophe Tricaud Jun 22 '20
I will, since I asked so many time for help I will be pleased to share my work.


I was thinking of developing a free plugin to thanks everybody, just have to find the time among the lauch of my site.


Christophe

dave Leader
dave Jun 22 '20

Here is that code in the bol dao file line 310


public function findUserArchiveData( $id )
    {
        $query = "
            SELECT YEAR( FROM_UNIXTIME(`timestamp`) ) as `y`, MONTH( FROM_UNIXTIME(`timestamp`) ) as `m`
            FROM `{$this->getTableName()}`
            WHERE isDraft = 0 AND `authorId` = ?
            GROUP BY `y` DESC, `m` DESC
        ";

        return $this->dbo->queryForList($query, array($id));
    }


Now the way i understand the deprecation, we need to add a ORDER BY to this so that it is not inplicit and add the DESC to the ORDER BY


Try this and let me know if it works,  i cant duplicate the error on my site.


public function findUserArchiveData( $id )
    {
        $query = "
            SELECT YEAR( FROM_UNIXTIME(`timestamp`) ) as `y`, MONTH( FROM_UNIXTIME(`timestamp`) ) as `m`
            FROM `{$this->getTableName()}`
            WHERE isDraft = 0 AND `authorId` = ?
            GROUP BY `y`, `m`

            ORDER BY `timestamp` DESC

        ";

        return $this->dbo->queryForList($query, array($id));
    }


let me know if that works please

Christophe Tricaud
Christophe Tricaud Jun 23 '20
Hello Dave,


This will not work as the criteri inside the order by clause must be taken among the criteria of the group by criteria.


So the good query will be:


$query = "
            SELECT YEAR( FROM_UNIXTIME(`timestamp`) ) as `y`, MONTH( FROM_UNIXTIME(`timestamp`) ) as `m`
            FROM `{$this->getTableName()}`
            WHERE isDraft = 0 AND `authorId` = ?
            GROUP BY `y`, `m`

            ORDER BY `y` DESC, `m` DESC

";


This one works without any problem.


Christophe

dave Leader
dave Jun 23 '20
Thanks for sharing  ;)
Christophe Tricaud
Christophe Tricaud Jun 23 '20
Returning to the crash while installing the blogs plugin, I found, at last, that it exists an incompatibility with the anti-span, anti-bot plugin!


When I deactivate the last one I can install the blogs plugin, but if I activate it after, the web site crashes.


I will ask help from the developper of the anti span as I bought it.


Christophe

Senior Developer Leader
Senior Developer Jun 23 '20
I have many happy customers whose have this module (Anti-spam) and it is working with no issues in their website, you need PHP 5.6 to run Oxwall with no issues, my plugins are compatible with PHP 7 but the core is not fully compatible, even if you manage to make it run on the latest PHP version, some things need to be fixed and may cause unknown issues. 


I need to take a look at the logs to know what the error is, I suspect there was an error on installing your blogs plugin because of your PHP version. 


If you can send me a ftp account, it is faster to fix all issues that you may have with my plugins. If you can switch to PHP 5.6, almost all your issues will be gone.




Quote from Christophe Tricaud


[Sat Jun 20 14:17:46 2020] [ow_core_log] [Warning] Message: call_user_func() expects parameter 1 to be a valid callback, class 'BLOGS_CMP_BlogWidget' not found File: C:\AMPPS\www\ox15\ow_system_plugins\base\components\drag_and_drop_panel.php Line:67



This warning says there is a missing file in your server from the blogs plugin, I don't know if that's true or if is a false positive as I don't have ftp access to confirm.


Senior Developer.



Christophe Tricaud
Christophe Tricaud Jun 24 '20
It is really strange since I installed it again this morning with no crash.

Something seems to be not stable there, I will have to make a complete inspection.


However thanks for your help, everything seems to work properly.


Christophe,


Paris, France

dave Leader
dave Jun 27 '20
This change has been committed to the gitHub