The module install hooks went into core last night. In Neil's Install, configure, and update session this morning we broke out to discuss the issues involved in building a core installer.
1) Environment check
2) Form for database configuration
3) Core install hook
Environment check
-Ankur, Jeremy, and myself reviewed the environment issues that have arisen with the CivicSpace installer and the integration tasks related to integrating CiviCRM with Drupal.
The following is a preliminary list of things we should check for in the users environment. This should be a generalized function that could be shared across many PHP projects.
-Write permissions of files for core, and non-write permisisons for run time configuration e.g. settings.php
-_SERVER variables should be checked for determining domain and preconfiguring base_url
-PHP Safe mode, PHP Register Globals, PHP version check, PHP memory size, PHP mail compiled in
-PHP database support should be determined to see what DB's can be supported with this version of PHP
-Apache mod_rewrite, gzip, allow override for .htacces
Form for database configuration
-The forms API lived outside Drupal during it's creation. It is believe that we can render forms without the Drupal bootstrap to enable Database configuration. This needs to be proved or changed in core so that it is posssible.
Core install hook
-Drupal core should implement the same _install hook for consistency.
-Drupal core should have one .install file for installing core.
-Drupal core module should have their own independent .install file for updates checked
-the install hook should have a help function that can render help themed as the DB connections errors are presented today.
-the install hook should be in a top level file which will be called from install.php and the contents will be included in a file install.inc kept with update.inc
We need to write a install.php to call
Comment | File | Size | Author |
---|---|---|---|
#43 | installer-HEAD.patch.txt | 127.98 KB | Jeremy |
#42 | installer.patch.txt | 96.46 KB | Jeremy |
#39 | install_10.patch | 123.37 KB | Jeremy |
#37 | install_9.patch | 91.5 KB | Jeremy |
#35 | install-error.PNG | 36.39 KB | sepeck |
Comments
Comment #1
drummLooks like at least three issues crammed into one.
"-Ankur, Jeremy, and myself reviewed the environment issues that have arisen with the CivicSpace installer and the integration tasks related to integrating CiviCRM with Drupal."
Why CiviCRM? Drupal core doesn't care about it.
"-PHP Safe mode, PHP Register Globals, PHP version check, PHP memory size, PHP mail compiled in"
Drupal should work with safe mode. Memory is highly dependant on what modules you have.
"-Apache mod_rewrite, gzip, allow override for .htacces"
.htaccess is actually optional too. So is Apache.
"-Drupal core should have one .install file for installing core."
Right now it is database/updates.inc.
"-Drupal core module should have their own independent .install file for updates checked"
Thats a large directory structure change. Have fun with that.
"-the install hook should have a help function that can render help themed as the DB connections errors are presented today."
Wuh? You mean script, not hook, right?
"-the install hook should be in a top level file which will be called from install.php and the contents will be included in a file install.inc kept with update.inc"
Put the one line of code in a function in install.inc if you want.
Comment #2
Amazon CreditAttribution: Amazon commentedWhy CiviCRM? Drupal core doesn't care about it.
-because integrating with other systems and dependencies outside of Drupal core are going to be more common. There are plenty of contributed modules that additional dependencies that could be checked for.
Checks for common platform configuration issues is relatively easy and makes for a better user experience.
Comment #3
Jeremy CreditAttribution: Jeremy commentedHere's a patch for install.inc to offer code toward this goal. Essentially this is a collection of helper functions for the installer to do things like verify that php.ini is properly configured. The goal is to define core requirements, but to also allow modules to define their own requirements (as well as "install profiles").
The first installer helper function is used to auto-generate $base_url using PHP predefined variables (aka superglobals). This allows the installer to pre-fill $base_url for the user (who could then change it if necessary).
The second collection of helper functions is used to verify php.ini settings. Refer to drupal_verify_php_requirements() to see how the helper functions are used to verfiy the php version, safe_mode, register_globals and memory_limit. Modules would define additional requirements in their .install files, as necessary.
The third helper function is used to detect all available database types (those that are compiled into PHP and are recognized by Drupal).
Please offer feedback. If the general feeling is that this is a good approach, I will continue down this path to verify file permissions, and will add install.apache.inc and install.mysql.inc to offer application specific tests as well.
If you'd like to test this on your server, patch install.inc and then add the following two lines to index.php after DRUPAL_BOOTSTRAP_FULL:
(This is just for testing. In actuality, this call will be made from install.php, not index.php... You can then play with changing DRUPAL_MINIMUM_PHP and DRUPAL_MINIMUM_MEMORY at the top of install.inc to see what happens...)
Comment #4
markus_petrux CreditAttribution: markus_petrux commentedI'm going to close an issue I opened in January related to this.
http://drupal.org/node/45166
You could also check for required PHP extensions.
Here's some code that can be used to check for SQL engine versions:
It is code extracted from something I wrote sometime ago, here adapted to Drupal DBAL. I have tested the MySQL check, but I haven't had the oportunity to test if the pg version works.
Comment #5
Jeremy CreditAttribution: Jeremy commentedAt the moment I'm trying to define an InstallAPI that is modeled after the FormAPI, moving away from hard coded checks. The goal is to allow module's to use this InstallAPI in their .install files. (How we actually determine the various versions and settings is handled underneath the API. MySQL specific stuff would be handled in install.mysql.inc, PostgreSQL specific stuff would be handled in install.pgsql.inc, Apache specific stuff would be handled in install.apache.inc, etc... )
At this time, the API I have defined is a fairly limited proof of concept and only works for checking PHP info. In any case, to illustrate what I'm trying to do here is a snapshot of code that checks for core Drupal PHP requirements:
The next step is to expand this API to support things other than php. What I envision for the expanded API would turn the first example above into something like this (a two-dimensional array):
At that point the same API would be used to verify version and configuration information for other applications. For example, install.apache.inc and install.mysql.inc would expand this API so the following would verify the minimum version of Apache and MySQL:
Finally, this entire API would be available to all modules. Thus, each module would be able to define minimum requirements / configuration settings in their .install files.
Comment #6
Jeremy CreditAttribution: Jeremy commentedThe attached patch provides the environment verification API described earlier in this issue. It also begins to define an installation bootstrap process. A quick file-by-file description follows:
install.php:
- new file, launches the install bootstrap logic
install.inc:
- drupal_install() is a bootstrap process similar to drupal_bootstrap(). It first verifies the install environment (defined by system.install and/or profiles), then settings.php and finally the database. From there it allows the selection of a profile (specific themes/modules/etc) and completes the installation. At this time only the environment checks are implemented.
- drupal_verify_install() calls the appropriate verification function, including files as needed
- drupal_verify_install_php() verifies PHP minimum requirements
- drupal_verify_install_file() verifies file permissions
- drupal_verify_install_function() verifies that required functions exist
install.apache.inc
- drupal_verify_install_apache() verifies apache requirements/configuration
install.mysql.inc
- drupal_verify_install_apache() verifies MySQL requirements/configuration
theme.inc
- adds install_page, very similar to maintenance_page (does not require database)
system.install
- defines Drupal core requirements using new API similar to the formsapi. Soon third-party modules will be able to put their own requirements in their own .install files. Additionally, profile requirements will be able to be defined in .profile files.
This is a work in progress, however reviews and comments would be very much appreciated.
Comment #7
markus_petrux CreditAttribution: markus_petrux commentedLooks very nice.
One comment:
I believe apache_* functions are available only when PHP is running as an Apache module.
http://www.php.net/manual/en/ref.apache.php
Not sure, but the _using_apache() function may return true? $_SERVER['SERVER_SOFTWARE'] may still contain the word "apache"?
Comment #8
Jeremy CreditAttribution: Jeremy commentedYes, that is correct. Both install.apache.inc and install.mysql.inc need to be greatly improved -- up until now I've been primarily focused on designing the framework. I'd greatly appreciate patches/suggestions with code for more accurate and/or additional checks within the framework.
Thanks for reviewing. :)
Comment #9
webchickHere is a zipped copy of today's HEAD and this patch already applied, for those for whom the word 'patch' strikes indelible fear. ;)
This should hopefully make it easier to get a broader range of people tesitng.
Comment #10
m3avrck CreditAttribution: m3avrck commentedJeremey, awesome work!!! Testing out now on Windows XP with Apache 2.0.55, PHP 5.1.2, MySQL 4.1.7 I'm running into trouble.
Obviously, on Windows permissions are handled entirely differently. Now what to do about it, should there be an OS check and if Windows, by pass these checks and possibly inform the user that they need to properly secure their server a different way? Or, should there be a way to bypass these checks with some sort of checkbox or something?
On another note, is the settings.php generated from this script?
I see one usability problem, users are going to drop Drupal into a directory and try and visit the site, by doing this they will likely get an error 'Unable to connect to the database server' ... perhaps that warning should be updated with a link to run install.php? ... however, this could be a security risk, what if Drupal.org database server went down and that link was present? Any means to stop this?
Comment #11
Robin Monks CreditAttribution: Robin Monks commentedhttp://php.net/is_readable and http://php.net/is_writable should work on windows, although the file would have to be marked "read only" instead of 755/555
That would be, IMHO, a required feature. Also, the install can check to see if install.php already contains values to prevent itself from running.
Drupal can check to see if values are written in settings.php, if none are, then it can directly switch to the installer, like Mam *cough* bo does.
Get work goes on here, keep it up!
Robin
Comment #12
Jeremy CreditAttribution: Jeremy commentedThose error messages say that is_writeable() is returning true for index.php, cron.php and xmlrpc.php. Try opening them in windows explorer and look at the file permissions -- is it read only? Or read/write?
As the web server process has write permissions to those files, it should be able to auto-remove the write permissions. That will make it less confusing for Windows users that are perhaps less used to dealing with file permissions. I'll test that out.
Not yet. The first phase of the install bootstrap is checking the environment, that's basically all this script does yet. The second phase is validating/configuring settings.php. I'm working on that at the moment, and will upload a new patch when it's completed. The third phase will be getting connected to the database.
At the end of the installation process, I intend the installer to set a variable in settings.php which indicates an install succesfully completed, and then to make settings.php read only...
Comment #13
drummThis will be a nice addition, but only after 4.7 is released. It is simply too late to add this now.
I only did a quick read through of the code.
I'd like to see theme_maintenance_page used instead of making a new function.
New strings should have one space between sentances. This is the best thing to do for variable width fonts and browsers collapse the whitespace anyway.
Comment #14
Jeremy CreditAttribution: Jeremy commentedYou're probably right, but Dries indicated he'd still consider an installer for Drupal 4.7 at Vancouver so I'm trying to complete this as quickly as possible. If it's too late, it's still worth getting working for consideration after we open up for new features...
The maintenance_page theme doesn't quite work, as errors and warnings are just dumped onto the screen. I'm hoping to have a much prettier install_page before this patch is finished, with an external install.css. I'd like the installer to look nice, for things to be clear to an inexperienced user, and for Drupal distributers to brand their own installers, etc.
Okay. 24 years of teaching myself to press space twice after a '.' is difficult to forget. I can just do a replace in vi after the patch is finished if the double spaces are really that problematic. Thanks for looking the patch over!
Comment #15
Jeremy CreditAttribution: Jeremy commentedHere's an updated version of the installer patch. In addition to verifying the environment, it also configures settings.php. (the function that rewrites settings.php will be made more generic so that it can be used for other settings too, but for now I just want to be sure this method works under multiple installation environments)
Other changes include detecting the approriate settings.php (rather than hard coding default/settings.php), and trying to fix file permissions that are wrong.
Note that the settings.php form that is displayed to the user does not use the formsapi -- I tried to do this for quite a while, but gave up as the formsapi requires the database. (I was able to add some if/else statements to force it to work without the databaes, but it got quite ugly and really isn't worth it for just one page) All other form pages generated by the installer should be able to use the formsapi, as the next bootstrap step is initializing the database.
Please test -- try configuring settings.php with the installer patch applied and see if it works for you on your OS. (I'm offline now for two days, I'll reply to any followups on Friday or Saturday)
Comment #16
Jeremy CreditAttribution: Jeremy commentedAck, brown paper bag release. That patch was bad, please use this one for testing the settings phase.
Comment #17
markus_petrux CreditAttribution: markus_petrux commentedJust looking at the code, at the top of install.inc there is:
...that's before anything else? ...but module_list() needs access to the DB. Is that a problem or missed something?
Another comment:
define('DRUPAL_MINIMUM_MYSQL', '3.23'); // if using MySQL
I'm not sure MySQL 3 supports some of the queries used here and there. I might be wrong here as well.
Comment #18
Jeremy CreditAttribution: Jeremy commentedGrab the next version of the patch. I was "cleaning up" and removed a global I shouldn't have. During the initial bootstrap we're unable to call module_list() as you've noted.
As far as I know, we still support MySQL 3.23. According to this page we support 3.23.17 or later. I've not heard an official decision to require MySQL 4 yet.
Comment #19
drewish CreditAttribution: drewish commented[pardon the null message, i just wanted to get subscribed to this issue]
Comment #20
ankur CreditAttribution: ankur commentedI tried a test run and install.php crashes on an error trying to do an include_once() of ./modules/system.install (somewhere in the code install.inc). I think it should really be an include_once() of ./system.install.
Also, it when I fixed the above and loaded install.php, I got a warning in red about a missing "./includes/install.apache.inc", but I'm guessing that is something that'll come later.
-Ankur
Comment #21
drummThis sorta traffic is why I don't see this being ready for 4.7.
It seems like we should add features to drupal_set_message() and make those availiable for theme_page() and theme_maintenance_page(). Distributions are free to retheme those as needed (or at least should be). Otherwise, you may consider that drupal_set_message() isn't the right thing to be using. I'd guess including a distribution-specific theme file and doing something in settings.php would make that work without a database and without modifying core files.
Comment #22
drummhttp://delocalizedham.com/node/80
Comment #23
Jeremy CreditAttribution: Jeremy commentedTo simplify the testing of this patch as it evolves, I've created a directory on my webserver in which I'm placing a pre-patched version of Drupal CVS HEAD.
I'm wondering if maybe there was a problem applying the patch? system.install lives in the modules subdirectory, so there shouldn't be a problem trying to include it from there. Please try getting a prepatched Drupal tarball here and let me know if the problem goes away.
My bad. :( The script I quickly wrote to generate the patch had a typo. I'm attaching another fixed patch.
Okay, I'll really be offline
Comment #24
Steven CreditAttribution: Steven commentedThe patch as it is now is a big monster... there is no way that it is going into 4.7 like this.
I agree with Neil that it should be split up.
My biggest concern is that it adds a bunch of requirements testing without doing anything with the checks we already have in place. For example, all the database.??sql files already check for the existance of the relevant foo_connect() function. Unicode.inc checks the version of the PCRE library. PgSQL checks for the database character set encoding. Admin/settings checks for permissions of directories and does that HTTP GET check to see if Clean URLs work.
Many hosts have a nasty tendency to do unannounced updates, which result in sites suddenly 'not working anymore' (don't you love those kind of forum posts?). So we need to verify these conditions not just on install, but during the site's lifetime as well.
IMO the install requirements checks should be merged with the run-time checks, and presented on a separate status page in the admin. This patch can be done orthogonal to the installer itself. The conditions that can be verified on install are merely a subset of the total checks.
Code comments:
$settings
arrays. But in function naming,settings
only refers to the settings.php variables (db_url, base_url, ...), not to requirements. This is very confusing."$/$file$"
is a particularly nasty regexp. First, using $ as delimiters is horrible because there is possible confusion both with the PHP $variable prefix and with the regexp 'end-of-string' operator. Secondly, the $file variable is not escaped, so if it contains "install.php", it would also match "installXphp". Thirdly, there is no reason here not to use str_replace.Finally after grokking the code, I'm still not convinced about the whole $settings array. It seems that mostly, it is shoehorning very simple checks into a very convoluted structure (with install.mysql.inc being the archetypical example). I get the impression it would be much simpler to let the install.foo.inc files provide singular API functions that can be used to verify a single condition.
Essentially, the Forms-API-like array structure provides a couple of programmatic advantages (e.g. being able to get a list of requirements, being able to merge identical requirements, being able to modify requirements), but none of these advantages are being exploited at all. For example, there is no human-readable description of a particular requirement (only of the error message if it's not present) and all requirements are simply checked module by module, with no resolving or post processing.
I don't see any of those things being needed, which means that using the $settings array just means it's a lot of unnecessary code.
Comment #25
Jeremy CreditAttribution: Jeremy commentedIUnable to sleep, I checked my email -- thanks for taking the time to do a lengthy review, Steven.
Sure, I'll split it into bite sized pieces once the full functionality is there. It's got a ways to go, though.
Okay, when I've got something I think is merge-ready, I'll look at making the API available to all of core, not just the installer, and then to replacing existing core checks with calls into the API. That seems a logical first step to getting this functionality merged.
Fixed.
Fixed.
Fixed. Requirements are now put in an array called $requirements to avoid confusion with settings.
Fixed. I've removed double-spaces and capitalized the first word of comments.
I'm not sure what you're referring to here.
Yes, the error messages need to be rewritten for clarity and usefulness. This is on my TODO list.
What are they replaced with? I thought it was just the use of array-brackets that was deprecated?
Fixed.
Okay, the regex was replaced with str_replace().
PHP does the same thing, that's where I got the idea... It's such a common typo.
Yes, at this time that's the only difference. Improving the installer theme is on my TODO list. If it turns out to be possible to get rid of the new install_page in favor of using the existing maintenance_page I will do so. I try to improve comments as I go, some are still missing or are vague and will be improved.
Thanks, fixed.
install.mysql.inc really doesn't do anything at the moment. Fleshing it out is the next step, as bootstrap phase three is where we make our connection to the database.
When I get to the profiles phase, that's when I'm planning to fully take advantage of the $settings (now $requirements) array. At the moment this is just a bootstrap which by its nature has to be somewhat simplistic.
The latest patch is attached. Or if you prefer you can download Drupal CVS HEAD with the patch pre-applied here.
Comment #26
Dries CreditAttribution: Dries commented+1 for smaller patches! :)
Step #1 could be the requirement checking. Useful (i) on installation, (ii) on upgrade and (iii) on 'post installation' (after recompiling PHP for example).
Comment #27
webchickOk. I've tested this patch on two environments I have access to with the Version 0.4 tar.gz from http://kerneltrap.org/jeremy/drupal/installer/. I ran out of time to test this on IIS, sorry. :( I also have access to shared hosting elsewhere and a Mac box and will try to get time in the next couple days to set those environments up.
Environment #1: Local XAMPP Lite install
Windows XP Pro SP 2, PHP 5.1.1, Apache 2.2.0, MySQL 5.0.18
Initial screen came up fine. Received an error in big red text below the settings fieldset:
"Your settings.php file is configured to use the default username and password. This is not allowed for security reasons."
This was kind of confusing, because of course the settings.php had the default username and password... I hadn't run the installer yet! ;)
Down below that, it tells me:
* Automatically fixed the permissions of file './cron.php'.
* Automatically fixed the permissions of file './index.php'.
* Automatically fixed the permissions of file './xmlrpc.php'.
* Directory "./files" does not exist.
* The "files" subdirectory can be created in your installation directory to store files such as custom logos, user avatars, and other media associated with your new site. The sub-directory requires "read and write" permission by the Drupal server process if you wish to provide this functionality.
* For improved Drupal performance and reduced bandwidth consumption you can enable the PHP zlib extension. If enabled, Drupal will compress cached pages and serve these pre-compressed pages to web browsers that support gzip.
* Your Base URL was automatically changed from the example 'http://www.example.com' to the detected URL 'http://localhost/drupal-installer'. (nice touch pre-filling the base URL box, btw)
I click "Save configuration" and am told Drupal has installed successfully. Still prompted about the files folder and the zlib thing. The settings.php file is written correctly. Yay!
Environment #2: Shared hosting (DreamHost)
Debian Linux (sarge), PHP 4.4.2, Apache 1.3.33, MySQL 5.0.16 phpinfo()
Result:
Fatal error: Call to undefined function: apache_get_modules() in /includes/install.apache.inc on line 65
From http://ca.php.net/apache_get_modules looks like this might be because DH is still on Apache 1.3.
So as a result...
Patch Review
1. Need to check for function_exists('apache_get_modules') .. possibly some other ones.
2. A check should be put in somehow to see if the installer has run first before displaying an error about default settings.php
3. Error messages should be displayed 'above the fold' -- I missed all the messages the first time around because my browser window was reduced size. Status messages are probably okay below the form.
4. If the files directory doesn't exist, it should probably attempt to create it, with the proper permissions. Or does this run into a whole issue where when PHP is running under 'php' then user 'me' can't access the stuff in there?
Comment #28
sepeck CreditAttribution: sepeck commentedSo I downloaded and tried it on an IIS6 system and got 'Unsupported install environment' with a link to the Drupal requirements page which lists IIS. Also some errors were listed.
"The following errors must be resolved before you can continue the installation process:"
* The cron.php file provides automation for Drupal functionality. Most installations will want this file properly installed. The file should be readable not writeable (The file must not be writeable as that would be a security risk).
* File "./index.php" is writable but should not be.
* The index.php file is Drupal's main interface with the world. This file must be readable and not writeable. (The file must not be writeable as that would be a security risk).
* File "./xmlrpc.php" is writable but should not be.
IIS doesn't use cron, it uses the system scheduler. The files it indicates as world writable are not to the best of my knowledge. I would be willing to run any test and provide any additional information requested.
Comment #29
Robin Monks CreditAttribution: Robin Monks commentedHere are a few places where checks are repeated in core:
PHP safe mode checks:
- cron.php, lines 12-15
- includes/locale.inc, lines 147-150
File writability:
- file.inc, lines 97-107
File existance:
- bootstrap.inc, lines 124-127, functions drupal_get_filename, line 150
- file.inc, lines 173-175;250-253;263-274;279;functions file_create_filename (342), file_save_upload (383), file_save_data (432), file_download (485)
- module.inc, line 59
And that's just a start on those style calls.
GZIP/gzencode checks:
- bootstrap.inc on lines 483-488
- common.inc, lines 1322-1333
DB version check:
- updates.inc on line 1492
- database.mysql.inc, 84
PHP version check:
- common.inc, 1125
Robin
Comment #30
traemccombs CreditAttribution: traemccombs commentedMy suggested CSS changes...
Not sure where these would go, but I stuck them in misc/maintenance.css while working on it. I didn't have that much time to work on this, so, I know it's not great, but there are some space improvements that I liked.
::: BEGIN CSS :::
body { font-family: Lucida Grande, Myriad, Andale Sans, Luxi Sans, Bitstream Vera Sans, Tahoma, Toga Sans, Helvetica, Arial, sans-serif; }
input, select { margin: 5px 0; }
input { padding: 3px; }
input:hover { border: 2px solid #93C5E4; }
input:focus { background: #E6F6FF; color: #0073BA; }
input.form-submit { padding: 0; margin: 0; }
html>body input.form-submit { padding: 3px; margin: 0; }
label { font-weight: normal; font-size: 0.8em; }
legend { font-size: 1.4em; }
p { color: #0073BA; }
div.messages {
border: 1px solid red;
padding: 10px;
}
::: END CSS :::
Feel free to let me know what you think.
Trae
Comment #31
m3avrck CreditAttribution: m3avrck commentedTrae brings up a good point.
If we are to theme this installer, we need to think about the other DB maintenance and 'Drupal down for maintenace' type pages. Those all need to be themed and consisently. I don't think the Drupal installer needs to be any different from those, but rather, all of those the same.
As such, here is hunk (or split) #2: theme the installer, DB maintenance, and Drupal-site down packages ... that can go in as a seperate patch.
Comment #32
Jeremy CreditAttribution: Jeremy commentedHere's an updated patch to address the issues raised so far, as well as general code cleanup. It also implements bootstrapping of the database, so now you don't see "install complete" until we've succesfully connected to and selected the database. A pre-patched tarball to ease testing can be found here.
The actual help messages generated by the installer are being looked at, and will be made less confusing soon.
Comment #33
m3avrck CreditAttribution: m3avrck commentedAwesome! Seemed to work perfectly on Windows XP with Apache 2.0.55.
A few issues though:
- Is there any way to detect a successful installation of Drupal? For example. if I goto http://www.example.com to install Drupal and I haven't already, is it possible to make the installer smart enough to detect Drupal has not been installed and to *automatically* call install.php ? This would certainly make the process more usable.
- I got a warning running install.php right away:
Obviously I haven't installed it, I'm running it for the first time. Seems a strange error to get as I attempt to install Drupal.
- Anyway for the installer to create the Drupal database, user and pass for MySQL?
Otherwise, things are shaping up quite well!
Comment #34
Jeremy CreditAttribution: Jeremy commentedAbsolutely, but that will come after the installer itself is fully functional.
Thanks for testing! Fixed, the installer doesn't show a "this site has not been configured" error anymore.
That's beyond the intended scope of the installer for now...
I've implemented initial support for profiles in the attached patch. Most of the file "database.mysql" has been moved into "system.include", and a new "./profiles/default.profile" file has been created. At this point, all the Drupal tables should be properly created for you, and the specified modules enabled, but the default values aren't set yet (I'm out of time for tonight.) More details and a pre-patched tarball can be found here.
(Known outstanding functionality includes: the ability to select from multiple profiles, the ability to set default database values, the _requirements_post hook, and preventing the installer from being run multiple times. Also, at this time the installer only works for MySQL, an install.pgsql.inc file still needs to be created.)
Comment #35
sepeck CreditAttribution: sepeck commentedScreen shot from my test.
IIS6, MySQL4 php4.x
Comment #36
Jeremy CreditAttribution: Jeremy commentedPHP is reporting that index.php, cron.php, and xmlrpc.php are all writable. You need to use windows explorer to make the files read only. Try right-clicking each the files and going to properties (or something like that, I've not used Windows in a long time).
Comment #37
Jeremy CreditAttribution: Jeremy commentedOkay, the installer is now capable of doing a basic Drupal installation. The help/error messages still need to be greatly improved, but the basic functionality is there. Table prefixing and PostgreSQL are not yet supported. The general idea is described here. A pre-patched tarball can be downloaded here.
Comment #38
Stefan Nagtegaal CreditAttribution: Stefan Nagtegaal commentedJeremy, maybe it's an idea to let the Documentation team have a look at your docs? You can reach them by mailing the drupal-docs@drupa.org mailinglist...
Comment #39
Jeremy CreditAttribution: Jeremy commentedSupport for table prefixing and PostgreSQL was added in this patch. Pre-patched tarball available here.
Comment #40
Jeremy CreditAttribution: Jeremy commentedI have opened a new issue in which I've created a patch with just the requirements api utilized by this installer. In the new patch, the requirements api is used by the core system module to verify the requirements of already enabled modules, and to verify the requirements of modules before they are enabled.
Comment #41
Dries CreditAttribution: Dries commentedHow can you use the installer to install Drupal in a subdirectory?
I tried installing a copy of Drupal on http://localhost/~dries/drupal-cvs/. After the installation, it said "Congratulations, Drupal has been successfully installed. Please review any warnings or errors that you might see above before continuing on to your new website.". The link to the new website pointed to http://localhost/.
When I went to the proper URL, I started getting "warning: Cannot modify header information - headers already sent by (output started at settings.php:109)" messages.
Looks like it wrote
$installed = 'default';
after my closing php tag. Odd.When you already have a site setup it claims it installed Drupal, but in reality it didn't do anything. Or so it seems.
Comment #42
Jeremy CreditAttribution: Jeremy commentedResynched to head, using the new conf_path() function instead of conf_init(). Pre-patched tarball available here.
Comment #43
Jeremy CreditAttribution: Jeremy commentedBig update to add better profile support and to resync with CVS HEAD. Prepatched tarballs can be found here.
Comment #44
chx CreditAttribution: chx commentedtrying to fix HTML.
Comment #45
chx CreditAttribution: chx commentedstill trying.
Comment #46
Steven CreditAttribution: Steven commentedI'm quite unhappy to see that we still have that giant deferred $requirements array in there. I keep reading through the code, and it is not obvious at all. It reminds me of the update system, as in everything the update system does right, this seems to do wrong.
Keeping in mind that checking requirements is an easy and fast process, which does not need to happen often... what downsides other than redundancy would there be if we did not merge requirements and checked each requirement directly? You might say that it is useless to present the same requirement violation twice. I would like to turn that around: as an administrator, wouldn't it be nicer to know exactly which modules I cannot run on my install? And how often do requirements duplicate anyway? Drupal itself is the most demanding factor in 90% of the cases, I'd imagine. Being able to see whether my install fails because one module or because of the base layer + 10 modules is significant. If we couple requirements with module dependencies, you can avoid many redundant checks.
If you look at all the requirements checking, there are three big pieces of code which are IMO unnecessary:
_merge_requirements()
and its invocations).drupal_verify_install()
).drupal_verify_install_apache()
,drupal_verify_install_mysql()
and even indirections beyond this level!).If you remove this, all that remains is a bunch of independent functions, which each can be used to verify single conditions. It is still a requirements API. If a module needs to verify requirements at any phase in the installation, it would implement a hook (e.g. install_pre) where, instead of building a giant $requirements array and returning it, it simply evaluates each requirement directly. Just as now,
drupal_set_message(... 'error')
would be used to signal errors. The difference is minor:Where appropriate, we can still provide an API function to check a single requirement:
Forms API-like abstractions are tempting because they look clean at first. But that needs to be contrasted to the entire support infrastructure which is needed to maintain that abstraction. As I've pointed out above, I think the abstraction fails in several ways (because it is not consistent enough) and does not offer enough benefits to justify it.
Other than that, I spotted some bad code. I remember fixing many of these things in statistics.module a while ago, which I think you wrote as well. Please pay attention to code quality. It saves considerable time later.
Comment #47
Dries CreditAttribution: Dries commentedI have to agree with Steven. The requirement checking is somewhat clumsy. Weren't we go to submit the requirement checking as a separate patch?
Comment #48
gopherspidey CreditAttribution: gopherspidey commentedWhen I was testing out the installer, by accident, I pointed the installer to an existing drupal database and not the empty db that I intended it to be pointed to. Of course the install failed with "unable to create table" statements. But what I did not like was that the installer gave me no chance to correct my mistake. To correct that mistake, I had to unroll the tarball agian, because I could not figure out what I needed to change to restart the installer. To me this was no big issue, but I feel that this issue should be addressed.
The second thing that I ran into was when I attempted to install the civicspace profile. I got to the error screen telling me that I did not have the required modules (civicrm) that I needed. That was fine, but the installer did not give me the option of continuing the install or tell me how I should continue the module were installed.
Also a nice addition to the installer would be to allow the option for you to enter a Database Admin account info, and then the installer would also create the database and the drupal db user. I have seen this done on other projects (gallery2, and some other CMS).
Are there any plans to add a downloader to the installer? The install downloader could download submitted install profiles, themes and modules from drupal.org. Extract them into correct directories. Just an Idea.
The installer seems like a good start, I just needs a like more polish.
Comment #49
chx CreditAttribution: chx commentedIf things go as I plan then this evening I will be able to apply Steven's review to this patch.
Comment #50
Bèr Kessels CreditAttribution: Bèr Kessels commentedI miss four important options and features. Maybe I did not fully understand what is going on, that could be the main problem :)
[1] Allowing the same application, in the same runtime environment to "write its own code" is considered a security hole on the "better" hosts. I was told that Joomla breaks on about 1/4th of the hosts because of this. We do the same: we allow the application (Drupal) to srite into its own code, from the web. Debian and SuSE (and I was told RedHat too) being the biggest chunk of servers out there, do *not* allow PHP writing executable files in their default configuration.
[2] An alternative could be to fall back to the default installation, with a proper message that the user should fall back to that default installation, usnig FTP/CLI etc.
Comment #51
Bèr Kessels CreditAttribution: Bèr Kessels commentedtypo under four: "We cannot create a database table" should be: "We cannot create a *database* with a database user"
Comment #52
Bèr Kessels CreditAttribution: Bèr Kessels commentedAnother thing I cannot find. Again, maybe its just me.
A way to provide a different directory for files then /files/.
My sites all have their files under sites/example.com/files but I did not manage to get those working with the installers. Other sites prefer to not have thier files in a public space (private files).
Comment #53
chx CreditAttribution: chx commentedLet's continue at http://drupal.org/node/68926 .
Comment #54
drumm