Re: [PATCHv1] Export file in git-remote-mediawiki
- From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
- Date
- Jun 10, 2012, 13:01 UTC
- Message-ID
- <vpqehpnnwwo.fsf@bauges.imag.fr>
- In-Reply-To
- <c23d4a113c735e093e3e9b06e4f16a70@ensibm.imag.fr>
nguyenki <nguyenki@ensibm.imag.fr> writes:
Show 18 quoted lines
>>> + my %hashFiles = get_file_extensions_maybe($complete_file_name);
>>
>> What does this function do? My first understanding was that it
>> queried
>> the wiki for allowed file extensions, but why does it need the file
>> name? It does nothing if $complete_file_name ends with .mw, but then
>> why
>> do you run it before entering the following if() statement?
>>
>>> if (substr($complete_file_name,-3) eq ".mw") {
>>> my $title = substr($complete_file_name,0,-3);
>>
> This function will get a list of allowed file extensions. It need the
> file name to verify if this name begins with .mw or not. If not, it
> does nothing like
> you said. But if $complete_file_name is not a wiki page (end with
> .mw), the function will return the list of file extensions %hashFiles
> to verify if this file is allowed in this condition:If $complete_file_name is not a wiki page, you basically don't need to call this function. As I said, move the call to the function within the next "if" statement, and you won't need this extra complexity.
Show 11 quoted lines
> Yes, i'll correct it in the next patch.
> For the moment, i added these lines to deal with the case similar -
> the case when an user tries to upload a file or pages but he doesn't
> have sufficient rights or he failed to login.
>
> +sub error_insufficient_right {
> + print STDERR "Can not delete or upload file and wiki pages\n";
> + print STDERR "You don't have right to do it\n";
> + print STDOUT "error $_[0]\"right insufficient\"\n";
> + return 0;
> +}This is still a regression. The previous version was propagating page deletion as "replace content with [[Category:Deleted]]", which did work with insufficient priviledge.
-- Matthieu Moy http://www-verimag.imag.fr/~moy/