Merge pull request #7970 from JakubOnderka/fix-diagnostics

fix: [internal] Try to create directory if not exist
pull/7984/head
Jakub Onderka 2021-11-18 18:21:20 +01:00 committed by GitHub
commit 5a4e47f5c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 21 additions and 8 deletions

View File

@ -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
])

View File

@ -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]);

View File

@ -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"));
}

View File

@ -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) {

View File

@ -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