As pointed in another report, the names of the modules as seen in the Drupal administration pages should be changed; the colon in the name should be removed, and the only word in capital case should be the first one, which should be all in uppercase because it's an acronym.

We should decide names that are keep in all the all the branches, to avoid the user gets confused.

This report is thought to be used from the maintainers.

CommentFileSizeAuthor
#27 issue-453434.patch1.08 KBAnonymous (not verified)
#23 issue-453434.patch1.08 KBAnonymous (not verified)
#17 issue-453434.patch65.44 KBAnonymous (not verified)
#7 xmlsitemap-453434.patch4.45 KBAnonymous (not verified)
#5 xmlsitemap-453434.patch4.32 KBAnonymous (not verified)
#3 xmlsitemap-453434.patch4.35 KBAnonymous (not verified)
#2 xmlsitemap-453434.patch3.91 KBAnonymous (not verified)

Comments

dave reid’s picture

My position is that:
- The modules should be named "XML sitemap modulename". No colon, only the XML should be capitalized.
- Make sure we standardize on using "sitemap" and not "site map" since that's what the protocol uses.
- Also make sure we do the same thing with the "package = XML sitemap" line in all the .info files as well.

Let's also take a look at all the description values in the module .info files as well. Currently we have in 6.x-1.x-dev:
xmlsitemap.module: "Creates an XML site map in accordance with sitemaps.org specifications."
xmlsitemap_engines.module: "Submits site map to search engines."
xmlsitemap_menu.module: "Adds menu items to the site map."
xmlsitemap_node.module: "Adds nodes to the site map."
xmlsitemap_taxonomy.module: "Adds taxonomy terms to the site map."
xmlsitemap_user.module: "Adds user profiles to the site map."

Here's what I propose:
xmlsitemap.module: "Creates a sitemap that conforms to the sitemaps.org specification."
xmlsitemap_engines.module: "Submits the sitemap to search engines." - only change is site map to sitemap
xmlsitemap_menu.module: "Adds menu items to the sitemap." - only change is site map to sitemap
xmlsitemap_node.module: "Adds content links to the sitemap." - change 'nodes' to 'content links' (CCK is not called Node construction kit), change site map to sitemap
xmlsitemap_taxonomy.module: "Adds taxonomy term links to the sitemap." - add 'links' and change is site map to sitemap
xmlsitemap_user.module: "Adds user profile links to the sitemap." - add 'links' and change is site map to sitemap

Anonymous’s picture

Status: Active » Needs review
StatusFileSize
new3.91 KB

Like this?

Anonymous’s picture

StatusFileSize
new4.35 KB

Rather like this one. I agree with xmlsitemap_taxonomy vs xmlsitemap_term and will include that if we go with this patch.

avpaderno’s picture

Status: Needs review » Needs work

I would rather use what Dave suggested.
You keep to say sitemap report, but it's not clear to me what that would mean.

Anonymous’s picture

Status: Needs work » Needs review
StatusFileSize
new4.32 KB

Ok, I've dropped 'sitemap report' to 'sitemap'. I did leave 'XML sitemap' in the primary module instead of dropping to just 'sitemap'; I feel it is more natural due to the name of the project.

The project specifier is 'XML Sitemap', should that become 'XML sitemap' instead?

Once we finalize the text I'll rename xmlsitemap_term to xmlsitemap_taxonomy.

avpaderno’s picture

XML sitemap is better; I also agree to leave XML sitemap to mean the module, and not drop it in favor of sitemap.

Anonymous’s picture

StatusFileSize
new4.45 KB

I've changed the project value. Are we ready to rename xmlsitemap_term to xmlsitemap_taxonomy and roll with this?

avpaderno’s picture

Would not we add specific code, if we are going to rename XML Sitemap: Term? I mean an update function of XML Sitemap that would verify if xmlsitemap_term.module was enabled, and enable xmlsitemap_term.module (or something like that).

In alternative, we don't add any code like that, and the user simply delete the old files, and copy the new ones.

Anonymous’s picture

The install instructions already state to remove the module completely. Any update that might happen would be to change variable.name from xmlsitemap_term* to xmlsitemap_taxonomy*. Thinking further on this, the xmlsitemap_term to xmlsitemap_taxonomy rename should wait for version 2. We're too close to go fooling with this change.

What if I commit the change as is and we'll mark the rest of this task for 2.x-dev?

avpaderno’s picture

I would wait a little to change the name of the xmlsitemap_term module, but I would do it in the 6.x-1 branch too.

Anonymous’s picture

Is it alright for the rename to happen in 1.1? If yes, I'll commit the patch. This is the only issue open holding up a RC at the moment.

Anonymous’s picture

Status: Needs review » Active

Since the patch was reviewed I committed what we have thus far for the next generation of the -dev file.

Anonymous’s picture

On the string changes see #455144: Strings need updated throughout the code

As for the rename of the module xmlsitemap_term to xmlsitemap_taxonomy, IMO this is a postpone or a 2.x-dev only action. I will take care of the strings today and unless someone is extremely opposed I'll cut a release candidate for 1.0-RC1.

avpaderno’s picture

It should be better if we change the name for xmlsitemap_term also; this would simplify the documentation, which would make reference to only one module, and would avoid problems with the users, who could find themself with xmlsitemap_term, and xmlsitemap_taxonomy when they update to 2.x.

Before to release a release candidate, I would release a beta release, at least; even if the quality of the code could make the release a release candidate, I would rather release it as beta.

avpaderno’s picture

To rename xmlsitemap_term should not be too hard, especially if it is done in steps, and trough different pre-releases that the user should pass through.

  • The code is passed to the new files. The old files will still be present, but they will not contain code; The description for the module advices that the module is replaced by xmlsitemap_taxonomy.
  • The new module rename the database table it uses (optional).
  • The old files are completely removed.
Anonymous’s picture

I just came here to say that the table name will remain xmlsitemap_term since the Drupal table names are prefixed as term_*. This will make the change easier to swallow.

Anonymous’s picture

Status: Active » Needs work
StatusFileSize
new65.44 KB

Attached is the preliminary change for this. I marked needs work because it is untested.

Is xmlsitemap_taxonomy_update_6113() needed?

avpaderno’s picture

I would leave out the French translation; for what I can see, the file is wrong because it declares to take the strings from all the modules.

avpaderno’s picture

Is xmlsitemap_taxonomy_update_6113() needed?

Yes, it is.
I was thinking it could be implemented differently, but effectively you chose the right way. The number of variables used by the module increases with the number of vocabularies used; therefore, the way you implemented it is the only possible.

avpaderno’s picture

Assigned: Unassigned » avpaderno

I will take care of this, if it's fine with the others.

avpaderno’s picture

Status: Needs work » Needs review

I should have done it correctly. I keep the report open for review.

Anonymous’s picture

Status: Needs review » Fixed

Since this task has been accomplished I'm marking it fixed.

Anonymous’s picture

StatusFileSize
new1.08 KB

Added the attached patch to this change.

avpaderno’s picture

Status: Fixed » Needs work

The code needs to be changed from

function xmlsitemap_taxonomy_update_6113() {
  $result = db_query("SELECT name FROM {variable} WHERE name LIKE 'xmlsitemap\_term\_%'");
  while ($row = db_fetch_object($result)) {
    $new_name = preg_replace('/_term_/', '_taxonomy_', $row->name);
    $ret[] = update_sql("UPDATE {variable} set name = '$new_name' WHERE name LIKE 'xmlsitemap\_term\_%'");
  }
  $ret[] = update_sql("UPDATE {xmlsitemap} set module = 'xmlsitemap_taxonomy' WHERE module = 'xmlsitemap_term'");
  return $ret;
}

to

function xmlsitemap_taxonomy_update_6113() {
  $ret[] = update_sql("UPDATE {xmlsitemap} set module = 'xmlsitemap_taxonomy' WHERE module = 'xmlsitemap_term'");
  return $ret;
}

function xmlsitemap_taxonomy_update_6114() {
  $ret = array();
  $result = db_query("SELECT name FROM {variable} WHERE name LIKE 'xmlsitemap\_term\_%'");
  while ($row = db_fetch_object($result)) {
    $new_name = preg_replace('/_term_/', '_taxonomy_', $row->name);
    $ret[] = update_sql("UPDATE {variable} set name = '$new_name' WHERE name = '". $row->name ."'");
  }
  return $ret;
}

This is because the update_sql("UPDATE {variable} set name = '$new_name' WHERE name LIKE 'xmlsitemap\_term\_%'") line would change the name of the Drupal variables that are like xmlsitemap\_term\_% to $new_name.

I will take care of it, when we agree on that.

Anonymous’s picture

You may do it but I don't support intra-development upgrades. The instructions for 6.x-1.x-dev to 6.x-1.x-dev explicitly states to uninstall the old then install the new so the code would never be executed unless upgrading from 5.x.

avpaderno’s picture

Status: Fixed » Needs work

The point is that the update query is wrong; it selects all the Drupal variables that have a name starting with xmlsitemap_term_, and change the name to the content of a variable. This means that the first time the query is executed, it would change all the variables it finds, and the further queries will not change anything.

It's not a matter of inter-dev versions, but to fix an error present in the code.

EDIT: sometimes my English is not so English.

Anonymous’s picture

StatusFileSize
new1.08 KB

Duh!

Sorry, I missed what you were telling me.

Anonymous’s picture

Status: Needs work » Fixed
avpaderno’s picture

Status: Needs work » Fixed

I changed the code; the call to preg_replace() has been replaced with a call to str_replace(), and the call to db_fetch_object() has been replaced with a call to db_result() (db_fetch_object() is not required when the query returns the value of a single field, as stated in the documentation for db_result()).

Anonymous’s picture

db_result vs db_fetch_object

No difference in operation other than one returns an array and the other returns an object. Big deal!

What is your reasoning for the preg_replace vs str_replace change?

webchick’s picture

str_replace() is faster than preg_replace() and db_result() doesn't return an array (that's db_fetch_array()), but rather a single column's value if that's all you're interested in. Saves a tiny bit of processing/memory to just retrieve it directly rather than looping to retrieve it.

avpaderno’s picture

Uhmmm... db_result() returns the field as scalar value; therefore, there is no need to write $row->name, but $name.

preg_replace() should not be called if the search string doesn't contain any special characters. If the search engine would be /xmlsitemap_.*_cron_list/i, then I would use preg_replace(); in the specific case, there is no need to do such thing.
The PHP documentation for str_replace also reports that if you don't need fancy replacing rules (like regular expressions), you should always use this function instead of ereg_replace() or preg_replace().

avpaderno’s picture

I checked if db_result() could be able to return all the field values contained in the database table, in the case the condition would be matched by more rows; after I verified that the function is able to return all the field values matching the condition (one by one), I changed the code.

Anonymous’s picture

str_replace() is faster than preg_replace()

Thanks, I thought it might be something like that but we're executing the code exactly once for an update.

db_result() doesn't return an array (that's db_fetch_array()), but rather a single column's value if that's all you're interested in

db_result uses mysql_fetch_row which returns an array and then db_result returns $array[0]. I don't really see much savings. And again we're executing the code exactly once for an update.

The deed is done, both methods have exactly the same result, I just think time spent fixing broken code would have been a better use of resources.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.