Custom installation

Permalink
Hi,

I am trying to make a package with a few extra custom blocks that will automatically be set during installation.

While going through the source code, I noticed that already installed blocks (such as Youtube player, HTML, Flash etc) do not use the same format as the user installed ones. And by that I mean the new block doesn't end up in the concrete/blocks folder. But there is, however, an entry in the database inside the "blocktypes" tab.

So my question would be, which important files are created/modified in the concrete folder and is there any other entrys in the database aside from the one I mentionned earlier when the user adds a new block type?

 
Doki replied on at Permalink Best Answer Reply
Doki
As background, when dealing with blocks and packages, there are four potential directories where data can be located.

There are two "Concrete5 default code" directories:

(web home)/concrete/blocks -- This is where the default pre-installed blocks (Youtube Player, HTML, et al) are housed. If you have to make a modification to any of the pre-installed blocks, you can find the code here. You can also add new blocks to this directory and everything will work just fine, but this is not recommended.

(web home)/concrete/packages -- This is where the default pre-installed packages are installed. Since there are none, this directory should be empty. You can add new packages to this directory and everything will work just fine, but this is not recommended.

There are two "Concrete5 customs code" directories:

(web home)/blocks -- This is where any marketplace installed blocks will go, as well as where you should put your customized block data. To my knowledge, since all items off the marketplace are packages, and since we all should get into the habit of "packagizing" our blocks, this directory will probably be empty most of the time. I personally use it to test blocks and code snippets before adding them to a package.

(web home)/packages -- This is where any marketplace installed packages will go, as well as where you should put your own customized packages. Anything downloaded from the marketplace will be found here.

One of the design philosophies of packages, especially ones from the marketplace, is that the packages be totally modular, meaning that they can be thrown in and out of the (web home)/packages directory without needing any extra install steps or work from the user (there are exceptions, but this is discouraged). The main driving force behind this is to make life as easy as possible for system administrators and website hosts/masters who have little or no knowledge of coding or complicated setups. So from the philosophy above, when an item is installed from the marketplace, there should be no additions or modifications to any code in the (web home)/concrete directories. Any code from the core Concrete5 that does need to be overridden in the package doesn't actually modify the core code, but has necessary changes to the core code added in the package directory. One of the advantages to using Concrete5 is that Concrete5 knows when running the package to use the libraries found in the package itself first, before using the core code.

As for the database, whenever a block or package is installed, the database is updated according to instructions found in a file titled db.xml, which is located in the home directory of each block within a package. So, for instance, if you have a package called "alpha", containing two blocks named "beta" and "gamma", you should see two db.xml files, in the following places:

(web home)/packages/alpha/blocks/beta/db.xml
(web home)/packages/alpha/blocks/gamma/db.xml

The standard is to have these files create a table in the Concrete5 database for each block, with the naming convention "bt(capitalized block name)". So using the example above, on the installation of "alpha", we would see two new tables in the database, one titled "btBeta" and the other titles "btGamma".

Aside from that, there are several tables that are modified when a block/package is added and subsequently whenever a block is added or removed from a page. Because these tables are handled internally within Concrete5, there is usually never a reason to modify or manipulate these tables manually. I can list exactly which tables these are however if you request.

Hope this helps.
Xenavar replied on at Permalink Reply
Yes, that helps alot.
Thanks!
Mnkras replied on at Permalink Reply
Mnkras
i just created a custom install script
kumarbalap replied on at Permalink Reply
Hi Mnkras,

I need help on creating custom install script.

Actually I want to directly get in to the site, after installing the script.I don't want to show the Install form..etc.

Just wondering, what is the correct way to do the same.

I have tried the following,

1) I have added a script to install the SQL and config/site.php file in the index.php file in site root, before including the "dispatcher.php"

I'm thinking the following also
2) In single_pages, adding a install.php to directly submitting the form through javascript

Can you please let me know the better way of handling the install