mirror of https://github.com/MISP/MISP
Merge pull request #7970 from JakubOnderka/fix-diagnostics
fix: [internal] Try to create directory if not existpull/7984/head
commit
5a4e47f5c3
|
@ -28,10 +28,7 @@ class StartWorkerShell extends AppShell
|
|||
$parser = parent::getOptionParser();
|
||||
$parser
|
||||
->addArgument('queue', [
|
||||
'help' => sprintf(
|
||||
'Name of the queue to process. Must be one of [%]',
|
||||
implode(', ', $this->BackgroundJobsTool->getQueues())
|
||||
),
|
||||
'help' => 'Name of the queue to process.',
|
||||
'choices' => $this->BackgroundJobsTool->getQueues(),
|
||||
'required' => true
|
||||
])
|
||||
|
|
|
@ -85,7 +85,9 @@ class BackgroundJob implements JsonSerializable
|
|||
$this->args()
|
||||
),
|
||||
$descriptorSpec,
|
||||
$pipes
|
||||
$pipes,
|
||||
null,
|
||||
['BACKGROUND_JOB_ID' => $this->id]
|
||||
);
|
||||
|
||||
$stdout = stream_get_contents($pipes[1]);
|
||||
|
|
|
@ -383,7 +383,7 @@ class Galaxy extends AppModel
|
|||
throw new NotFoundException(__('Invalid %s.', $target_type));
|
||||
}
|
||||
$target = $target[0];
|
||||
$local_only = $cluster['Galaxy']['local_only'];
|
||||
$local_only = $cluster['GalaxyCluster']['Galaxy']['local_only'];
|
||||
if ($local_only && !$local) {
|
||||
throw new MethodNotAllowedException(__("This Cluster can only be attached in a local scope"));
|
||||
}
|
||||
|
|
|
@ -3157,8 +3157,12 @@ class Server extends AppModel
|
|||
);
|
||||
foreach ($writeableDirs as $path => &$error) {
|
||||
if (!file_exists($path)) {
|
||||
$error = 1;
|
||||
} else if (!is_writable($path)) {
|
||||
// Try to create directory if not exists
|
||||
if (!mkdir($path, 0700, true)) {
|
||||
$error = 1;
|
||||
}
|
||||
}
|
||||
if (!is_writable($path)) {
|
||||
$error = 2;
|
||||
}
|
||||
if ($error !== 0) {
|
||||
|
|
|
@ -42,7 +42,11 @@ class SystemSetting extends AppModel
|
|||
*/
|
||||
public static function setGlobalSetting()
|
||||
{
|
||||
/** @var self $systemSetting */
|
||||
$systemSetting = ClassRegistry::init('SystemSetting');
|
||||
if (!$systemSetting->databaseExists()) {
|
||||
return;
|
||||
}
|
||||
$settings = $systemSetting->getSettings();
|
||||
foreach ($settings as $settingName => $settingValue) {
|
||||
$firstPart = explode('.', $settingName)[0];
|
||||
|
@ -52,6 +56,12 @@ class SystemSetting extends AppModel
|
|||
}
|
||||
}
|
||||
|
||||
public function databaseExists()
|
||||
{
|
||||
$tables = ConnectionManager::getDataSource($this->useDbConfig)->listSources();
|
||||
return in_array('system_settings', $tables, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
* @throws JsonException
|
||||
|
|
Loading…
Reference in New Issue