• Register
    • Help

    striker  0 Items
    Currently Supporting
    • Home
    • News
    • Forum
    • Wiki
    • Support
      • Manage Subscriptions
      • FAQ
      • Support For
        • VaultWiki 4.x Series
        • VaultWiki.org Site
    • What's New?
    • Buy Now
    • Manual
    • 
    • Support
    • VaultWiki 4.x Series
    • Bug
    • Database Error thrown related to Xenforo alerts

    1. Welcome to VaultWiki.org, home of the wiki add-on for vBulletin and XenForo!

      VaultWiki allows your existing forum users to collaborate on creating and managing a site's content pages. VaultWiki is a fully-featured and fully-supported wiki solution for vBulletin and XenForo.

      The VaultWiki Team encourages you to join our community of forum administrators and check out VaultWiki for yourself.

    Issue: Database Error thrown related to Xenforo alerts

    • Issue Tools
      • View Changes
    1. issueid=4931 March 1, 2017 9:17 AM
      ACL ACL is offline
      Regular Member
      Database Error thrown related to Xenforo alerts

      The following database error was generated by a moderator who logged into a test forum for the first time (the account has been imported from an SMF installation). I'm guessing they opened the alerts popup where they would have received xenforo trophies for imported posts.

      Code:
      XenForo_Exception: Database Error: SELECT userid FROM `vw_ping` WHERE userid = 9 AND < dateline GROUP BY pingtype Mysqli prepare error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '< dateline GROUP BY pingtype' at line 1 - vault/core/controller/db/xf.php:173
      Generated By: MODERATOR_NAME, Tuesday at 12:44 AM
      I'm not sure if this is related to issue 4904 as both are related to alerts. I did apply the file edit fix supplied in that bug report.

      Code:
      #0 /home/user/public_html/vault/core/controller/db/xf.php(212): vw_DB_Controller_XF->throw_error(Object(Zend_Db_Statement_Mysqli_Exception), 'SELECT userid F...')
      #1 /home/user/public_html/vault/core/model/db/mysql/vw.php(27): vw_DB_Controller_XF->query_read_slave('SELECT userid F...')
      #2 /home/user/public_html/library/vw/XenForo/Model/Alert.php(68): vw_DB_MySQL_Model->select(Array)
      #3 /home/user/public_html/library/XenForo/ControllerPublic/Account.php(50): vw_XenForo_Model_Alert->countAlertsForUser(9)
      #4 /home/user/public_html/library/XenForo/FrontController.php(351): XenForo_ControllerPublic_Account->actionAlerts()
      #5 /home/user/public_html/library/XenForo/FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
      #6 /home/user/public_html/index.php(13): XenForo_FrontController->run()
      #7 {main}
      Code:
      array(3) {
        ["url"] => string(55) "https://path/to/account/alerts"
        ["_GET"] => array(0) {
        }
        ["_POST"] => array(0) {
        }
      }
    Issue Details
    Issue Number 4931
    Issue Type Bug
    Project VaultWiki 4.x Series
    Category User Alerts / Likes
    Status Fixed
    Priority 1 - Security / Login / Data Loss
    Affected Version 4.0.16
    Fixed Version 4.0.17
    Milestone (none)
    Software DependencyXenForo 1.x
    License TypePaid
    Users able to reproduce bug 0
    Users unable to reproduce bug 0
    Attachments 0
    Assigned Users (none)
    Tags (none)




    1. March 1, 2017 10:02 AM
      pegasus pegasus is offline
      VaultWiki Team
      By any chance, does this reflect the user's history:

      1. The admin installed VaultWiki.
      2. The admin disabled the VaultWiki add-on.
      3. The user with this problem was created / registered.
      4. The admin re-enabled the VaultWiki add-on.

      You can work around the database error by editing library/vw/XenForo/Model/Alert.php. Find:
      Code:
      $viewtime = vw_Hard_Core::model('User')->get('vw_lastalerttime');
      Replace with:
      Code:
      $viewtime = intval(vw_Hard_Core::model('User')->get('vw_lastalerttime'));
      However, this scenario (if steps 1-4 occurred) reveals a security vulnerability (inability to change moderator notification preferences for such users), which needs to be patched before April 1.
      Reply Reply  
    2. March 1, 2017 12:58 PM
      ACL ACL is offline
      Regular Member
      No the above is not how I came to this database error. I've been following the Xenforo importing guide which basically involves:

      1. Installing Xenforo and configuring settings and basic permissions
      2. Installing themes and addons (enabled) and configuring them
      3. Creating a database backup (so Xenforo can be reverted to a pre-import clean stage without duplicate records)
      4. Running the official external data import tool (for SMF -> Xenforo)
      5. Reconfiguring usergroup permissions that were altered incorrectly by Xenforo import script
      6. Proceeding with importing MediaWiki data into VaultWiki with the included wiki importing tool
      7. Allowing a small group of users access to the test forum (including some moderators)
      8. As needed, reverting to pre-import phase to upgrade Xenforo addons, tweak templates or perform anything else and repeating steps 4-8 until everything is at a point where the pre-import test forum can be rolled/copied over to a public/production instance.


      This database error occurs during step 7 in the above list since that is when a group of users are able to log in to the Xenforo system. Their accounts are migrated from SMF at step 4.
      Reply Reply  
    3. March 1, 2017 2:41 PM
      pegasus pegasus is offline
      VaultWiki Team
      I wonder then if you have another add-on installed that is extending XenForo_DataWriter_User::_postSave incorrectly, such that the VaultWiki code (along with a bunch of XenForo code), which creates wiki setting entries for newly created users, is never executed.

      Can you PM a list of the add-ons you use?
      Reply Reply  
    4. March 4, 2017 11:51 AM
      pegasus pegasus is offline
      VaultWiki Team
      While this will not prevent any errors due to the missing entries, it should resolve the security vulnerability that the missing entries create (a Subscription Management Flaw). In vault/core/controller/ui/watch/vw.php, find:
      Code:
      		vw_DB::get()->query()->update(array(
      			'table' => 'vw_usercount',
      			'set' => array(
      				'vw_options' => "'" . vw_DB::get()->func()->escape_string($options) . "'"
      			),
      			'where' => vw_DB::get()->query()->eq('userid', $userid),
      			'limit' => 1
      		));
      Replace with:
      Code:
      		vw_DB::get()->query()->replace(array(
      			'table' => 'vw_usercount',
      			'values' => array(
      				array(
      					'userid' => $userid,
      					'vw_options' => "'" . vw_DB::get()->func()->escape_string($options) . "'"
      				)
      			),
      			'duplicate' => array('userid')
      		));
      Reply Reply  
    5. March 4, 2017 3:02 PM
      pegasus pegasus is offline
      VaultWiki Team
      I have confirmed that this was related to the importer in your case. Making a workaround for the importer in the next release. Additionally, the disable->register->reenable scenario will also be fixed in the next release.
      Reply Reply  
    6. March 8, 2017 7:33 AM
      ACL ACL is offline
      Regular Member
      Nice one, pegasus!

      Is this issue occuring specifically with SMF-based forums or is it occuring no matter what the origin/source forum is that is imported via Xenforo's external data import tool?

      Now that this issue has been marked as fixed, would this be released under 4.0.17 Patch Level 1? Or would that be a 'build 002' of 4.0.17 or even 4.0.18? Just wanting to gauge possible timeframes as I will have a live forum that I need to migrate before I can roll out VaultWiki publically. Thanks for the info.
      Reply Reply  
    7. March 8, 2017 9:09 AM
      pegasus pegasus is offline
      VaultWiki Team
      The importer workaround will be released in build 002. It occurred regardless of the software-base of the source forum. The registration-while-disabled fix will be released in 4.0.18.
      Reply Reply  
    + Reply

    Assigned Users
    Loading Please Wait
    Tags
    Loading Please Wait
    • Contact Us
    • License Agreement
    • Privacy
    • Terms
    • Top
    All times are GMT -4. The time now is 4:52 AM.
    This site uses cookies to help personalize content, to tailor your experience, and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Learn more… Accept Remind me later
  • striker
    Powered by vBulletin® Version 4.2.5 Beta 2
    Copyright © 2025 vBulletin Solutions Inc. All rights reserved.
    Search Engine Optimisation provided by DragonByte SEO (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
    Copyright © 2008 - 2024 VaultWiki Team, Cracked Egg Studios, LLC.