First commit
This commit is contained in:
commit
e3597abe8e
35 changed files with 2401 additions and 0 deletions
40
migrations/release_1_1_0.php
Executable file
40
migrations/release_1_1_0.php
Executable file
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
namespace pedodev\linkprotection\migrations;
|
||||
|
||||
class release_1_1_0 extends \phpbb\db\migration\migration
|
||||
{
|
||||
public function effectively_installed()
|
||||
{
|
||||
return isset($this->config['pedodev_linkprotection_fileprefix']);
|
||||
}
|
||||
|
||||
static public function depends_on()
|
||||
{
|
||||
return ['\phpbb\db\migration\data\v330\v330'];
|
||||
}
|
||||
|
||||
public function update_data()
|
||||
{
|
||||
$file_prefix = bin2hex(random_bytes(8));
|
||||
|
||||
return [
|
||||
|
||||
// The prefix we will add to our automatic links JSON file
|
||||
['config.add', ['pedodev_linkprotection_fileprefix', $file_prefix]],
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
public function revert_data()
|
||||
{
|
||||
$filepath = __DIR__ . "/../automatic_links_{$this->config['pedodev_linkprotection_fileprefix']}.json";
|
||||
|
||||
if (file_exists($filepath))
|
||||
{
|
||||
unlink($filepath);
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue