mirror of
https://github.com/joomla-extensions/weblinks.git
synced 2024-06-03 06:50:49 +00:00
Change local configuration to real INI format
This commit is contained in:
parent
b3d4ecf6a3
commit
35840637b8
|
@ -1,5 +1 @@
|
||||||
<?php
|
skipClone = true
|
||||||
|
|
||||||
$configuration = array(
|
|
||||||
"skipClone" => true, // default is false
|
|
||||||
);
|
|
26
RoboFile.php
26
RoboFile.php
|
@ -164,7 +164,7 @@ class RoboFile extends \Robo\Tasks
|
||||||
*/
|
*/
|
||||||
public function createTestingSite()
|
public function createTestingSite()
|
||||||
{
|
{
|
||||||
if (!empty($this->configuration['skipClone'])) {
|
if (!empty($this->configuration->skipClone)) {
|
||||||
$this->say('Reusing Joomla CMS site already present at tests/joomla-cms3');
|
$this->say('Reusing Joomla CMS site already present at tests/joomla-cms3');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -182,30 +182,24 @@ class RoboFile extends \Robo\Tasks
|
||||||
/**
|
/**
|
||||||
* Get (optional) configuration from an external file
|
* Get (optional) configuration from an external file
|
||||||
*
|
*
|
||||||
* @return array
|
* @return \stdClass|null
|
||||||
*/
|
*/
|
||||||
public function getConfiguration()
|
public function getConfiguration()
|
||||||
{
|
{
|
||||||
$configurationFile = __DIR__ . '/RoboFile.ini';
|
$configurationFile = __DIR__ . '/RoboFile.ini';
|
||||||
|
|
||||||
if (!file_exists($configurationFile)) {
|
if (!file_exists($configurationFile)) {
|
||||||
$this->say("No local configuration file");
|
$this->say("No local configuration file");
|
||||||
return array();
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
$configuration = parse_ini_file($configurationFile);
|
||||||
require_once $configurationFile;
|
if ($configuration === false) {
|
||||||
if (!is_array($configuration)) {
|
$this->say('Local configuration file is empty or wrong (check is it in correct .ini format');
|
||||||
$this->say('Local configuration file is empty or wrong (it must contain a $configuration array');
|
return null;
|
||||||
return array();
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return $configuration;
|
return json_decode(json_encode($configuration));
|
||||||
}
|
|
||||||
catch (Exception $ex)
|
|
||||||
{
|
|
||||||
$this->say('Exception reading local configuration file: ' . $ex->getMessage());
|
|
||||||
return array();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue
Block a user