Extensions
Extensions copied to clipboard
[Question]: Do we need to install an extension by copy/paste a file ?
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;
}
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.
Ok if it doesn't work as expected I will try to submit a patch to freshRSS.
6 years old. ready to close this ticket?