Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Say we have product p0001 that we want to append 2 pages from products p0002 and p0003
- This is resources of p0001
- [res00001] => Array
- (
- [prodId] => p0001
- [fqfn] => html/page001.html
- [mimeType] => text/html
- [label] => page_001
- [s3Obj] => ....html
- [id] => res00001
- [url] => https://....
- )
- This is resources of p0002
- [res00002] => Array
- (
- [prodId] => p0002
- [fqfn] => html/page001.html
- [mimeType] => text/html
- [label] => page_001
- [s3Obj] => ....html
- [id] => res00002
- [url] => https://....
- )
- This is resources of p0003
- [res00003] => Array
- (
- [prodId] => p0003
- [fqfn] => html/page001.html
- [mimeType] => text/html
- [label] => page_001
- [s3Obj] => ....html
- [id] => res00003
- [url] => https://....
- )
- Pages json of `p001` look like this
- "pages": [
- {
- "id": "page001",
- "title": "page_001",
- "html": {
- "id": "page001_html",
- "cont": "html\/page001.html"
- }
- }
- We now copyResources of p0002 and p0003 to p0001
- All prodIds get overriden by `p0001` value
- So we get following resource list for p0001
- [res00001] => Array
- (
- [prodId] => p0001
- [fqfn] => html/page001.html
- [mimeType] => text/html
- [label] => page_001
- [s3Obj] => ....html
- [id] => res00001
- [url] => https://....
- )
- [res00005] => Array
- (
- [prodId] => p0001
- [fqfn] => html/page001.html
- [mimeType] => text/html
- [label] => page_001
- [s3Obj] => ....html
- [id] => res00005
- [url] => https://....
- )
- This is resources of p0003
- [res00006] => Array
- (
- [prodId] => p0001
- [fqfn] => html/page001.html
- [mimeType] => text/html
- [label] => page_001
- [s3Obj] => ....html
- [id] => res00006
- [url] => https://....
- )
- And json for pages is
- "pages": [
- {
- "id": "page001",
- "title": "page_001",
- "html": {
- "id": "page001_html",
- "cont": "html\/page001.html"
- }
- } {
- "id": "clone_1",
- "title": "page_001",
- "html": {
- "id": "page001_html",
- "cont": "html\/page001.html"
- }
- } {
- "id": "clone_2",
- "title": "page_001",
- "html": {
- "id": "page001_html",
- "cont": "html\/page001.html"
- }
- }
- And this is a simple issue. Actually colliding resources can be references from .html bodies, not just from TOC json
- So what I'm changing
- 1. when I drop a page from different product, I remember where page comes from, so pages json becomes like that:
- "pages": [
- {
- "id": "page001",
- "title": "page_001",
- "html": {
- "id": "page001_html",
- "cont": "html\/page001.html"
- },
- productId: p0001,
- vcode: X0001
- } {
- "id": "clone_1",
- "title": "page_001",
- "html": {
- "id": "page001_html",
- "cont": "html\/page001.html"
- }
- productId: p0002,
- vcode: X0002
- } {
- "id": "clone_2",
- "title": "page_001",
- "html": {
- "id": "page001_html",
- "cont": "html\/page001.html"
- }
- productId: p0002,
- vcode: X0002
- }
- But resource list is still bad
- So when I do 'please clone r0002 of product p0002 to p0001' I do:
- 1. Clone resource to new id, say r0005, set it's prodId = p0001
- 2 (NEW STEP) Add field to r0005 originalProdId = p0002
- Now I have following resource list for p0001
- [res00001] => Array
- (
- [prodId] => p0001
- [fqfn] => html/page001.html
- [mimeType] => text/html
- [label] => page_001
- [s3Obj] => ....html
- [id] => res00001
- [url] => https://....
- )
- [res00005] => Array
- (
- [prodId] => p0001
- [originalProdId] => p0002
- [fqfn] => html/page001.html
- [mimeType] => text/html
- [label] => page_001
- [s3Obj] => ....html
- [id] => res00005
- [url] => https://....
- )
- This is resources of p0003
- [res00006] => Array
- (
- [prodId] => p0001
- [originalProdId] => p0003
- [fqfn] => html/page001.html
- [mimeType] => text/html
- [label] => page_001
- [s3Obj] => ....html
- [id] => res00006
- [url] => https://....
- )
- And I can easily identify what goes where
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement