trilbymedia / grav-plugin-git-sync

Collaboratively Synchronize your Grav `user` folder hosted on GitHub, BitBucket or GitLab
Apache License 2.0
242 stars 58 forks source link

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

Open vparmeland opened 1 year ago

vparmeland commented 1 year ago

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)
pki791 commented 7 months ago

Got same after installing plugin, any idea or solution?

paulhibbitts commented 7 months ago

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

pki791 commented 7 months ago

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.

mdestafadilah commented 4 months ago

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.

rhukster commented 4 months ago

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

mdestafadilah commented 4 months ago

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 commented 4 months ago

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?