In-Portal Issue Tracker

Welcome to the In-Portal Open Source CMS Issue Tracker! This is a central management / tracking tool for all types of tasks / issues / bugs for the In-Portal Project. Before reporting any issues, please make sure to read the Guide into Issue Tracker and How to Properly Test and Report Bugs!

Viewing Issue Advanced Details Jump to Notes ] Wiki ]  Related Changesets ] View Simple ] Issue History ] Print ]
ID Category Type Reproducibility Date Submitted Last Update
0001142 [In-Portal CMS] Data Management bug report always 2011-10-17 05:05 2012-07-25 05:32
Reporter phil View Status public Project Name In-Portal CMS
Assigned To alex Developer
Priority normal Resolution fixed Platform
Status closed   OS
  OS Version
ETA none Fixed in Version 5.2.0-B1 Product Version 5.1.0
  Target Version 5.2.0 Product Build
Time EstimateNo estimate
Summary 0001142: Images are deleted during link approval process
Description There are 2 category permissions:
* LINK.OWNER.MODIFY - changes, user makes to it's link are immediately seen on Front-End
* LINK.OWNER.MODIFY.PENDING - changes, user makes to it's link are stored in another link record for admin to approve/decline

When user has LINK.OWNER.MODIFY permission it works, like a charm. However, there are a problems in creating a link, that contains all changes made by user.

All files are copied normally. Images are also copied on disk (e.g. image_one.jpg will be copied to image_one_1.jpg), but original image filename stays in link record.

This way approving a link will delete all it's images from disk keeping broken records in Images table.


Since images are copied at least, then I suppose it's working partially. Then we need to ensure, that copied image filenames are put back into Images table record associated with the link, that will hold all modifications.


What to fix:
============
1. Place approved link ResourceId into Listings db table (link enhancements) & Relationship db table (link relationships) instead of original link (link before change) ResourceId (remember ResourceId before deleting original link).

2. make sure, that copied image filenames are listed in "link to be approved" database record (instead of original link image filenames).

3. remove "_1" (or any "_[\d]+$") from approved link image filenames (when this way fixed filename won't match to any existing filename in same folder), once link was approved.
Steps To Reproduce
Additional Information Another small problem here - such links (that needed to be approved) have broken icon in catalog. They should have Pending icon I suppose.
Tags No tags attached.
Reference https://groups.google.com/d/topic/in-portal-bugs/yzlo09tGZ7k/discussion
Change Log Message Fixed image delete on link approve (when LINK.OWNER.MODIFY.PENDING permission was used)
Estimate Points 2
Attached Files patch file icon link_approve_removes_wrong_images.patch [^] (2,687 bytes) 2011-12-15 07:24 [Show Content]
patch file icon link_approval_core_1142.patch [^] (1,988 bytes) 2011-12-20 11:11 [Show Content]
patch file icon link_approval_modules_1142.patch [^] (2,337 bytes) 2011-12-20 11:11 [Show Content]
patch file icon advanced_unique_filename_check.patch [^] (1,618 bytes) 2011-12-21 08:21 [Show Content]
patch file icon pending_link_approval_core_v2.patch [^] (1,883 bytes) 2011-12-21 09:17 [Show Content]
patch file icon pending_link_approval_modules_v2.patch [^] (8,765 bytes) 2011-12-21 09:17 [Show Content]

- Relationships Relation Graph ] Dependency Graph ]
parent of 0001369active (Icebox) Images are deleted during link approval process (flash uploader fix) 
Not all the children of this issue are yet resolved or closed.

-  Notes
User avatar (0004261)
alex (manager)
2011-12-15 07:24

Patch "link_approve_removes_wrong_images.patch" only fixed problem #2
User avatar (0004279)
alex (manager)
2011-12-20 02:34

Plan:

1:
- there is a special event OnBeforeDeleteOriginal, that is called before original link is deleted and and link containing changes is made active
- use this event to get LinkId/ResourceId from original link
- update Listings.ItemResourceId field with new link resource id, where it's equals to old link resource id
- update Relationship.SourceId and Relationship.TargetId field with new link resource id, where it's equals to old link resource id and SourceType/TargetType is equals to link's item type (from unit config)

2:
- now when you already have "name.jpg" on disk and you try to upload "name.jpg" then it's get converted to "name_1.jpg"
- when you try to upload "name_1.jpg" then it's get converted to "name_1_1.jpg", but it should to "name_2.jpg"
- use concept code from NameCopy method and apply it to ensureUniqueFilename method (find trailing _[\d]+$ and increment it or add "_1")
User avatar (0004285)
erik (manager)
2011-12-20 11:12

