[vhffs-dev] [2051] merged cron_delete.pl and cron_create.pl to cron.pl, added dummy sub modify on cron (yes, this looks like a standard interface, maybe gradator have something in mind)

[ Thread Index | Date Index | More vhffs.org/vhffs-dev Archives ]


Revision: 2051
Author:   gradator
Date:     2012-02-25 12:52:19 +0100 (Sat, 25 Feb 2012)
Log Message:
-----------
merged cron_delete.pl and cron_create.pl to cron.pl, added dummy sub modify on cron (yes, this looks like a standard interface, maybe gradator have something in mind)

Modified Paths:
--------------
    trunk/vhffs-api/src/Vhffs/Robots/Cron.pm
    trunk/vhffs-robots/Makefile.am

Added Paths:
-----------
    trunk/vhffs-robots/src/cron.pl

Removed Paths:
-------------
    trunk/vhffs-robots/src/cron_create.pl
    trunk/vhffs-robots/src/cron_delete.pl

Modified: trunk/vhffs-api/src/Vhffs/Robots/Cron.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Robots/Cron.pm	2012-02-25 01:15:53 UTC (rev 2050)
+++ trunk/vhffs-api/src/Vhffs/Robots/Cron.pm	2012-02-25 11:52:19 UTC (rev 2051)
@@ -96,4 +96,11 @@
 	}
 }
 
+sub modify {
+	my $cron = shift;
+	return undef unless defined $cron and $cron->get_status == Vhffs::Constants::WAITING_FOR_MODIFICATION;
+	$cron->set_status( Vhffs::Constants::ACTIVATED );
+	$cron->commit;
+}
+
 1;

Modified: trunk/vhffs-robots/Makefile.am
===================================================================
--- trunk/vhffs-robots/Makefile.am	2012-02-25 01:15:53 UTC (rev 2050)
+++ trunk/vhffs-robots/Makefile.am	2012-02-25 11:52:19 UTC (rev 2051)
@@ -60,8 +60,7 @@
 	src/web_create.pl \
 	src/web_delete.pl \
 	src/web_stats.pl \
-	src/cron_create.pl \
-	src/cron_delete.pl
+	src/cron.pl
 
 # Define the substitution we need to point perl script at correct location
 do_sed = $(SED) --in-place \

Copied: trunk/vhffs-robots/src/cron.pl (from rev 2043, trunk/vhffs-robots/src/cron_create.pl)
===================================================================
--- trunk/vhffs-robots/src/cron.pl	                        (rev 0)
+++ trunk/vhffs-robots/src/cron.pl	2012-02-25 11:52:19 UTC (rev 2051)
@@ -0,0 +1,59 @@
+#!%PERL%
+# Copyright (c) vhffs project and its contributors
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without 
+# modification, are permitted provided that the following conditions 
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright 
+#   notice, this list of conditions and the following disclaimer.
+#2. Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in 
+#   the documentation and/or other materials provided with the 
+#   distribution.
+#3. Neither the name of vhffs nor the names of its contributors 
+#   may be used to endorse or promote products derived from this 
+#   software without specific prior written permission.
+#
+#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
+#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
+#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
+#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
+#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
+#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
+# POSSIBILITY OF SUCH DAMAGE.
+
+use strict;
+use utf8;
+
+use lib '%VHFFS_LIB_DIR%';
+use Vhffs::Robots::Cron;
+
+my $vhffs = init Vhffs::Main;
+exit 1 unless defined $vhffs;
+
+Vhffs::Robots::lock( $vhffs, 'cron' );
+
+my $crons = Vhffs::Services::Cron::getall( $vhffs, Vhffs::Constants::WAITING_FOR_CREATION );
+foreach ( @{$crons} ) {
+	Vhffs::Robots::Cron::create( $_ );
+}
+
+$crons = Vhffs::Services::Cron::getall( $vhffs, Vhffs::Constants::WAITING_FOR_DELETION );
+foreach ( @{$crons} ) {
+	Vhffs::Robots::Cron::delete( $_ );
+}
+
+$crons = Vhffs::Services::Cron::getall( $vhffs, Vhffs::Constants::WAITING_FOR_MODIFICATION );
+foreach ( @{$crons} ) {
+	Vhffs::Robots::Cron::modify( $_ );
+}
+
+Vhffs::Robots::unlock( $vhffs, 'cron' );
+exit 0;

Deleted: trunk/vhffs-robots/src/cron_create.pl
===================================================================
--- trunk/vhffs-robots/src/cron_create.pl	2012-02-25 01:15:53 UTC (rev 2050)
+++ trunk/vhffs-robots/src/cron_create.pl	2012-02-25 11:52:19 UTC (rev 2051)
@@ -1,49 +0,0 @@
-#!%PERL%
-# Copyright (c) vhffs project and its contributors
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without 
-# modification, are permitted provided that the following conditions 
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright 
-#   notice, this list of conditions and the following disclaimer.
-#2. Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in 
-#   the documentation and/or other materials provided with the 
-#   distribution.
-#3. Neither the name of vhffs nor the names of its contributors 
-#   may be used to endorse or promote products derived from this 
-#   software without specific prior written permission.
-#
-#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
-#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
-#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
-#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
-#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
-#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
-#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
-#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 
-# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
-# POSSIBILITY OF SUCH DAMAGE.
-
-use strict;
-use utf8;
-
-use lib '%VHFFS_LIB_DIR%';
-use Vhffs::Robots::Cron;
-
-my $vhffs = init Vhffs::Main;
-exit 1 unless defined $vhffs;
-
-Vhffs::Robots::lock( $vhffs, 'cron' );
-
-my $crons = Vhffs::Services::Cron::getall( $vhffs, Vhffs::Constants::WAITING_FOR_CREATION );
-foreach ( @{$crons} ) {
-	Vhffs::Robots::Cron::create( $_ );
-}
-
-Vhffs::Robots::unlock( $vhffs, 'cron' );
-exit 0;

Deleted: trunk/vhffs-robots/src/cron_delete.pl
===================================================================
--- trunk/vhffs-robots/src/cron_delete.pl	2012-02-25 01:15:53 UTC (rev 2050)
+++ trunk/vhffs-robots/src/cron_delete.pl	2012-02-25 11:52:19 UTC (rev 2051)
@@ -1,49 +0,0 @@
-#!%PERL%
-# Copyright (c) vhffs project and its contributors
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without 
-# modification, are permitted provided that the following conditions 
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright 
-#   notice, this list of conditions and the following disclaimer.
-#2. Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in 
-#   the documentation and/or other materials provided with the 
-#   distribution.
-#3. Neither the name of vhffs nor the names of its contributors 
-#   may be used to endorse or promote products derived from this 
-#   software without specific prior written permission.
-#
-#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
-#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
-#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
-#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
-#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
-#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
-#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
-#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 
-# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
-# POSSIBILITY OF SUCH DAMAGE.
-
-use strict;
-use utf8;
-
-use lib '%VHFFS_LIB_DIR%';
-use Vhffs::Robots::Cron;
-
-my $vhffs = init Vhffs::Main;
-exit 1 unless defined $vhffs;
-
-Vhffs::Robots::lock( $vhffs, 'cron' );
-
-my $crons = Vhffs::Services::Cron::getall( $vhffs, Vhffs::Constants::WAITING_FOR_DELETION );
-foreach ( @{$crons} ) {
-	Vhffs::Robots::Cron::delete( $_ );
-}
-
-Vhffs::Robots::unlock( $vhffs, 'cron' );
-exit 0;


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/