Merge pull request #3204 from GinkgoFJG/CRM-14662
[civicrm-core.git] / CRM / Extension / Container / Default.php
1 <?php
2
3 /**
4 * The default container is just a basic container which can be configured via the
5 * web UI.
6 */
7 class CRM_Extension_Container_Default extends CRM_Extension_Container_Basic {
8
9 /**
10 * {@inheritdoc}
11 */
12 public function checkRequirements() {
13 $errors = array();
14
15 // In current configuration, we don't construct the default container unless baseDir is set,
16 // so this error condition is more theoretical.
17 if (empty($this->baseDir) || !is_dir($this->baseDir)) {
18 $civicrmDestination = urlencode(CRM_Utils_System::url('civicrm/admin/extensions', 'reset=1'));
19 $url = CRM_Utils_System::url('civicrm/admin/setting/path', "reset=1&civicrmDestination=${civicrmDestination}");
20 $errors[] = array(
21 'title' => ts('Invalid Base Directory'),
22 'message' => ts('The extensions directory is not properly set. Please go to the <a href="%1">path setting page</a> and correct it.<br/>',
23 array(
24 1 => $url,
25 )
26 )
27 );
28 }
29 if (empty($this->baseUrl)) {
30 $civicrmDestination = urlencode(CRM_Utils_System::url('civicrm/admin/extensions', 'reset=1'));
31 $url = CRM_Utils_System::url('civicrm/admin/setting/url', "reset=1&civicrmDestination=${civicrmDestination}");
32 $errors[] = array(
33 'title' => ts('Invalid Base URL'),
34 'message' => ts('The extensions URL is not properly set. Please go to the <a href="%1">URL setting page</a> and correct it.<br/>',
35 array(
36 1 => $url,
37 )
38 )
39 );
40 }
41
42 return $errors;
43 }
44 }