Made changes by plan from note 0004279. Patches attached - needs testing.
User avatar (0004292)
alex (manager)
2011-12-21 09:20

1. incorrect new method scope (private instead of protected)
2. method scope not specified in PHPDoc comment of methods
3. relations from other category items to link being approved were missing after approving link with pending changes
3. ensureUniqueFilename wasn't changed based on NameCopy methods as was advised

All listed above issues were fixed in last 3 uploaded patches.
User avatar (0004293)
alex (manager)
2011-12-21 09:21

Fix committed to 5.2.x branch. Commit Message:

Fixes 0001142: Images are deleted during link approval process
User avatar (0005021)
alex (manager)
2012-07-25 05:32

Since 5.2.0 version was released.

- Related Changesets
In-Portal CMS: 5.2.x r14898
Timestamp: 2011-12-21 09:21:30
Author: alex
Details ] Diff ]
Fixes 0001142: Images are deleted during link approval process
mod - /in-portal/branches/5.2.x/core/kernel/db/cat_dbitem.php Diff ] File ]
mod - /in-portal/branches/5.2.x/core/kernel/db/cat_event_handler.php Diff ] File ]
Modules :: In-Link: 5.2.x r14897
Timestamp: 2011-12-21 09:21:13
Author: alex
Details ] Diff ]
Bug 0001142: Images are deleted during link approval process
mod - /modules/in-link/branches/5.2.x/units/links/links_event_handler.php Diff ] File ]
In-Portal CMS: 5.2.x r14896
Timestamp: 2011-12-21 08:25:41
Author: alex
Details ] Diff ]
Bug 0001142: Images are deleted during link approval process
1. on duplicate filename upload name increment last number after "_" if filename instead of adding "_1" again
mod - /in-portal/branches/5.2.x/core/units/helpers/file_helper.php Diff ] File ]

- Issue History
Date Modified Username Field Change
2012-07-25 05:32 alex Note Added: 0005021
2012-07-25 05:32 alex Status resolved => closed
2012-07-23 08:48 alex Relationship added parent of 0001369
2011-12-21 09:21 alex Note Added: 0004293
2011-12-21 09:21 alex Status reviewed and tested => resolved
2011-12-21 09:21 alex Fixed in Version => 5.2.0-B1
2011-12-21 09:21 alex Resolution open => fixed
2011-12-21 09:21 alex Assigned To !COMMUNITY => alex
2011-12-21 09:21 alex Changeset attached 5.2.x r14898
2011-12-21 09:21 alex Changeset attached 5.2.x r14897
2011-12-21 09:20 alex Note Added: 0004292
2011-12-21 09:20 alex Assigned To alex => !COMMUNITY
2011-12-21 09:20 alex Status needs testing => reviewed and tested
2011-12-21 09:17 alex File Added: pending_link_approval_modules_v2.patch
2011-12-21 09:17 alex File Added: pending_link_approval_core_v2.patch
2011-12-21 08:25 alex Changeset attached 5.2.x r14896
2011-12-21 08:21 alex File Added: advanced_unique_filename_check.patch
2011-12-20 11:12 erik Time Estimate Removed 2 =>
2011-12-20 11:12 erik Note Added: 0004285
2011-12-20 11:12 erik Assigned To erik => alex
2011-12-20 11:12 erik Developer => erik
2011-12-20 11:12 erik Status needs work => needs testing
2011-12-20 11:11 erik File Added: link_approval_modules_1142.patch
2011-12-20 11:11 erik File Added: link_approval_core_1142.patch
2011-12-20 02:34 alex Note Added: 0004279
2011-12-18 23:33 Dmitry Assigned To => erik
2011-12-18 23:33 Dmitry Status active => needs work
2011-12-18 14:59 alex Time Estimate Added 2
2011-12-15 07:24 alex Note Added: 0004261
2011-12-15 07:24 alex File Added: link_approve_removes_wrong_images.patch
2011-12-15 07:23 alex Estimate Points => 2
2011-12-15 07:23 alex Target Version 5.1.4 => 5.2.0
2011-10-17 05:05 alex Reporter alex => phil
2011-10-17 05:05 alex New Issue
2011-10-17 05:05 alex Reference => https://groups.google.com/d/topic/in-portal-bugs/yzlo09tGZ7k/discussion
2011-10-17 05:05 alex Change Log Message => Fixed image delete on link approve (when LINK.OWNER.MODIFY.PENDING permission was used)



Web Development by Intechnic
In-Portal Open Source CMS
In-Portal Open Source CMS
Copyright © 2000 - 2009 MantisBT Group

Powered by Mantis Bugtracker