Change enable_upload to isUploadEnabled()
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
This commit is contained in:
parent
1af9a6ca13
commit
6f9cd76f01
@ -603,12 +603,6 @@ parameters:
|
||||
count: 1
|
||||
path: src/Config.php
|
||||
|
||||
-
|
||||
message: '#^Only booleans are allowed in a negated boolean, string\|false given\.$#'
|
||||
identifier: booleanNot.exprNotBoolean
|
||||
count: 1
|
||||
path: src/Config.php
|
||||
|
||||
-
|
||||
message: '#^Only booleans are allowed in an if condition, string\|false given\.$#'
|
||||
identifier: if.condNotBoolean
|
||||
@ -3630,24 +3624,12 @@ parameters:
|
||||
count: 1
|
||||
path: src/Controllers/Table/ChangeController.php
|
||||
|
||||
-
|
||||
message: '#^Parameter \#2 \$isUpload of method PhpMyAdmin\\InsertEdit\:\:getHtmlForInsertEditFormHeader\(\) expects bool, mixed given\.$#'
|
||||
identifier: argument.type
|
||||
count: 1
|
||||
path: src/Controllers/Table/ChangeController.php
|
||||
|
||||
-
|
||||
message: '#^Parameter \#2 \$signature of static method PhpMyAdmin\\Core\:\:checkSqlQuerySignature\(\) expects string, mixed given\.$#'
|
||||
identifier: argument.type
|
||||
count: 1
|
||||
path: src/Controllers/Table/ChangeController.php
|
||||
|
||||
-
|
||||
message: '#^Parameter \#7 \$isUpload of method PhpMyAdmin\\InsertEdit\:\:getHtmlForInsertEditRow\(\) expects bool, mixed given\.$#'
|
||||
identifier: argument.type
|
||||
count: 1
|
||||
path: src/Controllers/Table/ChangeController.php
|
||||
|
||||
-
|
||||
message: '#^Static property PhpMyAdmin\\Current\:\:\$whereClause \(array\<string\>\|string\|null\) does not accept list\<mixed\>\.$#'
|
||||
identifier: assign.propertyType
|
||||
|
||||
@ -227,7 +227,6 @@
|
||||
<code><![CDATA[$this->settings]]></code>
|
||||
</PropertyTypeCoercion>
|
||||
<RiskyTruthyFalsyComparison>
|
||||
<code><![CDATA[! ini_get('file_uploads')]]></code>
|
||||
<code><![CDATA[$cookieName]]></code>
|
||||
<code><![CDATA[empty($dir)]]></code>
|
||||
<code><![CDATA[empty($path)]]></code>
|
||||
@ -2270,7 +2269,6 @@
|
||||
</file>
|
||||
<file src="src/Controllers/Table/ChangeController.php">
|
||||
<MixedArgument>
|
||||
<code><![CDATA[$isUpload]]></code>
|
||||
<code><![CDATA[$repopulate]]></code>
|
||||
<code><![CDATA[$request->getQueryParam('where_clause_signature')]]></code>
|
||||
</MixedArgument>
|
||||
@ -2279,12 +2277,8 @@
|
||||
<code><![CDATA[$rowId]]></code>
|
||||
</MixedArgumentTypeCoercion>
|
||||
<MixedAssignment>
|
||||
<code><![CDATA[$isUpload]]></code>
|
||||
<code><![CDATA[$repopulate]]></code>
|
||||
</MixedAssignment>
|
||||
<PossiblyNullArgument>
|
||||
<code><![CDATA[$isUpload]]></code>
|
||||
</PossiblyNullArgument>
|
||||
<RiskyTruthyFalsyComparison>
|
||||
<code><![CDATA[empty(Current::$displayMessage)]]></code>
|
||||
</RiskyTruthyFalsyComparison>
|
||||
|
||||
@ -160,7 +160,6 @@ class Config
|
||||
public function checkSystem(): void
|
||||
{
|
||||
$this->checkGd2();
|
||||
$this->checkUpload();
|
||||
$this->checkOutputCompression();
|
||||
}
|
||||
|
||||
@ -556,25 +555,13 @@ class Config
|
||||
return $this->source;
|
||||
}
|
||||
|
||||
/**
|
||||
* checks if upload is enabled
|
||||
*/
|
||||
public function checkUpload(): void
|
||||
public function isUploadEnabled(): bool
|
||||
{
|
||||
if (! ini_get('file_uploads')) {
|
||||
$this->set('enable_upload', false);
|
||||
$iniValue = ini_get('file_uploads');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->set('enable_upload', true);
|
||||
// if set "php_admin_value file_uploads Off" in httpd.conf
|
||||
// ini_get() also returns the string "Off" in this case:
|
||||
if (strtolower(ini_get('file_uploads')) !== 'off') {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->set('enable_upload', false);
|
||||
return $iniValue !== false && $iniValue !== '' && $iniValue !== '0' && strtolower($iniValue) !== 'off';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -114,7 +114,7 @@ final class ImportController implements InvocableController
|
||||
'skip_queries_default' => $skipQueriesDefault,
|
||||
'is_allow_interrupt_checked' => $isAllowInterruptChecked,
|
||||
'local_import_file' => $localImportFile,
|
||||
'is_upload' => $config->get('enable_upload'),
|
||||
'is_upload' => $config->isUploadEnabled(),
|
||||
'upload_dir' => $config->settings['UploadDir'] ?? null,
|
||||
'timeout_passed_global' => ImportSettings::$timeoutPassed,
|
||||
'compressions' => $compressions,
|
||||
|
||||
@ -96,7 +96,7 @@ final class ImportController implements InvocableController
|
||||
'skip_queries_default' => $skipQueriesDefault,
|
||||
'is_allow_interrupt_checked' => $isAllowInterruptChecked,
|
||||
'local_import_file' => $localImportFile,
|
||||
'is_upload' => $config->get('enable_upload'),
|
||||
'is_upload' => $config->isUploadEnabled(),
|
||||
'upload_dir' => $config->settings['UploadDir'] ?? null,
|
||||
'timeout_passed_global' => ImportSettings::$timeoutPassed,
|
||||
'compressions' => $compressions,
|
||||
|
||||
@ -200,7 +200,7 @@ class ChangeController implements InvocableController
|
||||
|
||||
//Insert/Edit form
|
||||
//If table has blob fields we have to disable ajax.
|
||||
$isUpload = $this->config->get('enable_upload');
|
||||
$isUpload = $this->config->isUploadEnabled();
|
||||
$htmlOutput .= $this->insertEdit->getHtmlForInsertEditFormHeader($hasBlobField, $isUpload);
|
||||
|
||||
$htmlOutput .= Url::getHiddenInputs($formParams);
|
||||
|
||||
@ -144,7 +144,7 @@ final class ImportController implements InvocableController
|
||||
'skip_queries_default' => $skipQueriesDefault,
|
||||
'is_allow_interrupt_checked' => $isAllowInterruptChecked,
|
||||
'local_import_file' => $localImportFile,
|
||||
'is_upload' => $config->get('enable_upload'),
|
||||
'is_upload' => $config->isUploadEnabled(),
|
||||
'upload_dir' => $config->settings['UploadDir'] ?? null,
|
||||
'timeout_passed_global' => ImportSettings::$timeoutPassed,
|
||||
'compressions' => $compressions,
|
||||
|
||||
@ -115,7 +115,7 @@ class SqlQueryForm
|
||||
'has_bookmark' => $bookmarkFeature !== null,
|
||||
'delimiter' => $delimiter,
|
||||
'retain_query_box' => $this->config->settings['RetainQueryBox'] !== false,
|
||||
'is_upload' => $this->config->get('enable_upload'),
|
||||
'is_upload' => $this->config->isUploadEnabled(),
|
||||
'db' => $db,
|
||||
'table' => $table,
|
||||
'goto' => $goto,
|
||||
|
||||
@ -53,7 +53,6 @@ final class ChangeControllerTest extends AbstractTestCase
|
||||
->withParsedBody(['insert_rows' => '0']);
|
||||
|
||||
$config = Config::getInstance();
|
||||
$config->set('enable_upload', false);
|
||||
$config->set('InsertRows', 3);
|
||||
$config->set('ShowFunctionFields', true);
|
||||
$config->set('ShowFieldTypesInDataEditView', true);
|
||||
@ -149,7 +148,6 @@ final class ChangeControllerTest extends AbstractTestCase
|
||||
->withParsedBody(['insert_rows' => '1']);
|
||||
|
||||
$config = Config::getInstance();
|
||||
$config->set('enable_upload', false);
|
||||
$config->set('InsertRows', 3);
|
||||
$config->set('ShowFunctionFields', false);
|
||||
$config->set('ShowFieldTypesInDataEditView', false);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user