Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Installation wizard #21

Closed
vaibhav-kaushal opened this Issue · 18 comments

5 participants

@vaibhav-kaushal

I am working on a installation wizard. It is simple one but I am stuck at one point.

The installer actually has to check whether or not the configuration.inc.php exists and if it does not, it would create it. There are two options that I am thinking of:

  • Insert the complete text into the installer script and then write it into the new file.
  • Copy configuration.inc.php.sample into memory and while outputting, replace the variables with what the user enters in wizard.

in first case, the problem is that if we update the configuration.inc.php.sample, then we have to update the installer script as well. In second case, the problem is: if the format of file changes (mainly merging two lines into single line), then the script will not work as needed.

What can be done? I need advice from other core contributors.

@koopa
Owner

What about using placeholders in the sample and then simply replacing those and writing them out to the actual config? For example:

define('SERVER_INSTANCE', '{{SERVER_INSTANCE}}');
[...]
define('DB_CONNECTION_1', serialize(array(
            'adapter' => '{{DB_CONNECTION_1_ADAPTER}}',
[Etc.]

That way you could probably even generate needed inputs dynamically based on preg_match_all('/\{\{(\S+)\}\}/') or something like that and the need for ever updating the install script would be gone.

Just an idea, maybe it's a bad one?

@scottux
Owner

Has anyone used QCubed in large projects of multiple developers? This file can have many many SERVER_INSTANCE cases, depending on the local setup of the user. I typically will create an instance.inc.php file locally that is added to .gitignore, then I add this to configuration.inc.php:

<?php
// Include definitions for your local environment in here:
$strPathToInstanceFile = dirname(__FILE__) . '/instance.inc.php';
if (is_file($strPathToInstanceFile)){
    require($strPathToInstanceFile);
}
?>

I only use the configuration.inc.php definitions for production servers that I have control over. I have thought of making some defaults like 'Linux', 'MAMP', 'Mac Native', 'WAMP', etc... but I can never be sure what a developer would have locally and I hate for this file to have to get that large. I think it worked for a time but needs to be broken into smaller sections or just thought out a bit more.

@vaibhav-kaushal

This wizard is for the people who want to start off immediately without having to wait for it. Not everyone reads a 'readme' file. The wizard should just get a new guy started. Things that you ( @scottux ) mentioned are for people who are experienced (and the ones who are probably would not need a wizard anyway). I have seen most people just get stuck at the point when a default installation is done and it shows some error or blank page.

I think that the placeholder idea is good. But for that, we would have to modify the sample file as well. If others agree, I can try hands on that.

@scottux
Owner

Okay, so the installer would basically expound the start_page experience then? give some diagnostics, ask some questions, and get you going?

I could envision "welcome to qcubed" -> asking for docroot -> then going to db settings -> then moving into codegen -> jQuery preferences -> Custom assets -> and allowing experienced people to click "finished" when they are ready. So a typical setup where there is a next and a finished button.

I like the placeholder method, but it may fall short in some instances. I'd like to have it able to choose a CDN-hosted jQuery or the local version, so there wouldn't be a replace so much as a comment/uncomment line routine.

And I find a lot of those issues are from people who are new to PHP, or at least OO PHP, not just QCubed. Wordpress set the bar high for getting a PHP platform up and running by a total newcomer. We can assume a lot of people are running XAMPP or something similar, and that they aren't going to understand what php.ini settings are required, or why such a thing even exists. If we make this thing, it has to account for a lot of different setups and ensure error reporting is very clean.

@vaibhav-kaushal

You envisioned a lot of steps. There are just 3 steps - first detecting the current installation directory. Second will ask for basic path variables (Docroot, subdir, Virtual directory) and database settings for the first database. Third step is to see if the 'INCLUDES/configuration' directory has a configuration.inc.php already. If it is there, show the file contents in the browser and not write the file. If the file is not there, it would create the file.

It's purpose is to simply create a 'basic configuration.inc.php file' to get the developer started. Once the wizard is done, the wizard will request the developer to read the comments in the config file. We can think of additional steps as we move along. We can start off with the basic things as of now.

@scottux
Owner

Yeah, I think grand schemes. I fully believe in iterations, but I like to brainstorm as far as I can then break that into smaller chunks - that way we can think ahead a bit and have a plan. What you are proposing is easy enough to do just by looking through one file that the user would have to open anyway - so I am not seeing the total benefit yet.

We should still at least get something up to make the start_page more useful.

While on the topic, it should be secure as I've seen a couple of these: http://www.butlersbuddy.com/quote/assets/_core/php/_devtools/start_page.php with a simple google search of "Welcome to qcubed"

@var-foo
Owner

I like the idea of having an installation wizard. configuration.inc.php can be a bit daunting and probably needs to at least be reorganized. One of the main problems everyone runs into though is file/folder permissions during installation. If you don't have your permissions set up properly, the wizard is going to bomb anyway because from what I can tell, it's just going to modify/create configuration.inc. The start page tries to help you out by telling you what your docroot probably is, if you have permission issues, etc. @vaibhav-kaushal I agree that this would be a good first step, but I also agree with @scottux that we should probably make it a bit more robust if we're going to dive into it.

I also think that while we're doing it, we should put up a wiki page here on github about how to install with or without the installer (obviously starting on without since we don't yet have this feature).
Lets get a bullet-list of features we want to have in the installer together. By then, we should have agreed on a workflow, and we can get cranking on it.

@scottux
Owner

I have started on the Readme, and there is an installation section - it really needs some verbiage about the newest features. #25 please leave any feedback you can there so we can release that.

@olegabr
Owner

@vaibhav-kaushal, good effort! i vote for the very minimalistic installer script now. we always can enhance it later.

@vaibhav-kaushal
@olegabr
Owner

" to create the configuration.inc.php. once that is ready, we can utilize the framework
itself to build a good installer (the remaining parts of the installer)"

good plan!

@scottux
Owner

That sounds like a plan. Can you create an installer branch and work on it there? Then when it is ready we can test it and merge it into a release branch for 2.2 which should hopefully contain the jQuery UI 1.9 updates and some of the other contributions that have been coming in.

@vaibhav-kaushal
@olegabr
Owner

hello, @vaibhav-kaushal! can this task be done for the upcoming 2.2 release or should it be moved to the next 2.3 Release milestone?

@vaibhav-kaushal
@olegabr
Owner

We are not bound to a specific date, but we have enough complete features and bugfixes to make new release

@vaibhav-kaushal
@vaibhav-kaushal

I have submitted a pull request in #86 . Please test and let me know of any problems. I am closing this since this is a request that has been fulfilled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.