Creating your own installation script with Custom Theme

Permalink 1 user found helpful
I would like to pre-install some themes in an installation of concrete, I have managed to install the auto-reset script and can pre-install some of the add-ons but would like to install it with some extras that I create every time I set up a new site.
Mainly Scrapbook-items, Custom Theme

Can anyone point me towards some useful code to do this?

TheRealSean
 
TheRealSean replied on at Permalink Reply
TheRealSean
Has anyone done anything like this before??
madeforspace replied on at Permalink Reply
madeforspace
Mnkras replied on at Permalink Best Answer Reply
Mnkras
Seanom, download concrete 5.3.3.1 and look at /concrete/controllers/install.php
TheRealSean replied on at Permalink Reply
TheRealSean
I am looking in the 5.4.1.1 version but I think I have found the bit I am after.

So in theory I could export my db and use the sample data schema to then import it(as long as I copy the relevant files folders across).

Although I again assume this will only be good until the next update?

But this would give me the option to run the reset script or install from fresh and have it installed with my sample data/attributes/single pages already installed.

Thanks for the tip
jordanlev replied on at Permalink Reply
jordanlev
I would create a package and just install the package first thing whenever you install a site. It's going to keep your code much more maintainable (and you can go back and update sites that it's already installed to more easily this way).
TheRealSean replied on at Permalink Reply
TheRealSean
This is also a promising idea, and sounds feasable. I do not need to go backwards at this point I have already done the leg work :)

But for future projects something like this could work the problem I currently have with Packages is refreshing them I never seem to be able to alter the schema of a package by refreshing it like I can with a block.

But I assume you can edit themes from a Package, and I know you can create single pages, page/user attributes.

So I think this may be a longer to implement, to get it working correctly but could be a better solution in the long run and with future upgrades of the core easier to edit at a later date.
jordanlev replied on at Permalink Reply
jordanlev
You can refresh the blocks in a package by going to Dashboard -> Add Functionality -> click "Edit" next to package name, then click "Edit" next to each block in the package, and from there you can click the "Refresh" button.

If you have a db.xml file for the package itself, it will get refreshed when you click the "Refresh Databases" button in Dashboard -> Sitewide Settings -> Debug.
TheRealSean replied on at Permalink Reply
TheRealSean
I wish I could give you both the best answer, here
Mnkras points out the core file location and I think this will be my immediate solution,

but I will be looking to create a package.

I am not sure how the Karma, works but I will assign to Mnkras first and then adjust to Jordanlev in the hope you both get some Karma.

Thanks again for your help as always its really appreciated.
ijessup replied on at Permalink Reply
ijessup
I wrote a script that checked for, and installed, all available packages. I'll see if I can dig it up!

If I remember correctly, it was pretty simple.
ijessup replied on at Permalink Reply
ijessup
Throw this in the install file...
// install all currently not installed packages
foreach(Package::getAvailablePackages() as $pkg) {
   $pkg->install();
}
//install all currently not installed themes
foreach(PageTheme::getAvailableThemes() as $theme) {
   PageTheme::add($theme->ptHandle);
}
jordanlev replied on at Permalink Reply
jordanlev
I appreciate your concern with the karma, but I wouldn't worry about it -- both Mnkras and I have enough already :)