nattreid/app-manager

Nette Framework的应用程序管理器

1.6.3 2021-04-19 07:48 UTC

README

config.neon 中的设置

extensions:
    appManager: NAtrreid\AppManager\DI\AppManagerExtension

可用设置

appManager:
    deploy:
        projectUrl: 'homepageProjektu'
        secretToken: 'tajnyTokenProjektu' # pro github a gitlab
        type: 'github' # github, gitlab, bitbucket
    sessionExpiration: '14 days'
    backup:
        maxRows: 1000 # nebo null pro zadne omezeni insert
        excludeTables: # tabulky, ktere nebudou zalohovany
            - 'test' 
        dir:
            - %wwwDir%/zalohovanyAdresar

payload webhooks 必须是 JSON

使用

/** @var \NAttreid\AppManager\AppManager @inject */
public $app;

页面维护

将以下代码添加到 index.php 文件中。当维护模式开启时,.maintenance.php 文件将显示。可以通过在 URL 中添加参数 maintenanceOff 或通过控制台 php index.php maintenanceOff 来关闭维护模式。

$maintenance = isset($maintenance) ? $maintenance : __DIR__ . '/../temp/maintenance';
if (file_exists($maintenance)) {
    if (isset($_GET['maintenanceOff']) || (isset($argv) && $argv[1] == 'maintenanceOff')) {
        unlink($maintenance);
        echo "Maintenance off\n";
        exit;
    }
    require '.maintenance.php';
}

缓存失效

要使用方法进行失效,需要添加

$app->onInvalideCache[]=function(){
    $this->cache->clean();
};