douweng3564 2019-02-23 14:14
浏览 47

GRAV git-sync插件更新崩溃网站,有没有遇到/解决过?

I've been using GRAV as a CMS for a small experimental site. I recently updated the git-sync plugin, and am suddenly stuck with a website that produces only errors, with no way to enter the admin gui (all web access to the site crashes with same errors), to downgrade the git-sync module, or for that matter, to upgrade the git-sync plugin if there is a fix.

I'm a developer that hasn't really thought much about web development in decades (my, how it's changed), so there are a few things I have to admit upfront. I don't know sht about php, and really don't care to if I don't have to.

The message I get (below) indicates that this is a php error. If this is a simple syntax fix please give me a heads up.

If you have any advice on a "cli" way to use the git-sync plugin to upgrade or downgrade, revert the git-sync, or any other hints, advise away. I'll dig in to more documentation and see if I end up answering my own question.

/[pathToUserHome]/grav/user/plugins/git-sync/classes/GitSync.php

        */

        $paths = ['.'];

        if (version_compare($version, '2.0', '<')) {
            $add .= ' --all';
        }

        return $this->execute($add . ' ' . implode(' ', $paths));
    }

    public function commit($message = '(Grav GitSync) Automatic Commit')
    {
        $authorType = $this->getGitConfig('author', 'gituser');
        if (defined('GRAV_CLI') && in_array($authorType, ['gravuser', 'gravfull'])) {
            $authorType = 'gituser';
        }

        // get message from config, it any, or stick to the default one
        $message = $this->getConfig('git', null)['message'] ?? $message;

        // get Page Title and Route from Post
        $pageTitle = $_POST['data']['header']['title']??'NO TITLE FOUND';
        $pageRoute = $_POST['data']['route']??'NO ROUTE FOUND';

        ...

 Arguments
    1) "syntax error, unexpected '?'"

 Whoops\Exception\ErrorException…
     /user/plugins/git-sync/classes/GitSync.php : 223

     $message = $this->getConfig('git', null)['message'] ?? $message;
  • 写回答

1条回答 默认 最新

  • duanmu2941 2019-02-23 14:22
    关注

    Your new version of GRAV is using php7.0 features, like ?? operator, which is Null coalescing. Try to upgrade your php version to support new features, or downgrade GRAV.

    Make a compatible version is also an option, but it could be time consumption idea. However, if your problems only in this particular file, you could replace:

    // $message = $this->getConfig('git', null)['message'] ?? $message;
    $message = isset($this->getConfig('git', null)['message']) ? $this->getConfig('git', null)['message'] : $message;
    
    // $pageTitle = $_POST['data']['header']['title']??'NO TITLE FOUND';
    $pageTitle = isset($_POST['data']['header']['title']) ? $_POST['data']['header']['title'] : 'NO TITLE FOUND';
    
    // $pageRoute = $_POST['data']['route']??'NO ROUTE FOUND';
    $pageRoute = isset($_POST['data']['route']) ? $_POST['data']['route'] : 'NO ROUTE FOUND';
    
    评论

报告相同问题?

悬赏问题

  • ¥15 vscode的问题提问
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类
  • ¥15 微带串馈天线阵列每个阵元宽度计算
  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM