[vhffs-dev] [1252] Improved all searchs |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
Revision: 1252
Author: gradator
Date: 2008-09-21 01:22:39 +0200 (Sun, 21 Sep 2008)
Log Message:
-----------
Improved all searchs
Modified Paths:
--------------
trunk/vhffs-api/src/Vhffs/Conf.pm
trunk/vhffs-api/src/Vhffs/Makefile.am
trunk/vhffs-api/src/Vhffs/Panel/Cron.pm
trunk/vhffs-api/src/Vhffs/Panel/Cvs.pm
trunk/vhffs-api/src/Vhffs/Panel/DNS.pm
trunk/vhffs-api/src/Vhffs/Panel/Git.pm
trunk/vhffs-api/src/Vhffs/Panel/Group.pm
trunk/vhffs-api/src/Vhffs/Panel/Mail.pm
trunk/vhffs-api/src/Vhffs/Panel/MailingList.pm
trunk/vhffs-api/src/Vhffs/Panel/Mysql.pm
trunk/vhffs-api/src/Vhffs/Panel/Object.pm
trunk/vhffs-api/src/Vhffs/Panel/Pgsql.pm
trunk/vhffs-api/src/Vhffs/Panel/Repository.pm
trunk/vhffs-api/src/Vhffs/Panel/Svn.pm
trunk/vhffs-api/src/Vhffs/Panel/User.pm
trunk/vhffs-api/src/Vhffs/Panel/Web.pm
trunk/vhffs-api/src/Vhffs/Services/Cron.pm
trunk/vhffs-api/src/Vhffs/Services/Web.pm
trunk/vhffs-backend/conf/vhffs.conf.dist.in
Modified: trunk/vhffs-api/src/Vhffs/Conf.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Conf.pm 2008-09-20 21:11:47 UTC (rev 1251)
+++ trunk/vhffs-api/src/Vhffs/Conf.pm 2008-09-20 23:22:39 UTC (rev 1252)
@@ -33,6 +33,7 @@
use strict;
use utf8;
+use Encode;
use Config::General;
#Vhffs::Conf written by sod` <dieu AT gunnm DOT org>
@@ -73,6 +74,8 @@
$Config{users}{available_shells} = '/bin/false' unless( defined $Config{'users'}{'available_shells'} );
$Config{users}{default_shell} = '/bin/false' unless( defined $Config{'users'}{'default_shell'} );
+ $Config{'global'}{'host_name'} = Encode::decode_utf8( $Config{'global'}{'host_name'} );
+
return \%Config;
}
Modified: trunk/vhffs-api/src/Vhffs/Makefile.am
===================================================================
--- trunk/vhffs-api/src/Vhffs/Makefile.am 2008-09-20 21:11:47 UTC (rev 1251)
+++ trunk/vhffs-api/src/Vhffs/Makefile.am 2008-09-20 23:22:39 UTC (rev 1252)
@@ -52,6 +52,7 @@
Robots/Git.pm \
Robots/User.pm \
Robots/Web.pm \
+ Robots/Cron.pm \
Services/Cvs.pm \
Services/DNS.pm \
Services/Web.pm \
Modified: trunk/vhffs-api/src/Vhffs/Panel/Cron.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Cron.pm 2008-09-20 21:11:47 UTC (rev 1251)
+++ trunk/vhffs-api/src/Vhffs/Panel/Cron.pm 2008-09-20 23:22:39 UTC (rev 1252)
@@ -86,7 +86,7 @@
if( defined $name ) {
$sql = 'SELECT c.cronpath, g.groupname, o.state FROM vhffs_cron c INNER JOIN vhffs_object o ON o.object_id=c.object_id INNER JOIN vhffs_groups g ON g.gid = o.owner_gid WHERE c.cronpath LIKE ?';
- push(@params, '%'.$name.'%');
+ push(@params, '%'.lc($name).'%');
} else {
$sql = 'SELECT c.cronpath, g.groupname, o.state FROM vhffs_cron c INNER JOIN vhffs_object o ON o.object_id=c.object_id INNER JOIN vhffs_groups g ON g.gid = o.owner_gid';
}
Modified: trunk/vhffs-api/src/Vhffs/Panel/Cvs.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Cvs.pm 2008-09-20 21:11:47 UTC (rev 1251)
+++ trunk/vhffs-api/src/Vhffs/Panel/Cvs.pm 2008-09-20 23:22:39 UTC (rev 1252)
@@ -57,7 +57,7 @@
if( defined $name ) {
$sql = 'SELECT c.cvsroot, g.groupname, o.state FROM vhffs_cvs c INNER JOIN vhffs_object o ON o.object_id = c.object_id INNER JOIN vhffs_groups g ON g.gid = o.owner_gid WHERE cvsroot LIKE ?';
- push(@params, '%'.$name.'%');
+ push(@params, '%'.lc($name).'%');
} else {
$sql = 'SELECT c.cvsroot, g.groupname, o.state FROM vhffs_cvs c INNER JOIN vhffs_object o ON o.object_id = c.object_id INNER JOIN vhffs_groups g ON g.gid = o.owner_gid';
}
Modified: trunk/vhffs-api/src/Vhffs/Panel/DNS.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/DNS.pm 2008-09-20 21:11:47 UTC (rev 1251)
+++ trunk/vhffs-api/src/Vhffs/Panel/DNS.pm 2008-09-20 23:22:39 UTC (rev 1252)
@@ -57,7 +57,7 @@
if( defined $name ) {
$sql = 'SELECT ns.domain, g.groupname, o.state FROM vhffs_dns ns INNER JOIN vhffs_object o ON o.object_id = ns.object_id INNER JOIN vhffs_groups g ON g.gid = o.owner_gid WHERE ns.domain LIKE ?';
- push(@params, '%'.$name.'%');
+ push(@params, '%'.lc($name).'%');
} else {
$sql = 'SELECT ns.domain, g.groupname, o.state FROM vhffs_dns ns INNER JOIN vhffs_object o ON o.object_id = ns.object_id INNER JOIN vhffs_groups g ON g.gid = o.owner_gid';
}
Modified: trunk/vhffs-api/src/Vhffs/Panel/Git.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Git.pm 2008-09-20 21:11:47 UTC (rev 1251)
+++ trunk/vhffs-api/src/Vhffs/Panel/Git.pm 2008-09-20 23:22:39 UTC (rev 1252)
@@ -99,7 +99,7 @@
if( defined $name ) {
$sql = 'SELECT s.reponame AS gitroot, g.groupname, o.state FROM vhffs_git s INNER JOIN vhffs_object o ON o.object_id=s.object_id INNER JOIN vhffs_groups g ON g.gid = o.owner_gid WHERE s.reponame LIKE ?';
- push(@params, '%'.$name.'%');
+ push(@params, '%'.lc($name).'%');
} else {
$sql = 'SELECT s.reponame AS gitroot, g.groupname, o.state FROM vhffs_git s INNER JOIN vhffs_object o ON o.object_id=s.object_id INNER JOIN vhffs_groups g ON g.gid = o.owner_gid';
}
Modified: trunk/vhffs-api/src/Vhffs/Panel/Group.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Group.pm 2008-09-20 21:11:47 UTC (rev 1251)
+++ trunk/vhffs-api/src/Vhffs/Panel/Group.pm 2008-09-20 23:22:39 UTC (rev 1252)
@@ -94,7 +94,7 @@
if( defined $name ) {
$sql = 'SELECT g.groupname, o.state, u.username FROM vhffs_groups g INNER JOIN vhffs_object o ON g.object_id = o.object_id INNER JOIN vhffs_users u ON u.uid = o.owner_uid WHERE g.groupname LIKE ?';
- push(@params, '%'.$name.'%');
+ push(@params, '%'.lc($name).'%');
} else {
$sql = 'SELECT g.groupname, o.state, u.username FROM vhffs_groups g INNER JOIN vhffs_object o ON g.object_id = o.object_id INNER JOIN vhffs_users u ON u.uid = o.owner_uid WHERE g.groupname NOT IN ( SELECT username FROM vhffs_users )';
}
Modified: trunk/vhffs-api/src/Vhffs/Panel/Mail.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Mail.pm 2008-09-20 21:11:47 UTC (rev 1251)
+++ trunk/vhffs-api/src/Vhffs/Panel/Mail.pm 2008-09-20 23:22:39 UTC (rev 1252)
@@ -54,7 +54,7 @@
if( defined $name ) {
$sql = 'SELECT m.domain, o.state, g.groupname FROM vhffs_mxdomain m INNER JOIN vhffs_object o ON o.object_id = m.object_id INNER JOIN vhffs_groups g ON g.gid = o.owner_gid WHERE m.domain LIKE ?';
- push(@params, '%'.$name.'%');
+ push(@params, '%'.lc($name).'%');
} else {
$sql = 'SELECT m.domain, o.state, g.groupname FROM vhffs_mxdomain m INNER JOIN vhffs_object o ON o.object_id = m.object_id INNER JOIN vhffs_groups g ON g.gid = o.owner_gid';
}
Modified: trunk/vhffs-api/src/Vhffs/Panel/MailingList.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/MailingList.pm 2008-09-20 21:11:47 UTC (rev 1251)
+++ trunk/vhffs-api/src/Vhffs/Panel/MailingList.pm 2008-09-20 23:22:39 UTC (rev 1252)
@@ -55,8 +55,7 @@
if( defined $name ) {
$sql = 'SELECT l.local_part, l.domain, g.groupname, o.state FROM vhffs_ml l INNER JOIN vhffs_object o ON o.object_id = l.object_id INNER JOIN vhffs_groups g ON g.gid = o.owner_gid WHERE l.local_part LIKE ? OR l.domain LIKE ?';
- push(@params, '%'.$name.'%');
- push(@params, '%'.$name.'%');
+ push(@params, '%'.lc($name).'%' , '%'.lc($name).'%' );
} else {
$sql = 'SELECT l.local_part, l.domain, g.groupname, o.state FROM vhffs_ml l INNER JOIN vhffs_object o ON o.object_id = l.object_id INNER JOIN vhffs_groups g ON g.gid = o.owner_gid';
}
Modified: trunk/vhffs-api/src/Vhffs/Panel/Mysql.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Mysql.pm 2008-09-20 21:11:47 UTC (rev 1251)
+++ trunk/vhffs-api/src/Vhffs/Panel/Mysql.pm 2008-09-20 23:22:39 UTC (rev 1252)
@@ -67,8 +67,7 @@
if( defined $name ) {
$sql = 'SELECT m.dbname, g.groupname, o.state FROM vhffs_mysql m INNER JOIN vhffs_object o ON o.object_id = m.object_id INNER JOIN vhffs_groups g ON g.gid = o.owner_gid WHERE m.dbname LIKE ? OR m.dbuser LIKE ?';
- push(@params, '%'.$name.'%');
- push(@params, '%'.$name.'%');
+ push(@params, '%'.lc($name).'%' , '%'.lc($name).'%' );
} else {
$sql = 'SELECT m.dbname, g.groupname, o.state FROM vhffs_mysql m INNER JOIN vhffs_object o ON o.object_id = m.object_id INNER JOIN vhffs_groups g ON g.gid = o.owner_gid';
}
Modified: trunk/vhffs-api/src/Vhffs/Panel/Object.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Object.pm 2008-09-20 21:11:47 UTC (rev 1251)
+++ trunk/vhffs-api/src/Vhffs/Panel/Object.pm 2008-09-20 23:22:39 UTC (rev 1252)
@@ -54,9 +54,8 @@
my $objs = [];
if( defined $name ) {
- $sql = 'SELECT o.object_id AS oid, u.username, g.groupname, o.type, o.state FROM vhffs_object o INNER JOIN vhffs_users u ON o.owner_uid = u.uid INNER JOIN vhffs_groups g ON o.owner_gid = g.gid WHERE ( o.description LIKE ? ) OR ( o.object_id LIKE ? ) OR ( o.owner_uid LIKE ? ) OR ( state LIKE ? ) OR ( u.username LIKE ? ) OR ( o.type LIKE ?) OR ( g.groupname LIKE ? ) ORDER BY o.object_id';
- my $p = '%'.$name.'%';
- push(@params, $p, $p, $p, $p, $p, $p, $p);
+ $sql = 'SELECT o.object_id AS oid, u.username, g.groupname, o.type, o.state FROM vhffs_object o INNER JOIN vhffs_users u ON o.owner_uid = u.uid INNER JOIN vhffs_groups g ON o.owner_gid = g.gid WHERE ( o.description ILIKE ? ) OR ( o.object_id = ? ) OR ( o.owner_uid = ? ) OR ( o.owner_gid = ? ) OR ( state = ? ) OR ( u.username LIKE ? ) OR ( g.groupname LIKE ? ) OR ( o.type = ? ) ORDER BY o.object_id';
+ push(@params, '%'.$name.'%', $name, $name, $name, $name, '%'.lc($name).'%', '%'.lc($name).'%', $name );
} else {
$sql = 'SELECT o.object_id AS oid, u.username, g.groupname, o.type, o.state FROM vhffs_object o INNER JOIN vhffs_users u ON o.owner_uid = u.uid INNER JOIN vhffs_groups g ON o.owner_gid = g.gid ORDER BY o.object_id';
}
Modified: trunk/vhffs-api/src/Vhffs/Panel/Pgsql.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Pgsql.pm 2008-09-20 21:11:47 UTC (rev 1251)
+++ trunk/vhffs-api/src/Vhffs/Panel/Pgsql.pm 2008-09-20 23:22:39 UTC (rev 1252)
@@ -57,7 +57,7 @@
if( defined $name ) {
$sql = 'SELECT p.dbname, g.groupname, o.state FROM vhffs_pgsql p INNER JOIN vhffs_object o ON o.object_id = p.object_id INNER JOIN vhffs_groups g ON g.gid = o.owner_gid WHERE p.dbname LIKE ? OR p.dbuser LIKE ?';
- push(@params, '%'.$name.'%', '%'.$name.'%');
+ push(@params, '%'.lc($name).'%', '%'.lc($name).'%');
} else {
$sql = 'SELECT p.dbname, g.groupname, o.state FROM vhffs_pgsql p INNER JOIN vhffs_object o ON o.object_id = p.object_id INNER JOIN vhffs_groups g ON g.gid = o.owner_gid';
}
Modified: trunk/vhffs-api/src/Vhffs/Panel/Repository.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Repository.pm 2008-09-20 21:11:47 UTC (rev 1251)
+++ trunk/vhffs-api/src/Vhffs/Panel/Repository.pm 2008-09-20 23:22:39 UTC (rev 1252)
@@ -86,7 +86,7 @@
if( defined $name ) {
$sql = 'SELECT r.name, g.groupname, o.state FROM vhffs_repository r INNER JOIN vhffs_object o ON o.object_id=r.object_id INNER JOIN vhffs_groups g ON g.gid = o.owner_gid WHERE r.name LIKE ?';
- push(@params, '%'.$name.'%');
+ push(@params, '%'.lc($name).'%');
} else {
$sql = 'SELECT r.name, g.groupname, o.state FROM vhffs_repository r INNER JOIN vhffs_object o ON o.object_id=r.object_id INNER JOIN vhffs_groups g ON g.gid = o.owner_gid';
}
Modified: trunk/vhffs-api/src/Vhffs/Panel/Svn.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Svn.pm 2008-09-20 21:11:47 UTC (rev 1251)
+++ trunk/vhffs-api/src/Vhffs/Panel/Svn.pm 2008-09-20 23:22:39 UTC (rev 1252)
@@ -97,7 +97,7 @@
if( defined $name ) {
$sql = 'SELECT s.reponame AS svnroot, g.groupname, o.state FROM vhffs_svn s INNER JOIN vhffs_object o ON o.object_id=s.object_id INNER JOIN vhffs_groups g ON g.gid = o.owner_gid WHERE s.reponame LIKE ?';
- push(@params, '%'.$name.'%');
+ push(@params, '%'.lc($name).'%');
} else {
$sql = 'SELECT s.reponame AS svnroot, g.groupname, o.state FROM vhffs_svn s INNER JOIN vhffs_object o ON o.object_id=s.object_id INNER JOIN vhffs_groups g ON g.gid = o.owner_gid';
}
Modified: trunk/vhffs-api/src/Vhffs/Panel/User.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/User.pm 2008-09-20 21:11:47 UTC (rev 1251)
+++ trunk/vhffs-api/src/Vhffs/Panel/User.pm 2008-09-20 23:22:39 UTC (rev 1252)
@@ -100,9 +100,8 @@
my $users = [];
if( defined $name ) {
- $sql = 'SELECT u.username, u.firstname, u.lastname , o.state FROM vhffs_users u INNER JOIN vhffs_object o ON o.object_id = u.object_id WHERE u.username LIKE ? OR u.firstname LIKE ? OR u.lastname LIKE ?';
- my $p = '%'.$name.'%';
- push(@params, $p, $p, $p);
+ $sql = 'SELECT u.username, u.firstname, u.lastname , o.state FROM vhffs_users u INNER JOIN vhffs_object o ON o.object_id = u.object_id WHERE u.username LIKE ? OR u.firstname ILIKE ? OR u.lastname ILIKE ?';
+ push(@params, '%'.lc($name).'%', '%'.$name.'%', '%'.$name.'%');
} else {
$sql = 'SELECT u.username, u.firstname, u.lastname , o.state FROM vhffs_users u INNER JOIN vhffs_object o ON o.object_id = u.object_id';
}
Modified: trunk/vhffs-api/src/Vhffs/Panel/Web.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Web.pm 2008-09-20 21:11:47 UTC (rev 1251)
+++ trunk/vhffs-api/src/Vhffs/Panel/Web.pm 2008-09-20 23:22:39 UTC (rev 1252)
@@ -106,7 +106,7 @@
if( defined $name ) {
$sql = 'SELECT w.servername, o.state, g.groupname FROM vhffs_httpd w INNER JOIN vhffs_object o ON o.object_id = w.object_id INNER JOIN vhffs_groups g ON g.gid = o.owner_gid WHERE w.servername LIKE ?';
- push(@params, '%'.$name.'%');
+ push(@params, '%'.lc($name).'%');
} else {
$sql = 'SELECT w.servername, o.state, g.groupname FROM vhffs_httpd w INNER JOIN vhffs_object o ON o.object_id = w.object_id INNER JOIN vhffs_groups g ON g.gid = o.owner_gid';
}
@@ -133,11 +133,11 @@
push @params, Vhffs::Constants::ACTIVATED;
if(defined $servername) {
$from .= ' AND w.servername LIKE ?';
- push @params, '%'.$servername.'%';
+ push @params, '%'.lc($servername).'%';
}
if(defined $description) {
- $from .= ' AND o.description LIKE ?';
+ $from .= ' AND o.description ILIKE ?';
push @params, '%'.$description.'%';
}
Modified: trunk/vhffs-api/src/Vhffs/Services/Cron.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Services/Cron.pm 2008-09-20 21:11:47 UTC (rev 1251)
+++ trunk/vhffs-api/src/Vhffs/Services/Cron.pm 2008-09-20 23:22:39 UTC (rev 1252)
@@ -223,12 +223,17 @@
return $repos;
}
+
+sub get_cron_id {
+ my $self = shift;
+ return $self->{'cron_id'};
+}
+
sub get_label {
my $self = shift;
return $self->{'cronpath'};
}
-
sub get_cronpath {
my $self = shift;
return $self->{'cronpath'};
@@ -345,6 +350,59 @@
return 1;
}
+sub quick_set_running
+{
+ my ($self , $value) = @_;
+ return undef unless( $value =~ /^\d+$/ );
+ my $query = 'UPDATE vhffs_cron SET running=? WHERE cron_id=?';
+ my $request = $self->{'db'}->prepare($query);
+ return $request->execute( $value , $self->{'cron_id'} );
+}
+
+sub quick_inc_running
+{
+ my $self = shift;
+ my $query = 'UPDATE vhffs_cron SET running=running+1 WHERE cron_id=?';
+ my $request = $self->{'db'}->prepare($query);
+ return $request->execute( $self->{'cron_id'} );
+}
+
+sub quick_dec_running
+{
+ my $self = shift;
+ my $query = 'UPDATE vhffs_cron SET running=running-1 WHERE cron_id=?';
+ my $request = $self->{'db'}->prepare($query);
+ return $request->execute( $self->{'cron_id'} );
+}
+
+sub quick_get_running
+{
+ my $self = shift;
+ my $query = 'SELECT running FROM vhffs_cron WHERE cron_id=?';
+ my $request = $self->{'db'}->prepare($query);
+ $request->execute( $self->{'cron_id'} ) or return undef;
+ my @r = $request->fetchrow_array();
+ return ${@r}[0];
+}
+
+sub quick_set_nextrundate
+{
+ my ($self , $value) = @_;
+ return undef unless( $value =~ /^\d+$/ );
+ my $query = 'UPDATE vhffs_cron SET nextrundate=? WHERE cron_id=?';
+ my $request = $self->{'db'}->prepare($query);
+ return $request->execute( $value , $self->{'cron_id'} );
+}
+
+sub quick_set_lastrun
+{
+ my ($self , $date, $returncode) = @_;
+ return undef unless ( $date =~ /^\d+$/ && $returncode =~ /^\d+$/ );
+ my $query = 'UPDATE vhffs_cron SET lastrundate=?, lastrunreturncode=? WHERE cron_id=?';
+ my $request = $self->{'db'}->prepare($query);
+ return $request->execute( $date , $returncode , $self->{'cron_id'} );
+}
+
sub getall_per_group
{
my ($main, $group) = @_;
Modified: trunk/vhffs-api/src/Vhffs/Services/Web.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Services/Web.pm 2008-09-20 21:11:47 UTC (rev 1251)
+++ trunk/vhffs-api/src/Vhffs/Services/Web.pm 2008-09-20 23:22:39 UTC (rev 1252)
@@ -193,9 +193,9 @@
}
if( defined $name ) {
- $sql .= ' AND ( o.description LIKE ? OR w.servername LIKE ? )';
+ $sql .= ' AND ( o.description ILIKE ? OR w.servername LIKE ? )';
push(@params, '%'.$name.'%');
- push(@params, '%'.$name.'%');
+ push(@params, '%'.lc($name).'%');
}
$sql .= ' ORDER BY servername';
Modified: trunk/vhffs-backend/conf/vhffs.conf.dist.in
===================================================================
--- trunk/vhffs-backend/conf/vhffs.conf.dist.in 2008-09-20 21:11:47 UTC (rev 1251)
+++ trunk/vhffs-backend/conf/vhffs.conf.dist.in 2008-09-20 23:22:39 UTC (rev 1252)
@@ -466,6 +466,15 @@
# URL to the documentation (optional)
url_doc = http://help.myhoster.net/cron
+
+ # Path to chroot() to before executing scripts
+ chroot = /
+
+ # From: of emails sent by the cron scheduler
+ mail_from = cron@xxxxxxxxx
+
+ # Maximum execution time (in seconds)
+ max_execution_time = 7200
</cron>
</services>