Extensions icon indicating copy to clipboard operation
Extensions copied to clipboard

[Question]: Do we need to install an extension by copy/paste a file ?

Open dhoko opened this issue 10 years ago • 3 comments

Hello,

Do I need to do this in order to use my extension ?

    public function install() {
        $filename = 'restApi.php';
        $file_source = join_path($this->getPath(), $filename);
        $path_destination = join_path(PUBLIC_PATH, 'api');
        $file_destination = join_path($path_destination, $filename);

        if (!is_writable($path_destination)) {
            return 'server cannot write in ' . $path_destination;
        }

        if (file_exists($file_destination)) {
            if (!unlink($file_destination)) {
                return 'API file seems already existing but cannot be removed';
            }
        }

        if (!file_exists($file_source)) {
            return 'API file seems not existing in this extension. Try to download it again.';
        }

        if (!copy($file_source, $file_destination)) {
            return 'the API file has failed during installation.';
        }

        return true;
    }

dhoko avatar Feb 01 '15 18:02 dhoko

If you create an API, probably. Problem is we need to rewrite URL for APIs (at least for both TTRSS and Google Reader APIs) and the corresponding .htaccess file is present only under ./p/api/. It is a very specific case that extensions cannot handle easily and that's the reason it appears so "hacky"… I'm not proud of that's solution, but it works.

For other kinds of extensions, you should have no need of that. Take a look to other extensions and you'll see no call of this kind.

marienfressinaud avatar Feb 02 '15 18:02 marienfressinaud

Ok if it doesn't work as expected I will try to submit a patch to freshRSS.

dhoko avatar Feb 03 '15 17:02 dhoko

6 years old. ready to close this ticket?

math-GH avatar Nov 26 '21 21:11 math-GH