using install_drupal function to install a new drupal - drupal-7

I want to use install_drupal() function to install a new drupal in sites/[site_name].
in install_drupal() function there is not any variable(or at least I haven't seen) to indicate the site path to install.
Now if I have 3 folders in my sites folder(sites/site_1, sites/site_2, sites_3) How can I say install site_2?
Drupal version is 7.
Thanks,

I don't believe you can use this function in this way. install_drupal($settings = array()) accepts a settings array but I don't see anything in the documentation that suggests you can set the site name.
To install a new Drupal site, you have to create your site folder + your settings.php file then navigate to http://yourdomain.com/sitename.install.php OR http://subdomain.yourdomain.com/install.php.
You may be able to run install_drupal() programmatically (using drush -- not too sure as I've never tried this) once you have you already have your site folder and settings.php. Check the documentation to see what information you would have to provide in the $settings variable.

Related

CakePHP 3 Audit Log, working with admin routes?

I'm trying to work with this CakePHP 3 plugin which I think does exactly what I need it to do, but am struggling big time! I'm new to CakePHP 3, composer and fiddling with routes etc (previously CakePHP 2.x and manual installation and never played with routes).
The plugin does not appear to be maintained any longer and the package does not exist when trying to install via composer, so I forked it and cloned the files to /plugins/AuditLog/
I've run updated my app composer.json file, loaded the plugin in my bootstrap.php, and run composer install on /plugins/AuditLog/ to load the dependencies from the plugin composer.json file (not sure if this is the right thing to do?)
In plugins/AuditLog/config/routes.php there is the following code
Router::plugin('AuditLog', function ($routes) {
$routes->prefix('admin', function ($routes) {
$routes->fallbacks('DashedRoute');
});
$routes->fallbacks('DashedRoute');
});
So a bit of searching in the CookBook and I read for the first time about 'prefix routing', which from what I can tell means I should be able to reach the pages via /admin/audit-log/audits (for example).
Not surprisingly, I get a missing controller error here
Error: Create the class AdminController below in file: src/Controller/AdminController.php
The instructions for the plugin don't mention anything about creating an admin controller, and there are no controller files anywhere in the plugin at all actually, despite there being views and models.
I'm really out of my depth here, can anyone help me untangle this? Where/how to add which controllers and get them pointing to the right place?

How to find out which version of Silverstripe a site is using, looking at the source code?

I have been given a Silverstripe site to maintain. How do I know which version of Silverstripe it's using, by looking in the source code?
If your SS installation was made through composer you can have a look to composer.json in the root directory.
If it's a 3.x.x version you can also leave the mouse on the SS logo in backend (upper left corner) and the anchor title wil show you the version. Maybe it works also for 2.x.x versions, but I'm not sure.
The Depreciation class provides the version.
$version = Deprecation::dump_settings()['version'];
There is a function in the LeftAndMain class called CMSVersion. This is the function which is used to fill in the version information in the title attribute on the ss logo in the cms as mentioned in the accepted answer. This function attempts to get the version information from the composer.lock file. It will fallback to the /framework/silverstripe_version and /cms/silverstripe_version files if the composer.lock file doesn't exist. So to find the version in the source code, look in composer.lock, then /framework/silverstripe_version and /cms/silverstripe_version
In the folder "framework" is a file "silverstripe_version" with the Silverstripe version.
Inside the Folder Framework there is a README.md file. Inside that you'll finde the Version Number.
Also inside framework Folder there is _config.php, there you have a variable like Deprecation::notification_version('3.1.0'); In this example, Version 3.1.0

CakePHP searching for DebugKit at wrong path

I am trying to import DebugKit and CakePHP is producing the following error: DebugKit.ToolbarComponent could not be found.
Right below it, it says:
Create the class ToolbarComponent below in file:
/Users/SomeUser/Sites/SomeProject/app/Plugin/DebugKit//Controller/Component/ToolbarComponent.php
If you notice though, there are two slashes between DebugKit and Controller for some reason, and that's obviously not a real directory. The server running PHP 5.4.17. I have followed the exact installation instructions listed here. Any suggestions?
I had the same problem and solved it by changing the permissions to 755 to folders within DebugKit.
When I encountered this problem, I realized I had a Plugin/DebugKit folder structure in my project's root, and under the app directory. The one under app was empty, save for a blank file called empty. Strange. I have no idea how this happened. (Perhaps from accidentally running composer as non-root?) I deleted app/Plugin/DebugKit, and moved the one from the project root into app. No more error.
DebugKit does not currently seem to be compatible with cakephp 3.0 even though it is the example in the documentation.
The latest version still seems to use the 2.x methods.
I will also submit a ticket regarding this to update their documentation to prevent confusion.
If there is something I missed regarding this issue and it is actually possible to install this, let me know.

How to prevent Joomla site creating unwanted folder

I have a menu link with the alias "inside" on a joomla 3.1.5 site here: http://naiwellness.com
Every morning I check the site and a folder named "inside" has been created in the root dir which prevents the site from loading as it should, instead displaying a directory contents listing at http://naiwellness.com/inside
Anyone have any ideas how to prevent this please?
Thanks
This is just a theory, but check the xml files of your installed modules and plugins (most likely a plugin) for this line...
<folder>inside</folder>
and if it exists try deleting that line of code - or better still uninstall the extension - that should fix it. It's possible that a plugin requires that folder and has php code to create the folder if it doesn't exist - and so creates the folder each time it is run - i.e. when the site is loaded. The above line of xml code I have asked you to look for will go someway to helping determine if this is the case.

How do I install a CakePHP plugin?

More easy questions - this time, how do I install a CakePHP plugin? I get that I take the plugin folder and put it in the, well, the plugins directory.
so
/app
/plugins
/what is this?
And I ask this, because I just downloaded a plugin - here:
http://milesj.me/blog/read/changelog-forum-2.3
And the name of the folder that everything is in is milesj-cake-forum-29a0699
This doesn't appear to be a good plugin name... is there some place that lists or describes what the plugin should be called? I know i know, I'm going to try it out without the 29stuff, but I like things to be silky smooth, not "trial and error".
Yes, I am a terrible programmer.
Based on the plugin's documentation, they refer to models as Forum.Profile for example which suggests that the plugins should be installed in APP/plugins/forum as that's where the CakePHP autoloader will look unless instructed otherwise (section 2).
for example fb plugin ; Load the plugin in your app/Config/bootstrap.php file:
//app/Config/bootstrap.php
CakePlugin::load('Facebook');
You can use all or some of the Facebook plugin as you see fit. At the very least you will probably want to use the Facebook Helper
public $helpers = array('Facebook.Facebook');

Resources