Skip to content

[4.0] Fixing Articles batch copy#26835

Merged
wilsonge merged 10 commits intojoomla:4.0-devfrom
infograf768:4.0_batch_copy_article
Nov 14, 2019
Merged

[4.0] Fixing Articles batch copy#26835
wilsonge merged 10 commits intojoomla:4.0-devfrom
infograf768:4.0_batch_copy_article

Conversation

@infograf768
Copy link
Copy Markdown
Member

@infograf768 infograf768 commented Oct 27, 2019

Summary of Changes

Adapting code to the new columns featured_up and featured_down

Testing Instructions

Select a featured or a non-featured article and batch copy it to another category.

Before patch

Fails

After patch

All is fine

Documentation Changes Required

@alikon
Copy link
Copy Markdown
Contributor

alikon commented Oct 27, 2019

article copy to another category don't work, even with non featured article
and i'm testing with mysql

@richard67
Copy link
Copy Markdown
Member

richard67 commented Oct 27, 2019

Yes, just tested: With this PR the error goes away and success message is shown, but then I can't see any copied article.
Update: Can't see because it doesn't exist. Copying failed.

@alikon
Copy link
Copy Markdown
Contributor

alikon commented Oct 27, 2019

even if the article is present in the #__content table
maybe workflow ???

@richard67
Copy link
Copy Markdown
Member

Yes, in DB they exist, the copied ones have state=0. But then I set filter to show also trashed items I don't see them.

@richard67
Copy link
Copy Markdown
Member

No PHP warning or notice or error, nothing in MySQL log.

@brianteeman
Copy link
Copy Markdown
Contributor

almost certainly workflow related.

@richard67
Copy link
Copy Markdown
Member

You can strike through the "almost" I would say.

@brianteeman
Copy link
Copy Markdown
Contributor

i was being polite

@alikon
Copy link
Copy Markdown
Contributor

alikon commented Oct 27, 2019

politically incorrect comment "i hate workflow" 😄

@richard67
Copy link
Copy Markdown
Member

Question is how we shall coninue with this PR here? It fixes the error "1136 Column count doesn't match value count at row 1" when batch copying a featured article. The general problem we've discovered here, should that be handled in a separate issue?

@alikon
Copy link
Copy Markdown
Contributor

alikon commented Oct 27, 2019

pr itself is correct imho
anyway the copy issue is workflow related
Screenshot from 2019-10-27 09-36-19

@infograf768
Copy link
Copy Markdown
Member Author

The general problem we've discovered here, should that be handled in a separate issue?

We can separate if we merge this fast. Otherwise It can be closed and included in the full patch.

@richard67
Copy link
Copy Markdown
Member

I have tested this item ✅ successfully on 22a19e7

Fixes the error "1136 Column count doesn't match value count at row 1" when batch copying a featured article.

Other problems with batch processing are out of scope of this PR.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/26835.

@infograf768 infograf768 changed the title [4.0] Fixing Featured Articles batch copy [4.0] Fixing Featured Articles batch copy (featured aspects) Oct 27, 2019
@infograf768
Copy link
Copy Markdown
Member Author

Modified title to fit.

@richard67
Copy link
Copy Markdown
Member

@alikon My query shows an additional condition:

WHERE ws.condition IN (:preparedArray1,:preparedArray2) AND wa.extension='com_content'

Could this one be the problem? Unfortunately we don't see values of prepared statements in debug.

$query = $db->getQuery(true)
->insert($db->quoteName('#__content_frontpage'))
->values($newId . ', 0');
->values($newId . ', 0, NULL, NULL');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should be dates from copied article.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure. Dates have to fit to copied state. If featured flag is reset, too, and status, then also these have to be reset. It needs to check what the '0' nefore these values is, but I don't see the columns list here.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alikon Check the file ... an insert without a columns list ... that's a kind of lotto play. Am I right, or do I miss something?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't get you

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alikon When i do an insert statement, i have a columns list, so it reads "INSERT INTO blabla_table (col1, col2, col3) VALUES (1,2,3);". Here in this statement I don't see that columns list, only something wihc result in "INSERT INTO blabla_table VALUES (1,2,3);"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Legit but not safe in case of schema changes

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's another story... you'll allways have to do things carefully when a schema change happen, even with the full column name syntax...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SharkyKZ I think you are right, but for this I think it needs to move up lines 96 $oldItem = $this->getTable(); and 97 $oldItem->load($oldId); up to before the insert statement, right? The load routine of that table btw. is the one which I thought I could remove with PR #26829 , good that I haven't done this. It loads the featured up and down times from the content frontpage table and copies them into the article table. These then should be used here instead of the NULLs. Please confirm if that would be the right way.

