From 2f6bd5e7fbbd9e702ecedc27ea4aac9a3e94b685 Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Sat, 3 Sep 2016 18:50:16 +0100 Subject: [PATCH] playing --- bin/nb-repo-dirs | 23 ++++++++++++++++------- etc/dbs.php | 2 +- etc/dbs/owncloud.php | 2 +- etc/profile.d/nb.sh | 13 +++++++++++++ etc/repo-dirs.conf | 2 +- lib/php/nb.php | 11 +++++++++++ 6 files changed, 43 insertions(+), 10 deletions(-) diff --git a/bin/nb-repo-dirs b/bin/nb-repo-dirs index a8f136d7..04407b61 100755 --- a/bin/nb-repo-dirs +++ b/bin/nb-repo-dirs @@ -8,6 +8,10 @@ use strict; use File::Spec; use Cwd; use File::Basename; +my @FILES_CHECK = ( + '.nb-install', + '.nb-update', +); my $FILE_EXISTS = '.nb-install'; my $NB_ROOT = dirname ( dirname ( File::Spec->rel2abs( Cwd::abs_path(__FILE__) ) ) ); @@ -36,17 +40,22 @@ print grep {$_ ne "" and !$h{$_}++} map { - # To reduce glob return, we permit to use file + # To reduce glob return, we permit to use file as filter my $dir = (-e $_ and !-d $_) ? dirname($_) : $_; - if (-d "$dir/.git") { - warn "DEBUG: MISSING: $dir/$FILE_EXISTS\n" if $DEBUG and !-r "$dir/$FILE_EXISTS"; - add_args($dir); - #$dir; - } else { + # Check is git + if (!-d "$dir/.git") { warn "DEBUG: REJECT : $dir\n" if $DEBUG; ""; - } + continue; + } + + if ($DEBUG) { + for (@FILES_CHECK) { + warn "DEBUG: MISSING: $dir/$_\n" if !-r "$dir/$_"; + } + } + add_args($dir); } glob join(' ',@DIRS) diff --git a/etc/dbs.php b/etc/dbs.php index 7fc09237..5fa65b0c 100644 --- a/etc/dbs.php +++ b/etc/dbs.php @@ -8,7 +8,7 @@ $LOCAL_DB = ( ) ? true : false; # Look for sqlite db path -$DIR_SQLITE = '~nicoadm/ownCloud'; +$DIR_SQLITE = ''; foreach ([ '~nico/ownCloud', '~nicoadm/ownCloud', diff --git a/etc/dbs/owncloud.php b/etc/dbs/owncloud.php index 0fdb37f2..27653062 100644 --- a/etc/dbs/owncloud.php +++ b/etc/dbs/owncloud.php @@ -2,7 +2,7 @@ $CONF['owncloud'] = [ 'host' => "$DIR_SQLITE/owncloud.db", 'type' => 'sqlite', - 'default_table' => 'oc_users', + #'default_table' => 'oc_users', 'default_table' => 'last_files', 'tables' => [ 'last_files' => [ diff --git a/etc/profile.d/nb.sh b/etc/profile.d/nb.sh index 14e73827..fe2f7125 100644 --- a/etc/profile.d/nb.sh +++ b/etc/profile.d/nb.sh @@ -1,3 +1,16 @@ +nb_repos_commit_push() { + shell_help "Commit each repos whith a comment" "$@" && return + local status + local pwd=`pwd` + for i in $(nb-repo-dirs); do + cd "$i" || continue + + printf ">%s\n" "$i" + git commit -a -m "$*" && git push | sed 's/^/ /' + done + cd "$pwd" +} + nb_repos_status() { shell_help "List repos git status" "$@" && return local status diff --git a/etc/repo-dirs.conf b/etc/repo-dirs.conf index 1f72ca88..fe293c3c 100644 --- a/etc/repo-dirs.conf +++ b/etc/repo-dirs.conf @@ -1 +1 @@ -/{opt,opt/www,etc,home,home/www,usr/local/src,home/*/Dev,home/share/git}/*/.nb-install +/{opt,opt/www,etc,home,home/www,usr/local/src,home/*/Dev,home/share/git}/*/.nb-{install,update} diff --git a/lib/php/nb.php b/lib/php/nb.php index e242ec63..bd1fe8cc 100644 --- a/lib/php/nb.php +++ b/lib/php/nb.php @@ -727,5 +727,16 @@ class NB { exit; } + public static function oc_password_verify($pass) { + require_once "/home/owncloud/config/config.php"; + require_once '/opt/owncloud/lib/base.php'; + require_once '/opt/owncloud/lib/private/Security/Hasher.php'; + return \OC::$server->getHasher()->hash($pass); + $l = new Hasher($CONFIG); + debug($l->legacyHashVerify($pass,"YbS9N9cK8TY6b7oyw3skfcHykXIjlx")); + return $CONFIG; + debug($CONF); + } + } # < Class ?> -- 2.47.3