Permalink
Cannot retrieve contributors at this time
Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign up
Fetching contributors…

<?php | |
/** | |
* @link https://craftcms.com/ | |
* @copyright Copyright (c) Pixel & Tonic, Inc. | |
* @license https://craftcms.github.io/license/ | |
*/ | |
namespace craft\utilities; | |
use Craft; | |
use craft\base\Utility; | |
/** | |
* Migrations represents a Migrations utility. | |
* | |
* @author Pixel & Tonic, Inc. <support@pixelandtonic.com> | |
* @since 3.0.0 | |
*/ | |
class Migrations extends Utility | |
{ | |
// Static | |
// ========================================================================= | |
/** | |
* @inheritdoc | |
*/ | |
public static function displayName(): string | |
{ | |
return Craft::t('app', 'Migrations'); | |
} | |
/** | |
* @inheritdoc | |
*/ | |
public static function id(): string | |
{ | |
return 'migrations'; | |
} | |
/** | |
* @inheritdoc | |
*/ | |
public static function iconPath() | |
{ | |
return Craft::getAlias('@app/icons/arrow-up.svg'); | |
} | |
/** | |
* @inheritdoc | |
*/ | |
public static function badgeCount(): int | |
{ | |
return count(Craft::$app->getContentMigrator()->getNewMigrations()); | |
} | |
/** | |
* @inheritdoc | |
*/ | |
public static function contentHtml(): string | |
{ | |
$view = Craft::$app->getView(); | |
$migrator = Craft::$app->getContentMigrator(); | |
$migrationHistory = $migrator->getMigrationHistory(); | |
$newMigrations = $migrator->getNewMigrations(); | |
return $view->renderTemplate('_components/utilities/Migrations', [ | |
'migrationHistory' => $migrationHistory, | |
'newMigrations' => $newMigrations | |
]); | |
} | |
} |