@infograf768 If that is right, should I make a PR against your branch to save you some work, so you just can merge it into this PR?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm... Looks like you are right.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have it here, Shall I make PR for you, @infograf768 . Is not as complicated as I wrote above. But it will not solve our other, more general problem, only will make the times being copied right.

@alikon
Copy link
Copy Markdown
Contributor

alikon commented Oct 27, 2019

AFAIK com_content has not been converted to prepared statement.... maybe some MVC libraries...

@richard67
Copy link
Copy Markdown
Member

@infograf768 Please check infograf768#54. It implements @SharkyKZ 's comment that the dates of the copied article shall be used. Unfortunately it does not solve the other, more global problem.

@infograf768
Copy link
Copy Markdown
Member Author

@richard67 See my comment in your PR

@anibalsanchez
Copy link
Copy Markdown
Contributor

I have tested this item 🔴 unsuccessfully on 22a19e7

Everything works normally, and the new article is added to the content and content_froentend table. But, the new article is not shown in the list.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/26835.

[4.0] Use featured up and down times from copied article, if set
@infograf768
Copy link
Copy Markdown
Member Author

@anibalsanchez
The PR does not solve fully Batch Copy, it only solves the error due to wrong columns for featured_up and featured_down.

Solving fully batch copy will require another PR.

@richard67
Copy link
Copy Markdown
Member

@anibalsanchez Please test again with respect to the comment in my previous test result above:

Fixes the error "1136 Column count doesn't match value count at row 1" when batch copying a featured article.

Other problems with batch processing are out of scope of this PR.

@richard67
Copy link
Copy Markdown
Member

@infograf768 As @wilsonge commented here infograf768#55 (comment), my PR infograf768#55 seems to be ok. Do you want to merge it into this PR so it can be tested?

@alikon
Copy link
Copy Markdown
Contributor

alikon commented Nov 12, 2019

even if, apart wilsonge thinking,
i second this
😄

@wilsonge
Copy link
Copy Markdown
Contributor

I haven’t tested it but if it works it’s definitely the better fix to use the post install cleanup and the built in library

@richard67
Copy link
Copy Markdown
Member

Post install cleanup?

@richard67
Copy link
Copy Markdown
Member

How is the post install cleanup related to this here?

@wilsonge
Copy link
Copy Markdown
Contributor

I meant the cleanupPostBatchCopy method :)

@richard67
Copy link
Copy Markdown
Member

Ah now I understand.

@richard67
Copy link
Copy Markdown
Member

Was confused because there is also a cleanup of post install messages issue ;-)

@infograf768
Copy link
Copy Markdown
Member Author

Where do we stand here?

@richard67
Copy link
Copy Markdown
Member

@infograf768 As said above: Merge my PR for you, change title and description of this PR here so it‘s clear that it solves the issue with batch copying articles in general, also if not featured, then refer to this PR here in Brian‘s issue and finally wait for testers.

…-workflow-assocs

[4.0] Batch copy workflow association, too
@infograf768
Copy link
Copy Markdown
Member Author

@richard67
Done.

@richard67
Copy link
Copy Markdown
Member

@infograf768 Now it needs to change title and description of this PR so it is clear that it solves the issue with batch copying articles in general, also if not featured. I can't do this for you now because am at work. I'll leave a reference to this PR in Brian's issue.

@infograf768 infograf768 changed the title [4.0] Fixing Featured Articles batch copy (featured aspects) [4.0] Fixing Articles batch copy Nov 13, 2019
@richard67
Copy link
Copy Markdown
Member

I've left a reference comment in PR #24519 that this PR here does the same but in a mroe elegant way.

I've also left comments in issues #24478 and #27060 that this PR here solves these issues.

@infograf768
Copy link
Copy Markdown
Member Author

@SharkyKZ @alikon
Please test again.

@SharkyKZ
Copy link
Copy Markdown
Contributor

I have tested this item ✅ successfully on fc0d70a


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/26835.

1 similar comment
@Quy
Copy link
Copy Markdown
Contributor

Quy commented Nov 14, 2019

I have tested this item ✅ successfully on fc0d70a


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/26835.

@Quy
Copy link
Copy Markdown
Contributor

Quy commented Nov 14, 2019

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/26835.

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Nov 14, 2019
@wilsonge wilsonge merged commit 4d6c679 into joomla:4.0-dev Nov 14, 2019
@wilsonge
Copy link
Copy Markdown
Contributor

Thanks!

@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Nov 14, 2019
@wilsonge wilsonge added this to the Joomla 4.0 milestone Nov 14, 2019
@infograf768 infograf768 deleted the 4.0_batch_copy_article branch November 16, 2019 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants