Closed (fixed)
Project:
Pathauto
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
23 May 2008 at 13:46 UTC
Updated:
30 Sep 2010 at 15:44 UTC
Jump to comment: Most recent file
Hi,
I may have some urls aliases that are longer then 128 (slightly more)
Having read this http://drupal.org/node/54481 I was wondering if I alter the underlying table structure to allow for 255, there is still the pathauto limit.
Has anyone removed the 128 limit yet in pathauto?
Cheers,
G
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | 261944-schema-maxlength-D6.patch | 2.31 KB | dave reid |
| #12 | 261944-schema-maxlength-D6.patch | 3.38 KB | dave reid |
| #8 | 261944-schema-maxlength-D6.patch | 2.31 KB | dave reid |
| #5 | 261944-schema-maxlength-D6-2.patch | 2.32 KB | dave reid |
Comments
Comment #1
gregglesI believe that if you search the code for 128 you'll find the places to change this. Of course, then you'll be using a modified version of Pathauto which means more work every time you upgrade Pathauto.
I hope you don't mind me changing this to a feature request. I don't plan on providing more support for this, but if someone wanted to modify Pathauto so that it would figure out the underlying table structure and set a higher limit based on that I would accept the patch.
Comment #2
Freso commentedHm. Wouldn't this be possible using the Schema API? It would be interesting to play with for 6.x-2.x... :) (It would also be great if it was somehow possible to assign issues to 6.x-2.x-dev - is this possible, Greg? I'm pretty sure "7.x" was listed for core before 6.x was branched out/development opened, but...)
Comment #3
gregglesWhile it's possible, I don't want to be messing with the core tables. If someone else wants to do that on their site, that's fine. There was an instance in the past where Pathauto increased the size of the system table, but...that was a change that core had in a newer version already and which was causing a bug with CCK (which makes it hard to ignore).
For a feature request, though, I don't think we should be modifying a core table.
Comment #4
Freso commentedAh, but I'm not suggesting we alter any tables. :) I looked into the database functions yesternight and didn't find what I wanted, so perhaps it isn't as I hoped, but what I wanted was for Pathauto to use something like
$alias_length = get_schema('url_alias'); $alias_length = $alias_length['fields']['dst']['length'];and then use$alias_lengthto determine our max length of the alias table. Thus, we'll be ready to follow core if they change, and it's one less worry for people who need to alter it themselves.Comment #5
dave reidI see what Freso means. Patch attached for review that will allow pathauto to be ported a little easier to future Drupal versions when the {url_alias}.dst length changes.
Comment #6
Freso commentedI haven't tested the patch, but the code looks fabulous! Thank you, Dave. =)
Comment #7
dave reidI need to re-roll for 6.x-1.x
Comment #8
dave reidRe-rolled for 6.x-1.x.
Comment #9
dave reidTested and committed to 7.x-1.x and 6.x-2.x.
http://drupal.org/cvs?commit=330054
http://drupal.org/cvs?commit=330058
Should we apply this to 6.x-1.x as well?
Comment #11
dave reidEven added a unit test for this in 7.x-2.x and 6.x-2.x.
Comment #12
dave reidRevised patch for 6.x-1.x. Does change some of the help text translation.
Comment #13
dave reidHere's the non-string change version.
Comment #14
dave reidCommitted to 6.x-1.x.
http://drupal.org/cvs?commit=331190
http://drupal.org/cvs?commit=331192
Comment #15
arpeggio commentedHi Dave, I'm still new in this system please correct me if I'm doing wrong. You've suggested me to follow-up my issue in this thread instead in If node title contains only ignore words, it results to a blank alias thread. Here's the issue for Drupal 7:
In line 214 of pathauto.inc is hard coded with 128 maximum length (per component) it prevents the alias to reach the length specified in {url_alias} table (alias field) which is now set to 255 in drupal 7. For example in admin/config/search/path/pathauto if the user set his Default path pattern (applies to all node types with blank patterns below) field to [node:title] only, all nodes' alias will still have the maximum length of 128 because the line 214 of pathauto.inc enforced it:
$maxlength = min(variable_get('pathauto_max_component_length', 100), 128);Suggestion is:
Comment #16
dave reid@arpeggio (great name btw!): Thanks for catching that. I committed that fix to all three branches.
http://drupal.org/cvs?commit=334898
http://drupal.org/cvs?commit=334900
http://drupal.org/cvs?commit=334902
Comment #17
arpeggio commentedThank you :) and thanks Dave for the quick respond to the fix.
Comment #19
HenryLTV commentedHi Dave,
Quick question: Does the Schema API only apply to the default (core installation) state of the schema?
We recently upgraded PathAuto to 6.x-1.x-dev, and it seems
is always returning 128 even though we've manually updated the url_alias table "dst" column to varchar(255). I suspect from comments #4 and #5 that the only way for _pathauto_get_schema_alias_maxlength() to return 255 is if the underlying schema is modified in some future upgrade, and that in the meantime, any manual change to the "dst" column of the url_alias table is ignored. Am I correct?
If this is true, then is it true that the only way to set a higher alias max would be to hard-code _pathauto_get_schema_alias_maxlength() to return 255 until a future upgrade changes the underlying schema so that $alias_length['fields']['dst']['length'] is increased from 128 to 255?
Thanks!
Comment #20
dave reidYou can implement this in your own module:
Comment #21
HenryLTV commentedThanks Dave, that solution worked rather nicely =) I'm assuming that my assumptions from my initial post were correct then =)
Thanks!