forked from kraftwagen/kraftwagen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dir.upload.setup.kw.inc
41 lines (34 loc) · 1.46 KB
/
dir.upload.setup.kw.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
/**
* @file
* This file contains the functions that are required to execute
* `drush kw-setup-upload-dir`.
*/
/**
* Implements drush_COMMAND_init() for `drush kw-setup-upload-dir`.
*/
function drush_kw_setup_upload_dir_init() {
kraftwagen_context_init_kraftwagen_root();
}
/**
* Implements drush_COMMAND for `drush kw-setup-upload-dir`.
*/
function drush_kraftwagen_kw_setup_upload_dir() {
// Find out where the Kraftwagen root is.
$root = kraftwagen_context_get_option('root-path');
// Determine config directory.
if (!($dir_cnf = kraftwagen_context_get_option('cnf-dir'))) {
return drush_set_error(dt('No cnf dir name set.'));
}
if (!($dir_files = kraftwagen_context_get_option('files-dir'))) {
return drush_set_error(dt('No files dir name set.'));
}
if (is_dir($root . DIRECTORY_SEPARATOR . $dir_cnf . DIRECTORY_SEPARATOR . $dir_files)) {
drush_log(dt('Files dir at !path already exists', array('!path' => $root . DIRECTORY_SEPARATOR . $dir_cnf . DIRECTORY_SEPARATOR . $dir_files)), 'warning');
}
else {
drush_mkdir($root . DIRECTORY_SEPARATOR . $dir_cnf . DIRECTORY_SEPARATOR . $dir_files);
drush_log(dt('Files dir at !path created', array('!path' => $root . DIRECTORY_SEPARATOR . $dir_cnf . DIRECTORY_SEPARATOR . $dir_files)), 'success');
}
drush_log(dt('You\'ll want to make !path writable for your webserver user.', array('!path' => $root . DIRECTORY_SEPARATOR . $dir_cnf . DIRECTORY_SEPARATOR . $dir_files)), 'ok');
}