• 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 when UPDATING images

    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 when UPDATING images

    • Issue Tools
      • View Changes
    1. issueid=4201 February 14, 2015 12:06 AM
      beernuts beernuts is offline
      Junior Member
      Database error when UPDATING images

      Users are experiencing a problem when updating images in the wiki. Not when adding new ones. The database error is:
      Code:
      Invalid SQL:
      SELECT filesize FROM `vw_attachmentfile` WHERE attachfileid =;
    Issue Details
    Issue Number 4201
    Issue Type Bug
    Project VaultWiki 4.x Series
    Category Attachments
    Status Fixed
    Priority 2 - Fatal / Database Errors
    Affected Version 4.0.1
    Fixed Version 4.0.2
    Milestone (none)
    Software DependencyAny
    License TypePaid
    Users able to reproduce bug 0
    Users unable to reproduce bug 0
    Attachments 0
    Assigned Users (none)
    Tags (none)




    1. February 14, 2015 9:28 PM
      pegasus pegasus is offline
      VaultWiki Team
      I think this happens when trying to update an attachment that was created already but there is no corresponding existing file data for it because the original upload failed and for some reason the attachment was created anyway.

      Fixed in the next release. If this case exists, the query for the existing file will be skipped. In vault/core/controller/ui/ajax/vw.php, find:
      Code:
      			$this->file = vw_DB::get()->query()->select(array(
      				'fields' => array('filesize'),
      				'table' => 'vw_attachmentfile',
      				'where' => vw_DB::get()->query()->eq('attachfileid', $this->page['attachfileid']),
      				'first' => 1
      			));
      Replace with:
      Code:
      			if (!empty($this->page['attachfileid']))
      			{
      				$this->file = vw_DB::get()->query()->select(array(
      					'fields' => array('filesize'),
      					'table' => 'vw_attachmentfile',
      					'where' => vw_DB::get()->query()->eq('attachfileid', $this->page['attachfileid']),
      					'first' => 1
      				));
      			}
      Reply Reply  
    2. February 16, 2015 11:39 AM
      beernuts beernuts is offline
      Junior Member
      So this fixed the database error, but apparently updating images still isn't working. Here is what users are reporting:

      The picture uploaded all right, I saved the page and... the picture is still not showing up. It's showing 0 bytes. How odd...
      Code:
      <upload>​
      <mime>​
      <![CDATA[image/jpeg]]>
      </mime>​
      <size>​
      <![CDATA[40.40 KB]]>
      </size>​
      <attachfileid>​
      <![CDATA[3585]]>
      </attachfileid>​
      <filehash>​
      <![CDATA[5c89a16b6be10a3315cca0b74aa4f122]]>
      </filehash>​
      <thumb-size>​
      <![CDATA[180]]>
      </thumb-size>​
      <thumb-src>​
      <![CDATA[http://wiki.site.com/wiki_asset.php?hash=5c89a16b6be10a3315cca0b74aa4f122]]>
      </thumb-src>​
      </upload>​
      The size is a little suspicious. Page preview also says the size is 40.0-kB, but my filesystem says 41-kB. Then when I save it reverts to 0.
      Reply Reply  
    3. February 17, 2015 11:14 AM
      pegasus pegasus is offline
      VaultWiki Team
      The only thing I can think of is that the DM for the new attachment-edit is failing silently when it is passed the invalid "existing" attachfileid of 0, before it receives the new correct value shown in your XML above.

      In this case, it should be possible to circumvent the failure.

      In vault/core/controller/ui/edit/attach/vw.php, find:
      Code:
      $attachdm->set($key, $value);
      Before it, add:
      Code:
      				if (
      					$key == 'attachmentid' OR
      					$key == 'attacheditid' OR
      					$key == 'attachfileid'
      				)
      				{
      					continue;
      				}
      In vault/core/controller/dm/attach/vw.php, find:
      Code:
      if ($key == 'dateline' OR $key == 'rollback' OR $editdm->_isset($key))
      Replace with:
      Code:
      if ($key == 'dateline' OR $key == 'rollback' OR $key == 'attachfileid' OR $editdm->_isset($key))
      Find:
      Code:
      			if (
      				$key == 'attacheditid' OR
      				$key == 'dateline' OR
      				$key == 'rollback' OR
      				$editdm->_isset($key)
      			)
      Replace with:
      Code:
      			if (
      				$key == 'attacheditid' OR
      				$key == 'dateline' OR
      				$key == 'rollback' OR
      				$key == 'attachfileid' OR
      				$editdm->_isset($key)
      			)
      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 11:34 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.