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.

Making YAGA work in 2.3rc

I'm trying to fix some issues with YAGA in 2.3rc2, mainly, some notice errors that are showing up when debug is enabled. See an example below:

Declaration of ActionModel::Get() should be compatible with Gdn_Model::get($OrderFields = '', $OrderDirection = 'asc', $Limit = false, $PageNumber = false)

#0 /var/www/html/community/library/core/class.autoloader.php(288): Gdn_ErrorHandler(2, 'Declaration of ...', '/var/www/html/c...', 0, Array)
#1 /var/www/html/community/library/core/class.autoloader.php(288): include_once()
#2 [internal function]: Gdn_Autoloader::lookup('ActionModel')
#3 [internal function]: spl_autoload_call('ActionModel')
#4 /var/www/html/community/library/core/class.controller.php(936): class_exists('ActionModel')
#5 /var/www/html/community/library/core/class.dispatcher.php(239): Gdn_Controller->getImports()
#6 /var/www/html/community/index.php(44): Gdn_Dispatcher->dispatch()
#7 {main}

There are lots of similar notice errors shown. "Declaration of .... should be compatible with Gdn_Model..."

Am I right in thinking that ActionModel::Get() should be the same in it's arguments as Gdn_Model::get($OrderFields.. etc.)?

So for example, ActionModel should be adjusted to ActionModel::Get($OrderFields = '', $OrderDirection = 'asc', $Limit = false, $PageNumber = false)?

Comments

  • I just noticed the Addon doesn't work at all and breaks the site upon various actions. Will probably take a lot more work to fix than I anticipated. From what I can tell from my (poor) understanding of Vanilla, they have updated their Database handler in 2.3, which is incompatible with the latest version of YAGA.

  • R_JR_J Ex-Fanboy Munich Admin

    I would suggest you report your findings here: https://github.com/hgtonight/Application-Yaga/issues

    Maybe you can help fixing some of them (when trying to help, you should work with the newest version you can download from GitHub)

  • LincLinc Detroit Admin
    edited November 2016

    This is not a change in Vanilla, it's a change in PHP7's handing of class compatibility. Whereas it used to produce E_STRICT it now produces E_WARNING when you extend a class and re-declare a method without having the signature stay compatible.

  • @Linc said:
    This is not a change in Vanilla, it's a change in PHP7's handing of class compatibility. Whereas it used to produce E_STRICT it now produces E_WARNING when you extend a class and re-declare a method without having the signature stay compatible.

    Does this mean that I can safely ignore these notice errors? I assumed they were the cause of YAGA not working in 2.3rc2.

  • LincLinc Detroit Admin
    edited November 2016

    Theoretically any warning can be ignored. That said, @hgtonight should probably take a look soon if he can.

    It'd be a bit of careful work to repair, but the changes we had to make to accommodate it in core were fairly limited.

  • R_JR_J Ex-Fanboy Munich Admin

    @Linc: I had a quick look on Vanillas models and the DiscussionModel seems to have different parameters in its get() method. I would assume changing that would mean a lot of troubles.

  • I actually got it to work 100% (as far as I know) by doing some fairly basic stuff. In fact, the issue might just have been with my database, but I can't say for sure.

    One error I ran into is that YAGA was trying to save an invalid datetime format into my database. date(DATE_ISO8601).

    A simple search and replace fixed that issue for me. Search: DATE_ISO8601, replace with 'Y-m-d H:i:s'.

    The other issue I ran into had something to do with the MySQL database setting ONLY_FULL_GROUP_BY. In phpMyAdmin I ran the following query on my Vanilla database. SET sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY','')), and everything I've tested so far works.

  • SwennetSwennet New
    edited November 2016

    @R_J said:
    I would suggest you report your findings here: https://github.com/hgtonight/Application-Yaga/issues

    Maybe you can help fixing some of them (when trying to help, you should work with the newest version you can download from GitHub)

    Sorry for my inexperience with GitHub, but I noticed there are 4 open Pull Requests. Should I apply these on top of the "Develop" branch? Apparently my previous "solution" had been done, better, by someone else already :p

  • R_JR_J Ex-Fanboy Munich Admin

    You are right, I haven't seen that there is already a pull request for the model! I don't think there is anything left to do concerning this. By the way: I think the pull requests shows quite good the advantages of reusable code when sticking to conventions.

    You also had problems with the date format and some MySql setting.

    I think that the way the date is formatted in YAGA can be improved. Look through the Vanilla code how the DateInserted field is filled:
    it is always done with Gdn_Format::toDateTime();
    So you could think about doing a pull request for that. It is always great to see new supporters!

    I've only done a very short look at it, but ONLY_FULL_GROUP_BY seems to be the default for MySQL and it didn't worked for you? Then I'd say you should definitely file an issue on GitHub!

    I do not have much experience with GitHub myself, so I'm not the best advisor, but the experience I've made by now were all positive: giving feedback is never wrong ;)

  • When I'm going to create an emblem, Alvo é requerido.
    Comparison é requerido.

  • When will I register Badge This error:

    **
    Target is required.
    Comparison is required.

  • vanilla 2.3

  • @daemoncesar

    You can fix this by editing /applications/yaga/controllers/class.badgecontroller.php

    Find this block of code:

          // Find the rule criteria
          $FormValues = $this->Form->FormValues();     
          $Criteria = array();
          foreach($FormValues as $Key => $Value) {
            if(substr($Key, 0, 7) == '_Rules/') {
              $RealKey = substr($Key, 7);
              $Criteria[$RealKey] = $Value;
            }
          }
    

    Replace with this (just comments out unnecessary lines)

          // Find the rule criteria
          $FormValues = $this->Form->FormValues();            
          $Criteria = array();
          foreach($FormValues as $Key => $Value) {
            //if(substr($Key, 0, 7) == '_Rules/') {
              $Criteria[$Key] = $Value;
            //}
          }
    
  • RiverRiver MVP
    edited December 2016

    @daemoncesar said:
    When will I register Badge This error:

    **
    Target is required.
    Comparison is required

    https://vanillaforums.org/discussion/comment/244774/#Comment_244774

    just aligning the stars just right.

    Pragmatism is all I have to offer. Avoiding the sidelines and providing centerline pro-tips.

Sign In or Register to comment.