summaryrefslogtreecommitdiff
path: root/fml/lib/FML/Article.pm
diff options
context:
space:
mode:
authorfukachan <fukachan>2003-03-16 08:38:58 +0000
committerfukachan <fukachan>2003-03-16 08:38:58 +0000
commit010c3f1f92bf862013c46b8457c0dc901d8ba110 (patch)
tree322bb1add57f9e25ac936b7a2e8daed5478e6cf2 /fml/lib/FML/Article.pm
parente85c2b47305088269f020543d436460e5f076b11 (diff)
downloadfml8-010c3f1f92bf862013c46b8457c0dc901d8ba110.tar.gz
fml8-010c3f1f92bf862013c46b8457c0dc901d8ba110.tar.bz2
fml8-010c3f1f92bf862013c46b8457c0dc901d8ba110.zip
define new lock channel: article_spool
Diffstat (limited to 'fml/lib/FML/Article.pm')
-rw-r--r--fml/lib/FML/Article.pm20
1 files changed, 19 insertions, 1 deletions
diff --git a/fml/lib/FML/Article.pm b/fml/lib/FML/Article.pm
index 13d40555..d305bf34 100644
--- a/fml/lib/FML/Article.pm
+++ b/fml/lib/FML/Article.pm
@@ -4,7 +4,7 @@
# All rights reserved. This program is free software; you can
# redistribute it and/or modify it under the same terms as Perl itself.
#
-# $FML: Article.pm,v 1.52 2002/12/26 15:07:49 fukachan Exp $
+# $FML: Article.pm,v 1.53 2003/03/03 15:27:22 fukachan Exp $
#
package FML::Article;
@@ -79,6 +79,19 @@ sub new
}
+# Descriptions: return lock channel name.
+# Arguments: OBJ($self)
+# Side Effects: none
+# Return Value: STR
+sub get_lock_channel_name
+{
+ my ($self) = @_;
+
+ # XXX LOCK_CHANNEL: article_spool
+ return 'article_spool';
+}
+
+
# Descriptions: build an article template to distribute.
# Arguments: OBJ($curproc)
# Side Effects: build $curproc->{ article } HASH_REF.
@@ -196,8 +209,11 @@ sub spool_in
my $config = $curproc->config();
my $spool_dir = $config->{ spool_dir };
my $use_subdir = $config->{ spool_type } eq 'subdir' ? 1 : 0;
+ my $channel = $self->get_lock_channel_name();
if ( $config->yes( 'use_spool' ) ) {
+ $curproc->lock($channel);
+
unless (-d $spool_dir) {
$curproc->mkdir($spool_dir, "mode=private");
}
@@ -220,6 +236,8 @@ sub spool_in
else {
LogError("$id article already exists");
}
+
+ $curproc->unlock($channel);
}
else {
Log("not spool article $id");