[CWB] index (data) subdir secretly deleted?
Hardie, Andrew
a.hardie at lancaster.ac.uk
Tue Dec 13 07:09:10 CET 2016
This is more or less what I thought was going on.
The code that is doing this is as follows:
$datadir = "{$Config->dir->index}/$corpus";
if (is_dir($datadir))
recursive_delete_directory($datadir);
mkdir($datadir, 0775);
(in admin-install.inc.php)
That is, if the data directory for the specified corpus already exists, it is deleted and recreated to contain the *new* index data.
However, this *should not* delete the containing directory. The function recursive_delete_directory() only goes downwards in the directory tree - not upwards. The only way it could would be if the $corpus variable is an empty string. But there are checks in place to prevent this.
I have two ideas.
FIRST, can you report what value you set the variable $cwb_datadir to? (in config.inc.php). This may clarify matters. (note this variable is the source of the variable $Config->dir->index in the code sample above, ie they both contain the location of your index-data folder).
SECOND, can you try modifying the code above to contain the following temporary check?
$datadir = "{$Config->dir->index}/$corpus";
if ("{$Config->dir->index}/" == $datadir) exiterror("aborting installation, data dir badly specified");
if (is_dir($datadir))
recursive_delete_directory($datadir);
mkdir($datadir, 0775);
... which checks for the ought-to-be-impossible situation of an empty $corpus variable, and aborts if found?
best
Andrew.
-----Original Message-----
From: cwb-bounces at sslmit.unibo.it [mailto:cwb-bounces at sslmit.unibo.it] On Behalf Of Jiayue Wang
Sent: 12 December 2016 18:37
To: Open source development of the Corpus WorkBench
Subject: Re: [CWB] index (data) subdir secretly deleted?
Hi
I reinstalled that particular corpus (a Vietnamese corpus), WITHOUT any
modification to the corpus files, and the installation went ok. Then I
could install the others.
Now it seems that the disaster happened when I tried to reinstall a
corpus immediately after an unsuccessful installation, i.e. without
firstly deleting that corpus entry. But still, I have no idea why the
entire index-data folder was deleted.
Jiayue
On 12/12/16 11:13, Jiayue Wang wrote:
> Thanks anyway, Andrew. I'll re-install the corpora to see if it's
> happening again.
>
> Best
>
> Jiayue
>
>
> On 12/12/16 11:09, Hardie, Andrew wrote:
>> Line 603 refers to the web-directory, not the index-data directory. So
>> this error message does not seem to have any bearing on the problem at
>> hand...
>>
>> best
>>
>> Andrew.
>>
>> -----Original Message-----
>> From: cwb-bounces at sslmit.unibo.it [mailto:cwb-bounces at sslmit.unibo.it]
>> On Behalf Of Jiayue Wang
>> Sent: 12 December 2016 11:06
>> To: Open source development of the Corpus WorkBench
>> Subject: Re: [CWB] index (data) subdir secretly deleted?
>>
>> Thanks Andrew. I check the error log and found the only suspicious
>> message to be
>>
>> PHP Warning: chmod(): Operation not permitted in
>> /home/arthur/www_root/CQPweb/lib/admin-install.inc.php on line 603 ...
>>
>> It seems the installation was unsuccessful because it failed to
>> chmod($newdir, 0775) after creating that folder? But I don't see why
>> this particular corpus was special - other corpora were installed
>> without a problem.
>>
>> Jiayue
>>
>> On 12/12/16 10:38, Hardie, Andrew wrote:
>>> I have a fairly good idea where in the code this is happening: when
>>> the system detects that a data directory of the name of the new
>>> corpus already exists, it attempts to delete it. However, I cannot
>>> see why this would affect the entire index directory instead of just
>>> that of the corpus to be created; there are already checks against
>>> the name of the corpus being an empty string, which would be the
>>> normal thing I would suspect.
>>>
>>> It's possible that your web server error log file may contain an
>>> informative PHP message....
>>>
>>> best
>>>
>>> Andrew.
>>>
>>> -----Original Message-----
>>> From: cwb-bounces at sslmit.unibo.it
>>> [mailto:cwb-bounces at sslmit.unibo.it] On Behalf Of Jiayue Wang
>>> Sent: 12 December 2016 08:49
>>> To: Open source development of the Corpus WorkBench
>>> Subject: [CWB] index (data) subdir secretly deleted?
>>>
>>> Hi
>>>
>>> I've experienced this quite a few times - when installing a corpus, the
>>> whole index folder disappears. I don't know why, but it seems this
>>> happens when the corpus handle is not too long or ill-formed. But the
>>> problem is that all other corpora are lost too and must be re-installed.
>>> Any ideas? Thanks for any help!
>>>
>>> Jiayue
>>> _______________________________________________
>>> CWB mailing list
>>> CWB at sslmit.unibo.it
>>> http://liste.sslmit.unibo.it/mailman/listinfo/cwb
>>> _______________________________________________
>>> CWB mailing list
>>> CWB at sslmit.unibo.it
>>> http://liste.sslmit.unibo.it/mailman/listinfo/cwb
>>>
>> _______________________________________________
>> CWB mailing list
>> CWB at sslmit.unibo.it
>> http://liste.sslmit.unibo.it/mailman/listinfo/cwb
>> _______________________________________________
>> CWB mailing list
>> CWB at sslmit.unibo.it
>> http://liste.sslmit.unibo.it/mailman/listinfo/cwb
>>
_______________________________________________
CWB mailing list
CWB at sslmit.unibo.it
http://liste.sslmit.unibo.it/mailman/listinfo/cwb
More information about the CWB
mailing list