grav-plugin-git-sync icon indicating copy to clipboard operation
grav-plugin-git-sync copied to clipboard

Call to undefined function Grav\Plugin\GitSync\exec()

Open vparmeland opened this issue 2 years ago • 7 comments

ERROR : "Call to undefined function Grav\Plugin\GitSync\exec()"

/home/clients/xxxxxx/sites/xxxxx/user/plugins/git-sync/classes/Helper.php

    /**
     * Checks if the user/ folder is already initialized
     *
     * @return bool
     */
    public static function isGitInitialized()
    {
        return file_exists(rtrim(USER_DIR, '/') . '/.git');
    }
 
    /**
     * @param bool $version
     * @return bool|string
     */
    public static function isGitInstalled($version = false)
    {
        $bin = Helper::getGitBinary();
 
        exec($bin . ' --version', $output, $returnValue);
 
        $installed = $returnValue === 0;
 
        if ($version && $output) {
            $output = explode(' ', array_shift($output));
            $versions = array_filter($output, static function($item) {
                return version_compare($item, '0.0.1', '>=');
            });
 
            $installed = array_shift($versions);
        }
 
        return $installed;
    }
 
    /**
     * @param bool $override
     * @return string
     */
    public static function getGitBinary($override = false)

vparmeland avatar Feb 27 '23 11:02 vparmeland

Got same after installing plugin, any idea or solution?

pki791 avatar Feb 14 '24 09:02 pki791

Some PHP installs do not include/enable the exec function, so that might be something to confirm with your host setup.

paulhibbitts avatar Feb 14 '24 16:02 paulhibbitts

OK, solved for me, i did not expect that the exec function wound be disabled on some domains and enabled on others. Same hosting, same server, same account, just different domains.

pki791 avatar Feb 15 '24 10:02 pki791

Some PHP installs do not include/enable the exec function, so that might be something to confirm with your host setup.

it' must be enable? it's strict security reason.

mdestafadilah avatar May 19 '24 12:05 mdestafadilah

Yes it needs it to run the git command. It’s required for the whole functionality of the plugin.

rhukster avatar May 19 '24 15:05 rhukster

Yes it needs it to run the git command. It’s required for the whole functionality of the plugin.

ouh i see, i have enabled git sync ... and it's running the exec command

mdestafadilah avatar May 20 '24 03:05 mdestafadilah

Yes it needs it to run the git command. It’s required for the whole functionality of the plugin.

why you not use hook (like webhook) to access git function, beside using exec command?

mdestafadilah avatar May 20 '24 03:05 mdestafadilah