mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-10 13:28:55 +00:00
[ticket/15699] Avoid magic numbers with constants
PHPBB3-15699
This commit is contained in:
parent
4b46939258
commit
3c4aa6ee8c
3 changed files with 11 additions and 6 deletions
|
@ -126,9 +126,9 @@
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="update_type">{{ lang('STORAGE_UPDATE_TYPE') }}{{ lang('COLON') }}</label></dt>
|
<dt><label for="update_type">{{ lang('STORAGE_UPDATE_TYPE') }}{{ lang('COLON') }}</label></dt>
|
||||||
<dd>
|
<dd>
|
||||||
<label><input id="update_type" class="radio" name="update_type" value="0" checked="checked" type="radio"> {{ lang('STORAGE_UPDATE_TYPE_CONFIG') }}</label>
|
<label><input id="update_type" class="radio" name="update_type" value="{{ constant('STORAGE_UPDATE_TYPE_CONFIG') }}" checked="checked" type="radio"> {{ lang('STORAGE_UPDATE_TYPE_CONFIG') }}</label>
|
||||||
<label><input class="radio" name="update_type" value="1" type="radio"> {{ lang('STORAGE_UPDATE_TYPE_COPY') }}</label>
|
<label><input class="radio" name="update_type" value="{{ constant('STORAGE_UPDATE_TYPE_COPY') }}" type="radio"> {{ lang('STORAGE_UPDATE_TYPE_COPY') }}</label>
|
||||||
<label><input class="radio" name="update_type" value="2" type="radio"> {{ lang('STORAGE_UPDATE_TYPE_MOVE') }}</label>
|
<label><input class="radio" name="update_type" value="{{ constant('STORAGE_UPDATE_TYPE_MOVE') }}" type="radio"> {{ lang('STORAGE_UPDATE_TYPE_MOVE') }}</label>
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
|
@ -181,7 +181,7 @@ class acp_storage
|
||||||
}
|
}
|
||||||
|
|
||||||
// If update_type is copy or move, copy files from the old to the new storage
|
// If update_type is copy or move, copy files from the old to the new storage
|
||||||
if ($this->state['update_type'] >= 1)
|
if (in_array($this->state['update_type'], [STORAGE_UPDATE_TYPE_COPY, STORAGE_UPDATE_TYPE_MOVE], true))
|
||||||
{
|
{
|
||||||
$i = 0;
|
$i = 0;
|
||||||
foreach ($this->state['storages'] as $storage_name => $storage_options)
|
foreach ($this->state['storages'] as $storage_name => $storage_options)
|
||||||
|
@ -228,7 +228,7 @@ class acp_storage
|
||||||
}
|
}
|
||||||
|
|
||||||
// If update_type is move files, remove the old files
|
// If update_type is move files, remove the old files
|
||||||
if ($this->state['update_type'] == 2)
|
if ($this->state['update_type'] === STORAGE_UPDATE_TYPE_MOVE)
|
||||||
{
|
{
|
||||||
$i = 0;
|
$i = 0;
|
||||||
foreach ($this->state['storages'] as $storage_name => $storage_options)
|
foreach ($this->state['storages'] as $storage_name => $storage_options)
|
||||||
|
@ -355,7 +355,7 @@ class acp_storage
|
||||||
$this->state = [
|
$this->state = [
|
||||||
// Save the value of the checkbox, to remove all files from the
|
// Save the value of the checkbox, to remove all files from the
|
||||||
// old storage once they have been successfully moved
|
// old storage once they have been successfully moved
|
||||||
'update_type' => $this->request->variable('update_type', 0),
|
'update_type' => (int) $this->request->variable('update_type', STORAGE_UPDATE_TYPE_CONFIG),
|
||||||
'storage_index' => 0,
|
'storage_index' => 0,
|
||||||
'file_index' => 0,
|
'file_index' => 0,
|
||||||
'remove_storage_index' => 0,
|
'remove_storage_index' => 0,
|
||||||
|
|
|
@ -228,6 +228,11 @@ define('CAPTCHA_MAX_CHARS', 7);
|
||||||
// Additional constants
|
// Additional constants
|
||||||
define('VOTE_CONVERTED', 127);
|
define('VOTE_CONVERTED', 127);
|
||||||
|
|
||||||
|
// Storage update methods
|
||||||
|
define('STORAGE_UPDATE_TYPE_CONFIG', 0);
|
||||||
|
define('STORAGE_UPDATE_TYPE_COPY', 1);
|
||||||
|
define('STORAGE_UPDATE_TYPE_MOVE', 2);
|
||||||
|
|
||||||
// BC global FTW
|
// BC global FTW
|
||||||
global $table_prefix;
|
global $table_prefix;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue