mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-05 22:14:59 +02:00
[ticket/16284] Add effectively installed checks where applicable
PHPBB3-16284
This commit is contained in:
parent
8fed25382a
commit
af7dcb9ba2
@ -11,29 +11,36 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace phpbb\db\migration\data\v330;
|
namespace phpbb\db\migration\data\v400;
|
||||||
|
|
||||||
class extensions_composer extends \phpbb\db\migration\migration
|
use phpbb\db\migration\migration;
|
||||||
|
|
||||||
|
class extensions_composer extends migration
|
||||||
{
|
{
|
||||||
|
public function effectively_installed()
|
||||||
|
{
|
||||||
|
return $this->config->offsetExists('exts_composer_repositories');
|
||||||
|
}
|
||||||
|
|
||||||
public function update_data()
|
public function update_data()
|
||||||
{
|
{
|
||||||
return array(
|
return [
|
||||||
array('config.add', array('exts_composer_repositories', json_encode([
|
['config.add', ['exts_composer_repositories', json_encode([
|
||||||
'https://www.phpbb.com/customise/db/composer/',
|
'https://www.phpbb.com/customise/db/composer/',
|
||||||
], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES))),
|
], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)]],
|
||||||
array('config.add', array('exts_composer_packagist', false)),
|
['config.add', ['exts_composer_packagist', false]],
|
||||||
array('config.add', array('exts_composer_json_file', 'composer-ext.json')),
|
['config.add', ['exts_composer_json_file', 'composer-ext.json']],
|
||||||
array('config.add', array('exts_composer_vendor_dir', 'vendor-ext/')),
|
['config.add', ['exts_composer_vendor_dir', 'vendor-ext/']],
|
||||||
array('config.add', array('exts_composer_enable_on_install', false)),
|
['config.add', ['exts_composer_enable_on_install', false]],
|
||||||
array('config.add', array('exts_composer_purge_on_remove', true)),
|
['config.add', ['exts_composer_purge_on_remove', true]],
|
||||||
array('module.add', array(
|
['module.add', [
|
||||||
'acp',
|
'acp',
|
||||||
'ACP_EXTENSION_MANAGEMENT',
|
'ACP_EXTENSION_MANAGEMENT',
|
||||||
array(
|
[
|
||||||
'module_basename' => 'acp_extensions',
|
'module_basename' => 'acp_extensions',
|
||||||
'modes' => array('catalog'),
|
'modes' => ['catalog'],
|
||||||
),
|
],
|
||||||
)),
|
]],
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,23 +11,30 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace phpbb\db\migration\data\v330;
|
namespace phpbb\db\migration\data\v400;
|
||||||
|
|
||||||
class extensions_composer_2 extends \phpbb\db\migration\migration
|
use phpbb\db\migration\migration;
|
||||||
|
|
||||||
|
class extensions_composer_2 extends migration
|
||||||
{
|
{
|
||||||
|
public function effectively_installed()
|
||||||
|
{
|
||||||
|
return strpos($this->config['exts_composer_repositories'], 'https://satis.phpbb.com') !== false;
|
||||||
|
}
|
||||||
|
|
||||||
public function update_data()
|
public function update_data()
|
||||||
{
|
{
|
||||||
$repositories = json_decode($this->config['exts_composer_repositories'], true);
|
$repositories = json_decode($this->config['exts_composer_repositories'], true);
|
||||||
$repositories[] = 'https://satis.phpbb.com';
|
$repositories[] = 'https://satis.phpbb.com';
|
||||||
$repositories = array_unique($repositories);
|
$repositories = array_unique($repositories);
|
||||||
|
|
||||||
return array(
|
return [
|
||||||
array('config.update', array('exts_composer_repositories', json_encode($repositories, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES))),
|
['config.update', ['exts_composer_repositories', json_encode($repositories, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)]],
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
static public function depends_on()
|
static public function depends_on()
|
||||||
{
|
{
|
||||||
return array('\phpbb\db\migration\data\v330\extensions_composer');
|
return ['\phpbb\db\migration\data\v400\extensions_composer'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,29 +11,36 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace phpbb\db\migration\data\v330;
|
namespace phpbb\db\migration\data\v400;
|
||||||
|
|
||||||
class remove_attachment_download_mode extends \phpbb\db\migration\migration
|
use phpbb\db\migration\migration;
|
||||||
|
|
||||||
|
class remove_attachment_download_mode extends migration
|
||||||
{
|
{
|
||||||
|
public function effectively_installed()
|
||||||
|
{
|
||||||
|
return !$this->db_tools->sql_column_exists($this->tables['extension_groups'], 'download_mode');
|
||||||
|
}
|
||||||
|
|
||||||
public function update_schema()
|
public function update_schema()
|
||||||
{
|
{
|
||||||
return array(
|
return [
|
||||||
'drop_columns' => array(
|
'drop_columns' => [
|
||||||
$this->table_prefix . 'extension_groups' => array(
|
$this->table_prefix . 'extension_groups' => [
|
||||||
'download_mode',
|
'download_mode',
|
||||||
),
|
],
|
||||||
),
|
],
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function revert_schema()
|
public function revert_schema()
|
||||||
{
|
{
|
||||||
return array(
|
return [
|
||||||
'add_columns' => array(
|
'add_columns' => [
|
||||||
$this->table_prefix . 'extension_groups' => array(
|
$this->table_prefix . 'extension_groups' => [
|
||||||
'download_mode' => array('BOOL', '1'),
|
'download_mode' => ['BOOL', '1'],
|
||||||
),
|
],
|
||||||
),
|
],
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,34 +11,44 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace phpbb\db\migration\data\v330;
|
namespace phpbb\db\migration\data\v400;
|
||||||
|
|
||||||
class storage_adapter_local_subfolders extends \phpbb\db\migration\migration
|
use phpbb\db\migration\migration;
|
||||||
|
use phpbb\storage\provider\local;
|
||||||
|
|
||||||
|
class storage_adapter_local_subfolders extends migration
|
||||||
{
|
{
|
||||||
|
public function effectively_installed()
|
||||||
|
{
|
||||||
|
return $this->config->offsetExists('storage\\attachment\\config\\subfolders') ||
|
||||||
|
$this->config->offsetExists('storage\\avatar\\config\\subfolders') ||
|
||||||
|
$this->config->offsetExists('storage\\backup\\config\\subfolders');
|
||||||
|
}
|
||||||
|
|
||||||
static public function depends_on()
|
static public function depends_on()
|
||||||
{
|
{
|
||||||
return array(
|
return [
|
||||||
'\phpbb\db\migration\data\v330\storage_attachment',
|
'\phpbb\db\migration\data\v400\storage_attachment',
|
||||||
'\phpbb\db\migration\data\v330\storage_avatar',
|
'\phpbb\db\migration\data\v400\storage_avatar',
|
||||||
'\phpbb\db\migration\data\v330\storage_backup',
|
'\phpbb\db\migration\data\v400\storage_backup',
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update_data()
|
public function update_data()
|
||||||
{
|
{
|
||||||
return array(
|
return [
|
||||||
array('if', array(
|
['if', [
|
||||||
($this->config['storage\\attachment\\provider'] == \phpbb\storage\provider\local::class),
|
($this->config['storage\\attachment\\provider'] == local::class),
|
||||||
array('config.add', array('storage\\attachment\\config\\subfolders', '0')),
|
['config.add', ['storage\\attachment\\config\\subfolders', '0']],
|
||||||
)),
|
]],
|
||||||
array('if', array(
|
['if', [
|
||||||
($this->config['storage\\avatar\\provider'] == \phpbb\storage\provider\local::class),
|
($this->config['storage\\avatar\\provider'] == local::class),
|
||||||
array('config.add', array('storage\\avatar\\config\\subfolders', '0')),
|
['config.add', ['storage\\avatar\\config\\subfolders', '0']],
|
||||||
)),
|
]],
|
||||||
array('if', array(
|
['if', [
|
||||||
($this->config['storage\\backup\\provider'] == \phpbb\storage\provider\local::class),
|
($this->config['storage\\backup\\provider'] == local::class),
|
||||||
array('config.add', array('storage\\backup\\config\\subfolders', '0')),
|
['config.add', ['storage\\backup\\config\\subfolders', '0']],
|
||||||
)),
|
]],
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,16 +11,24 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace phpbb\db\migration\data\v330;
|
namespace phpbb\db\migration\data\v400;
|
||||||
|
|
||||||
class storage_attachment extends \phpbb\db\migration\migration
|
use phpbb\db\migration\migration;
|
||||||
|
use phpbb\storage\provider\local;
|
||||||
|
|
||||||
|
class storage_attachment extends migration
|
||||||
{
|
{
|
||||||
|
public function effectively_installed()
|
||||||
|
{
|
||||||
|
return $this->config->offsetExists('storage\\attachment\\provider');
|
||||||
|
}
|
||||||
|
|
||||||
public function update_data()
|
public function update_data()
|
||||||
{
|
{
|
||||||
return array(
|
return [
|
||||||
array('config.add', array('storage\\attachment\\provider', \phpbb\storage\provider\local::class)),
|
['config.add', ['storage\\attachment\\provider', local::class]],
|
||||||
array('config.add', array('storage\\attachment\\config\\path', $this->config['upload_path'])),
|
['config.add', ['storage\\attachment\\config\\path', $this->config['upload_path']]],
|
||||||
array('config.remove', array('upload_path')),
|
['config.remove', ['upload_path']],
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,16 +11,24 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace phpbb\db\migration\data\v330;
|
namespace phpbb\db\migration\data\v400;
|
||||||
|
|
||||||
class storage_avatar extends \phpbb\db\migration\migration
|
use phpbb\db\migration\migration;
|
||||||
|
use phpbb\storage\provider\local;
|
||||||
|
|
||||||
|
class storage_avatar extends migration
|
||||||
{
|
{
|
||||||
|
public function effectively_installed()
|
||||||
|
{
|
||||||
|
return $this->config->offsetExists('storage\\avatar\\provider');
|
||||||
|
}
|
||||||
|
|
||||||
public function update_data()
|
public function update_data()
|
||||||
{
|
{
|
||||||
return array(
|
return [
|
||||||
array('config.add', array('storage\\avatar\\provider', \phpbb\storage\provider\local::class)),
|
['config.add', ['storage\\avatar\\provider', local::class]],
|
||||||
array('config.add', array('storage\\avatar\\config\\path', $this->config['avatar_path'])),
|
['config.add', ['storage\\avatar\\config\\path', $this->config['avatar_path']]],
|
||||||
array('config.remove', array('avatar_path')),
|
['config.remove', ['avatar_path']],
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,30 +11,38 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace phpbb\db\migration\data\v330;
|
namespace phpbb\db\migration\data\v400;
|
||||||
|
|
||||||
class storage_backup extends \phpbb\db\migration\migration
|
use phpbb\db\migration\migration;
|
||||||
|
use phpbb\storage\provider\local;
|
||||||
|
|
||||||
|
class storage_backup extends migration
|
||||||
{
|
{
|
||||||
|
public function effectively_installed()
|
||||||
|
{
|
||||||
|
return $this->db_tools->sql_table_exists($this->tables['backups']);
|
||||||
|
}
|
||||||
|
|
||||||
public function update_schema()
|
public function update_schema()
|
||||||
{
|
{
|
||||||
return array(
|
return [
|
||||||
'add_tables' => array(
|
'add_tables' => [
|
||||||
$this->table_prefix . 'backups' => array(
|
$this->table_prefix . 'backups' => [
|
||||||
'COLUMNS' => array(
|
'COLUMNS' => [
|
||||||
'backup_id' => array('UINT', null, 'auto_increment'),
|
'backup_id' => ['UINT', null, 'auto_increment'],
|
||||||
'filename' => array('VCHAR', ''),
|
'filename' => ['VCHAR', ''],
|
||||||
),
|
],
|
||||||
'PRIMARY_KEY' => 'backup_id',
|
'PRIMARY_KEY' => 'backup_id',
|
||||||
),
|
],
|
||||||
),
|
],
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update_data()
|
public function update_data()
|
||||||
{
|
{
|
||||||
return array(
|
return [
|
||||||
array('config.add', array('storage\\backup\\provider', \phpbb\storage\provider\local::class)),
|
['config.add', ['storage\\backup\\provider', local::class]],
|
||||||
array('config.add', array('storage\\backup\\config\\path', 'store')),
|
['config.add', ['storage\\backup\\config\\path', 'store']],
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,45 +11,52 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace phpbb\db\migration\data\v330;
|
namespace phpbb\db\migration\data\v400;
|
||||||
|
|
||||||
|
use phpbb\db\migration\container_aware_migration;
|
||||||
|
use phpbb\storage\exception\exception;
|
||||||
use phpbb\storage\storage;
|
use phpbb\storage\storage;
|
||||||
|
|
||||||
class storage_track extends \phpbb\db\migration\container_aware_migration
|
class storage_track extends container_aware_migration
|
||||||
{
|
{
|
||||||
|
public function effectively_installed()
|
||||||
|
{
|
||||||
|
return $this->db_tools->sql_table_exists($this->tables['storage']);
|
||||||
|
}
|
||||||
|
|
||||||
static public function depends_on()
|
static public function depends_on()
|
||||||
{
|
{
|
||||||
return array(
|
return [
|
||||||
'\phpbb\db\migration\data\v330\storage_attachment',
|
'\phpbb\db\migration\data\v400\storage_attachment',
|
||||||
'\phpbb\db\migration\data\v330\storage_avatar',
|
'\phpbb\db\migration\data\v400\storage_avatar',
|
||||||
'\phpbb\db\migration\data\v330\storage_backup',
|
'\phpbb\db\migration\data\v400\storage_backup',
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update_schema()
|
public function update_schema()
|
||||||
{
|
{
|
||||||
return array(
|
return [
|
||||||
'add_tables' => array(
|
'add_tables' => [
|
||||||
$this->table_prefix . 'storage' => array(
|
$this->table_prefix . 'storage' => [
|
||||||
'COLUMNS' => array(
|
'COLUMNS' => [
|
||||||
'file_id' => array('UINT', null, 'auto_increment'),
|
'file_id' => ['UINT', null, 'auto_increment'],
|
||||||
'file_path' => array('VCHAR', ''),
|
'file_path' => ['VCHAR', ''],
|
||||||
'storage' => array('VCHAR', ''),
|
'storage' => ['VCHAR', ''],
|
||||||
'filesize' => array('UINT:20', 0),
|
'filesize' => ['UINT:20', 0],
|
||||||
),
|
],
|
||||||
'PRIMARY_KEY' => 'file_id',
|
'PRIMARY_KEY' => 'file_id',
|
||||||
),
|
],
|
||||||
),
|
],
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function revert_schema()
|
public function revert_schema()
|
||||||
{
|
{
|
||||||
return array(
|
return [
|
||||||
'drop_tables' => array(
|
'drop_tables' => [
|
||||||
$this->table_prefix . 'storage',
|
$this->table_prefix . 'storage',
|
||||||
),
|
],
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update_data()
|
public function update_data()
|
||||||
@ -90,9 +97,9 @@ class storage_track extends \phpbb\db\migration\container_aware_migration
|
|||||||
{
|
{
|
||||||
$storage->track_file($this->config['avatar_salt'] . '_' . ($avatar_group ? 'g' : '') . $filename . '.' . $ext);
|
$storage->track_file($this->config['avatar_salt'] . '_' . ($avatar_group ? 'g' : '') . $filename . '.' . $ext);
|
||||||
}
|
}
|
||||||
catch (\phpbb\storage\exception\exception $e)
|
catch (exception $e)
|
||||||
{
|
{
|
||||||
// If file don't exist, don't track it
|
// If file doesn't exist, don't track it
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->db->sql_freeresult($result);
|
$this->db->sql_freeresult($result);
|
||||||
@ -114,9 +121,9 @@ class storage_track extends \phpbb\db\migration\container_aware_migration
|
|||||||
{
|
{
|
||||||
$storage->track_file($row['physical_filename']);
|
$storage->track_file($row['physical_filename']);
|
||||||
}
|
}
|
||||||
catch (\phpbb\storage\exception\exception $e)
|
catch (exception $e)
|
||||||
{
|
{
|
||||||
// If file don't exist, don't track it
|
// If file doesn't exist, don't track it
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($row['thumbnail'] == 1)
|
if ($row['thumbnail'] == 1)
|
||||||
@ -125,9 +132,9 @@ class storage_track extends \phpbb\db\migration\container_aware_migration
|
|||||||
{
|
{
|
||||||
$storage->track_file('thumb_' . $row['physical_filename']);
|
$storage->track_file('thumb_' . $row['physical_filename']);
|
||||||
}
|
}
|
||||||
catch (\phpbb\storage\exception\exception $e)
|
catch (exception $e)
|
||||||
{
|
{
|
||||||
// If file don't exist, don't track it
|
// If file doesn't exist, don't track it
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -150,9 +157,9 @@ class storage_track extends \phpbb\db\migration\container_aware_migration
|
|||||||
{
|
{
|
||||||
$storage->track_file($row['filename']);
|
$storage->track_file($row['filename']);
|
||||||
}
|
}
|
||||||
catch (\phpbb\storage\exception\exception $e)
|
catch (exception $e)
|
||||||
{
|
{
|
||||||
// If file don't exist, don't track it
|
// If file doesn't exist, don't track it
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user