Config
4 months ago
Db
1 month ago
Plugin
1 year ago
Custom.php
1 year ago
Db.php
2 years ago
Factory.php
2 years ago
Custom.php
41 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Matomo - free/libre analytics platform |
| 5 | * |
| 6 | * @link https://matomo.org |
| 7 | * @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later |
| 8 | */ |
| 9 | namespace Piwik\Updater\Migration; |
| 10 | |
| 11 | use Piwik\Updater\Migration; |
| 12 | /** |
| 13 | * Create a custom migration that can execute any callback. |
| 14 | * |
| 15 | * @api |
| 16 | */ |
| 17 | class Custom extends Migration |
| 18 | { |
| 19 | private $callback; |
| 20 | private $toString; |
| 21 | private $args; |
| 22 | public function __construct($callback, $toString, array $args = []) |
| 23 | { |
| 24 | $this->callback = $callback; |
| 25 | $this->toString = $toString; |
| 26 | $this->args = $args; |
| 27 | } |
| 28 | public function exec() |
| 29 | { |
| 30 | call_user_func_array($this->callback, $this->args); |
| 31 | } |
| 32 | public function __toString() |
| 33 | { |
| 34 | return $this->toString; |
| 35 | } |
| 36 | public function shouldIgnoreError($exception) |
| 37 | { |
| 38 | return \false; |
| 39 | } |
| 40 | } |
| 41 |