|
List Info
Thread: Fatal error : install profiles and the use of hook_install
|
|
| Fatal error : install profiles and the
use of hook_install |
  Taiwan |
2007-11-30 01:12:19 |
Hello,
There seem to be a critical bugs hiding behind the way the
install
profiles are implemented.
At the very least, there seem to be a gross inconsistency in
the
documentation.
I could have fixed the api documentation myself, except that
I am not
sure what is the 'normal' behavior.
When creating an install profile, one runs against such
errors:
"Fatal error: Call to undefined function xxx()"
http:/
/www.google.com/search?q=site%3Adrupal.org+profile+install+F
atal+error%3A+Call+to+undefined+function
This happens when one includes a few specific modules in
hook_profile_modules(), including book.module:
http://d
rupal.org/node/164458#comment-643884
The api says that all functions are loaded when running
hook_install():
http:
//api.drupal.org/api/function/hook_install
"Note that since this function is called from a full
bootstrap, all
functions (including those in modules enabled by the current
page
request) are available when this hook is called. Use cases
could be
displaying a user message, or calling a module function
necessary for
initial setup, etc."
But the profile documentation implies the contrary:
http://drupal.org/node/6
7921
the modules (including core required modules and their
functions) are
NOT yet included when running hook_profile_modules() (which
calls
hook_install()). The modules are included only at a later
stage,
hook_profile_final().
A similar problem occurred with forum.module, until a
certain function
call was moved to hook_enable():
http://drupal.org/node/
157519
This begs the question: what is it ok to include in
hook_install()?
Is hook_install() only for the DB schema, or can heavier
lifting be
done using any function call?
If this cannot be fixed for D6, some warning should be
included in the
documentation, especially here: http://drupal.org/node/6
7921 .
I didn't do so myself because I am uncertain about all the
above.
Blessings,
Augustin.
|
|
| Re: Fatal error : install profiles and
the use of hook_install |
  United States |
2007-11-30 02:10:16 |
On Nov 29, 2007, at 11:12 PM, Augustin (Beginner) wrote:
> When creating an install profile, one runs against such
errors:
> "Fatal error: Call to undefined function
xxx()"
> http:/
/www.google.com/search?q=site%3Adrupal.org+profile+install+F
atal+error%3A+Call+to+undefined+function
>
> This happens when one includes a few specific modules
in
> hook_profile_modules(), including book.module:
> http://d
rupal.org/node/164458#comment-643884
I'd consider filing an issue against book.module in this
case.
> The api says that all functions are loaded when
running
> hook_install():
> But the profile documentation implies the contrary:
> http://drupal.org/node/6
7921
Don't mix up hook_install and hook_profile_* hooks. They are
for
rather different purpose. hook_install is for modules to
implement
when they are first enabled, and hook_profile_* are only run
during
the initial installation of Drupal. These are actually two
separate
installations, except for the fact the the module
installation can be
triggered during the Drupal installation.
...
Actually I just went and read the issue you mentioned. I
think
pwolanin pretty much nails the issue in the first comment
<http://d
rupal.org/node/164458#comment-588665
>. Book is trying to call function from node.module, and
while in
theory all core functions are enabled, from a full
bootstrap, Drupal
can't yet have a full bootstrap if you are enabling modules
such as
node and system at the same time.
One solution might be, to enable book.module from
hook_profile_final.
Any attempts to include files, from modules not yet
installed will
most likely result in Bad-Things. *
-Mike
* When I first read your mail, I thought you were referring
to the
type of problem that is common with contrib modules that
make
extensive use of .inc files. These tend to wreak havoc on
install
profiles (call to undefined function), and my solution to
these
problems has been a string of include_once() at the top of
my install
profile.
__________________
Michael Prasuhn
mike mikeyp.net
http://mikeyp.net
949.200.7595
714.356.0168 cell
949.200.7670 fax
|
|
| Re: Fatal error : install profiles and
the use of hook_install |
  South Africa |
2007-11-30 03:15:14 |
|
On 30 Nov 2007, at 9:12 AM, Augustin (Beginner) wrote:
But the profile documentation implies the contrary: http://drupal.org/node/67921 the modules (including core required modules and their functions) are NOT yet included when running hook_profile_modules() (which calls hook_install()). The modules are included only at a later stage, hook_profile_final().
i ran into the same issue
i found out it's impossible to create a cck node type, and then add a node using the api using a _install
i ended up creating an install profile just to use _final().
was a long 3 hours of debugging.
|
| Re: Fatal error : install profiles and
the use of hook_install |
  Taiwan |
2007-11-30 05:30:54 |
On Friday 30 November 2007 17:15, adrian rossouw wrote:
> was a long 3 hours of debugging.
Precisely. That's why I am shouting it here: many people
seem to be
having a problem with it. It is not intuitive, hard to debug
and the
documentation is contradictory.
A fix would probably imply an API change, so it will have to
wait for
D7.
Meanwhile, we have to make people aware of this (especially
now that
people are making efforts to promote install profiles, and
dww is
working on the packaging script).
The least I could do was add a note to the documentation
here:
http://drupal.org/node/6
7921
http://drupal.org/node/67921/revisions/view/191746/2220
37
If I made a mistake, please correct it directly.
Where else should this be documented?
I'll update the issue accordingly:
http://drupal.org/node/
164458
Blessings,
Augustin.
|
|
| Re: Fatal error : install profiles and
the use of hook_install |
  South Africa |
2007-11-30 05:44:23 |
|
On 30 Nov 2007, at 1:30 PM, Augustin (Beginner) wrote:
A fix would probably imply an API change, so it will have to wait for D7.
i want to turn install profiles into full featured modules for D7.
and then give all modules / install profiles the same hooks (ie: all modules will have _final)
writing an install profile at the moment requires you also write a support module for it, to contain a lot of the code you need for running the profile. |
| Re: Fatal error : install profiles and
the use of hook_install |

|
2007-11-30 05:52:43 |
On Nov 30, 2007 12:44 PM, adrian rossouw <adrian bryght.com> wrote:
> On 30 Nov 2007, at 1:30 PM, Augustin (Beginner) wrote:
> A fix would probably imply an API change, so it will
have to wait for
>
> D7. i want to turn install profiles into full featured
modules for D7.
> and then give all modules / install profiles the same
hooks (ie: all modules
> will have _final)
>
> writing an install profile at the moment requires you
also write a support
> module for it, to contain
> a lot of the code you need for running the profile.
Well, well. In D6, after the built-in config screen (and
even for the
built-in config screen which is alterable), Drupal is fully
bootstrapped with all enabled modules. You can have any
number of
screens as wizards. Granted the install profile tasks system
is a bit
custom solution for a task based wizard, but these kind of
features
are there.
Obviously, the profile does not execute in the Drupal
runtime, after
it is installed, so this part is not solved. (I have seen
you have
plans to run "install profile modules" in runtime
as well.)
Gabor
|
|
| Re: Fatal error : install profiles and
the use of hook_install |
  France |
2007-11-30 05:58:25 |
This bug is corrected (as a side effect) by the patch in
http://d
rupal.org/node/176003#comment-642775
(install modules in a batch in install.php)
yched
Augustin (Beginner) wrote:
> Hello,
>
>
> There seem to be a critical bugs hiding behind the way
the install
> profiles are implemented.
> At the very least, there seem to be a gross
inconsistency in the
> documentation.
> I could have fixed the api documentation myself, except
that I am not
> sure what is the 'normal' behavior.
>
>
> When creating an install profile, one runs against such
errors:
> "Fatal error: Call to undefined function
xxx()"
> http:/
/www.google.com/search?q=site%3Adrupal.org+profile+install+F
atal+error%3A+Call+to+undefined+function
>
> This happens when one includes a few specific modules
in
> hook_profile_modules(), including book.module:
> http://d
rupal.org/node/164458#comment-643884
>
> The api says that all functions are loaded when running
> hook_install():
>
> http:
//api.drupal.org/api/function/hook_install
> "Note that since this function is called from a
full bootstrap, all
> functions (including those in modules enabled by the
current page
> request) are available when this hook is called. Use
cases could be
> displaying a user message, or calling a module function
necessary for
> initial setup, etc."
>
> But the profile documentation implies the contrary:
> http://drupal.org/node/6
7921
> the modules (including core required modules and their
functions) are
> NOT yet included when running hook_profile_modules()
(which calls
> hook_install()). The modules are included only at a
later stage,
> hook_profile_final().
>
> A similar problem occurred with forum.module, until a
certain function
> call was moved to hook_enable():
> http://drupal.org/node/
157519
>
>
> This begs the question: what is it ok to include in
hook_install()?
> Is hook_install() only for the DB schema, or can
heavier lifting be
> done using any function call?
>
>
> If this cannot be fixed for D6, some warning should be
included in the
> documentation, especially here: http://drupal.org/node/6
7921 .
> I didn't do so myself because I am uncertain about all
the above.
>
>
>
>
> Blessings,
>
> Augustin.
>
>
>
>
|
|
[1-7]
|
|