PHP code example of dbmover / core
1. Go to this page and download the library: Download dbmover/core library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
dbmover / core example snippets
namespace Myplugins;
use Dbmover\Core\PluginInterface;
class Down implements PluginInterface
{
public $description = 'Bringing application down...';
public function __invoke(string $sql) : string
{
$cwd = getcwd();
`touch $cwd/down`;
return $sql;
}
}
class Up implements PluginInterface
{
public $description = 'Briging application back up...';
public function __destruct()
{
$cwd = getcwd();
`rm $cwd/down`;
parent::__destruct();
}
}
if (file_exists('/path/to/down')) {
die("Application is down for maintainance.");
}
// ...other code...