Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
vparmeland opened this issue Feb 27, 2023 · 7 comments
Open

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

vparmeland opened this issue Feb 27, 2023 · 7 comments

Comments

@vparmeland
Copy link

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
Copy link

pki791 commented Feb 14, 2024

Got same after installing plugin, any idea or solution?

@paulhibbitts
Copy link
Collaborator

paulhibbitts commented Feb 14, 2024

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

@pki791
Copy link

pki791 commented Feb 15, 2024

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
Copy link

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
Copy link
Member

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

@mdestafadilah
Copy link

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
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants