I am attempting to have robotstxt installed as part of an install profile. When the profile is run I get the following MySQL error:
Warning: Table 'my_database.url_alias' doesn't exist query: SELECT COUNT(pid) FROM url_alias in /srv/dev.itr.co.uk/public/htdocs/includes/database.mysql.inc on line 128
.. and I get a "requirements problem":
(Currently using RobotsTxt Clean URLs are mandatory for this module.)
The thing is that CleanURLs will be enabled on this module - but that doesn't happen until later in the install process. At the point in time at which the robotstxt module install file is being called, cleanurls have not yet been configured.
I would imagine the cause is similar to the issue descibed here for the xmlsitemap module ... : http://drupal.org/node/717146
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | robotstxt_require_clean_urls-831522-11.patch | 697 bytes | steveoliver |
| #10 | robotstxt_require_clean_urls-831522-10.patch | 1.08 KB | steveoliver |
Comments
Comment #1
hass commentedFeel free to enable cleanurls in your install profile
Comment #2
leo pitt commentedI'm interested to know where in my profile I should place the code to enable cleanurls.
I have added code to hook_profile_tasks in order to enable clean urls, prior to enabling the robotstxt module
variable_set('clean_url', 1);
The same error message still occurs.
During the install phase of hook_requirements (as used by an install profile at least) no database tables exist, so the test in robotstxt for the clean_url variable that takes place during the install phase of the install profile, will always fail.
Feel free to read http://api.drupal.org/api/function/hook_requirements/6
During the 'install' phase, modules can for example assert that library or server versions are available or sufficient. Note that the installation of a module can happen during installation of Drupal itself (by install.php) with an installation profile or later by hand. As a consequence, install-time requirements must be checked without access to the full Drupal API, because it is not available during install.php. For localisation you should for example use $t = get_t() to retrieve the appropriate localisation function name (t() or st()). If a requirement has a severity of REQUIREMENT_ERROR, install.php will abort or at least the module will not install. Other severity levels have no effect on the installation. Module dependencies do not belong to these installation requirements, but should be defined in the module's .info file.
My best suggestion would be to have the cleanurls tested only on runtime, not install.
Comment #3
leo pitt commentedComment #4
Alexander N commentedIs there a way to circumvent this besides commenting robotstxt out of the installation profile module list? Like, a way to override the requirements phase of the installation?
Comment #5
that0n3guy commentedI added this to the very end of my profile_tasks function
seems to work just fine in aegir... didnt test a regular install but I don't see why it wouldn't work.
Comment #6
hass commentedRemoved the "install" section from hook_requirements()
Comment #8
carsonblack commentedI was receiving Fatal error: Call to undefined function db_result() in DRUPAL_ROOT/includes/path.inc on line 55
When I was enabling this module in my install profile and the change above seems to have worked for me. The error went away and the module was successfuly activated without me having to change anything about how my install profile worked. Thanks!
Comment #9
steveoliver commentedI still see 'install' case in 6.x-1.2 -- http://drupalcode.org/project/robotstxt.git/blob/3e2844e33cf58a8bd995cfc...
?
-Steve
Comment #10
steveoliver commentedThe attached patch, rolled against 6.x-1.2, requires clean urls only after installation (when not on install.php).
Comment #11
steveoliver commentedLast patch removed trailing whitespace. This patch leaves it. ;)
Comment #12
hass commentedIt's only in dev currently.