Batch change the article's aliases after migration from 1.0

Need help upgrading your Joomla! website or converting to Joomla! 3.x?

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
Locked
User avatar
strumjan
Joomla! Explorer
Joomla! Explorer
Posts: 451
Joined: Sat Oct 20, 2007 11:21 am
Location: Skopje, Macedonia
Contact:

Batch change the article's aliases after migration from 1.0

Post by strumjan » Wed Dec 17, 2014 8:24 am

I migrate successful from 1.0 to 1.5.26 and then to 3.3.6.

Now I like to change aliases to all article's because old 1.0 isn't good.

A have 15000 articles, so one-by-one is not option.
I found on internet one suggestion:
"deleting all the aliases in table and batch moving (don't copy) articles to a temporary category and then moving them back"
...in first step, moving to temporary category, Joomla rewrite article with correct url.

I try with 10 articles, and go nice and smooth.

After that, I try with next 10 articles, and batch process move only one article and give me error: Batch failed... because ... empty. There no text for what is error.

Strange, from real category to temporary goes one-error, one-error, one-error... but, reverse, from temporary to real, just go back articles, work nice for 10 or more articles - just like batch need to work.

Any idea, how to solve this?
Joomla.mk
Macedonian translation team

User avatar
pe7er
Joomla! Master
Joomla! Master
Posts: 23347
Joined: Thu Aug 18, 2005 8:55 pm
Location: Nijmegen, Netherlands
Contact:

Re: Batch change the article's aliases after migration from

Post by pe7er » Wed Dec 17, 2014 9:00 am

I would use phpMyAdmin to change it directly in the database.

An alias is the title in lower case and "weird" characters (space, & etc) changed with hyphen.
You can do that with a SQL query like:

Code: Select all

UPDATE jos_content SET alias=LOWER(REPLACE(TRIM(title), " ", "-"))
An alias should be unique so after that you should check for duplicates with an SQL query like

Code: Select all

SELECT alias, COUNT(*) c FROM jos_content GROUP BY alias HAVING c > 1;
Use phpMyAdmin to inspect the alias fields and check them for "weird" characters that you have forgotten to replace.
Kind Regards,
Peter Martin, Global Moderator
https://db8.nl - Joomla specialist, Nijmegen, Nederland
The best website: https://the-best-website.com

User avatar
imanickam
Joomla! Master
Joomla! Master
Posts: 27721
Joined: Wed Aug 13, 2008 2:57 am
Location: Chennai, India

Re: Batch change the article's aliases after migration from

Post by imanickam » Wed Dec 17, 2014 9:06 am

Just a thought...

In phpMyAdmin, suggest using the following SQL statement just to see whether it satisfies your need.

Code: Select all

SELECT `title`,replace(replace(lower (`title`),' ','-'),"'",'') FROM `xyz_content`
where xyz_ is the db prefix of your database.

If you are satisfied, you could use an UPDATE statement to populate the column `alias`. The statement would be

Code: Select all

UPDATE `xyz_content`
SET `alias=replace(replace(lower (`title`),' ','-'),"'",'')
Ilagnayeru (MIG) Manickam | இளஞாயிறு மாணிக்கம்
Joomla! - Global Moderators Team | Joomla! Core - Tamil (தமிழ்) Translation Team Coordinator

Eegan - Support the poor and underprivileged

User avatar
strumjan
Joomla! Explorer
Joomla! Explorer
Posts: 451
Joined: Sat Oct 20, 2007 11:21 am
Location: Skopje, Macedonia
Contact:

Re: Batch change the article's aliases after migration from

Post by strumjan » Wed Dec 17, 2014 9:43 am

Peter and Manickam thank you for fast response.
But my titles of my articles are in Cyrillic letters, like „Домашно вино“ so I also need transliteration title to alias in Latin letters like "domashno-vino", just like Joomla core work.
Sorry, I don't explain that in first post.
Joomla.mk
Macedonian translation team

User avatar
imanickam
Joomla! Master
Joomla! Master
Posts: 27721
Joined: Wed Aug 13, 2008 2:57 am
Location: Chennai, India

Re: Batch change the article's aliases after migration from

Post by imanickam » Wed Dec 17, 2014 1:31 pm

I believe that you may have to write a MySQL function to do the transliteration. Following documents would be of help.

http://igstan.ro/posts/2009-02-13-mysql ... ction.html

https://github.com/igstan/sql-utils/blo ... terate.sql
https://gist.github.com/igstan/62005

http://en.wikipedia.org/wiki/Romanization_of_Macedonian

I used the last document to manually mapping the characters to transliterate Домашно вино to domashno-viно.

Hope this helps to steer you in the right direction.

Note: Similar approach is in core Joomla! as well. Review the file transliterate.php that is located in the directory \libraries\joomla\language
Ilagnayeru (MIG) Manickam | இளஞாயிறு மாணிக்கம்
Joomla! - Global Moderators Team | Joomla! Core - Tamil (தமிழ்) Translation Team Coordinator

Eegan - Support the poor and underprivileged

User avatar
strumjan
Joomla! Explorer
Joomla! Explorer
Posts: 451
Joined: Sat Oct 20, 2007 11:21 am
Location: Skopje, Macedonia
Contact:

Re: Batch change the article's aliases after migration from

Post by strumjan » Wed Dec 17, 2014 1:55 pm

Manickam, thank you for your work on my problem. I'll read all articles you suggest.

But, we have implemented this transliteration in Joomla core and it's work perfect. So, maybe we can find why batch process failed after first 10 articles?

Idea is: not use other solution when Joomla have them :)
Joomla.mk
Macedonian translation team

User avatar
imanickam
Joomla! Master
Joomla! Master
Posts: 27721
Joined: Wed Aug 13, 2008 2:57 am
Location: Chennai, India

Re: Batch change the article's aliases after migration from

Post by imanickam » Wed Dec 17, 2014 2:18 pm

Good Point... Probably you could ping JM and he could help.
Ilagnayeru (MIG) Manickam | இளஞாயிறு மாணிக்கம்
Joomla! - Global Moderators Team | Joomla! Core - Tamil (தமிழ்) Translation Team Coordinator

Eegan - Support the poor and underprivileged

User avatar
strumjan
Joomla! Explorer
Joomla! Explorer
Posts: 451
Joined: Sat Oct 20, 2007 11:21 am
Location: Skopje, Macedonia
Contact:

Re: Batch change the article's aliases after migration from

Post by strumjan » Thu Dec 18, 2014 7:19 pm

One solution is simple:

Code: Select all

UPDATE xyz_content
   SET alias = REPLACE(alias,'ш','sh')
this will change all character ш in column alias in your table xyz_content with character sh.
And do this for any character you need to transliterate.
This working OK.
Still need solution with Joomla core transliteration :)
Joomla.mk
Macedonian translation team


Locked

Return to “Migrating and Upgrading to Joomla! 3.x”